mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 11:23:46 +00:00
compiler/det_report.m:
Generate an error message if a require_complete_switch [X] scope
is wrapped around a goal that is not a switch on X.
doc/reference_manual.texi:
Update the reference manual to document this change. Also fix an
old documentation problem: require_complete_switch scopes do NOT
require covering all the function symbols in the type of the
switch-on variable if the switched-on variable's inst says that
it cannot be bound to some of them.
compiler/hlds_goal.m:
Update the comment on the require_complete_switch scope
in the same way.
NEWS:
Announce the change.
tests/warnings/bug257.{m,exp}:
tests/invalid/bug257.{m,err_exp}:
tests/warnings/Mmakefile:
tests/invalid/Mmakefile:
For the bug257.m test case, which has a require_complete_switch [X] scope
around a goal that is not a switch on X, expect the error message
we now generate, not the old warning.
Since the compilation of bug257.m now fails, move it from warnings
to invalid.
tests/valid/Mmakefile:
Disable the bug257b.m test case, which also had a
require_complete_switch [X] scope around a goal that was not a switch on X.
tests/valid/bug257b.m:
Document that this test case is now disabled, and why.
27 lines
638 B
Mathematica
27 lines
638 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% Regression test for bug #257: the compiler was not issuing a warning about
|
|
% the fact that the variable Gee which was the subject of a
|
|
% require_complete_switch did not occur in the scoped goal.
|
|
|
|
:- module bug257.
|
|
:- interface.
|
|
|
|
:- type xyz ---> x ; y ; z.
|
|
|
|
:- pred oops(xyz::in, int::out) is semidet.
|
|
|
|
:- implementation.
|
|
|
|
oops(G, N) :-
|
|
require_complete_switch [Gee]
|
|
(
|
|
G = x,
|
|
N = 1
|
|
;
|
|
G = y,
|
|
fail
|
|
).
|