mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +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.
35 lines
984 B
Mathematica
35 lines
984 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% Don't emit an erroneous warning about the variable that is the subject
|
|
% of a require_complete_switch scope not occurring in the sub-goal if
|
|
% the sub-goal in question is not a switch and the variable in question
|
|
% does not occur in the non-local set of the sub-goal.
|
|
% (See also tests/warnings/bug257b.m.)
|
|
%
|
|
% This test is now disabled, since we now generate an error when a
|
|
% require_complete_switch scope is wrapped around a goal that is not
|
|
% a switch on the named variable.
|
|
|
|
:- module bug257b.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- type xyz
|
|
---> x
|
|
; y
|
|
; z.
|
|
|
|
:- pred oops(xyz::in, int::out, io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
oops(_G, N, !IO) :-
|
|
require_complete_switch [Gee] (
|
|
Gee = 123,
|
|
io.write(Gee, !IO),
|
|
N = 3
|
|
).
|