mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-24 05:43:53 +00:00
compiler/typecheck_error_undef.m:
When users try to use arithmetic operations, bitwise operations,
or comparisons (meaning functions such as '+' or '<<', or predicates
such as '<') without importing any of the modules that define those ops,
generate a diagnostic that explains this specific situation. Mercury
is unusual in requiring such imports, so novices need to have this
pointed out to them. Have these messages replace the less-specific
messages we used to generate in such situations.
Fix a persistent typo.
tests/invalid/int_ops.{m,err_exp}:
A new test case for the new diagnostics.
tests/invalid/Mmakefile:
Enable the new test case.
tests/invalid/multiply_star.err_exp:
Expect the diagnostic text, and stop expecting the "did you mean"
message that it replaces.
tests/invalid/multiply_star.err_exp[23]:
Delete these files. They existed only because different sets of imports
with different options yielded different "did you mean" suggestions,
and we don't have those anymore.
tests/invalid/multiply_star.m:
Update the descriptions of the deleted .err_exp[23] files.
33 lines
1001 B
Mathematica
33 lines
1001 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% The .err_exp file was for non-debug grades without --intermod-opt.
|
|
% The .err_exp2 file was for all grades with --intermod-opt.
|
|
% The .err_exp3 file was for debug grades without --intermod-opt.
|
|
% They differed when the "did you mean" part of the error message included
|
|
% a list of the visible one-character symbols, and --intermod-opt and
|
|
% debugging (through implicit import of table_builtin.m for I/O tabling)
|
|
% affected the list of such symbols.
|
|
%
|
|
% Now, the compiler generates more-specific text than the "did you mean"
|
|
% message, so we have only the .err_exp file.
|
|
%
|
|
|
|
:- module multiply_star.
|
|
|
|
:- interface.
|
|
|
|
:- pred p(int::in, int::out) is det.
|
|
|
|
:- implementation.
|
|
|
|
% :- import_module int. % This import is missing.
|
|
|
|
p(A, Z) :-
|
|
( if A = 0 then
|
|
Z = 1
|
|
else
|
|
Z = A * 2
|
|
).
|