mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-21 04:13:46 +00:00
compiler/mode_errors.m:
There are two improvements.
The first and much the more important is that when a call does not match
any of the declared modes of the called predicate or function, we now
print the names and insts of any arguments whose insts, by themselves,
do not match any of the callee's modes. Instead of reporting "here are
all the arguments, here are all their insts, find out for yourself
which one is wrong", the compiler now tells the programmer explicitly
which one is wrong in almost all cases. (Not all. If e.g. two args <A, B>
have insts <free, free>, but the callee has two modes, <in, out> and
<out, in>, then the compiler won't report either arg, since neither arg
is wrong by itself.)
The second improvement is that when the verbosity settings ask us
to print all possible reasons why we can't schedule a conjunction,
instead of our default approach of printing the only the first,
we now put a blank line between the different reasons, for visual
separation.
compiler/modecheck_call.m:
Preserve the extra information now needed by mode_errors.m.
compiler/modecheck_util.m:
Conform to the changes above.
tests/invalid/any_passed_as_ground.err_exp:
tests/invalid/anys_in_negated_contexts.err_exp:
tests/invalid/constrained_poly_insts2.err_exp:
tests/invalid/ho_default_func_1.err_exp:
tests/invalid/ho_default_func_3.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/modes_erroneous.err_exp:
tests/invalid/try_detism.err_exp:
Expect the updated error messages for these tests.
17 lines
905 B
Plaintext
17 lines
905 B
Plaintext
modes_erroneous.m:020: In clause for `p(in, out)':
|
|
modes_erroneous.m:020: mode error in conjunction. The next 2 error messages
|
|
modes_erroneous.m:020: indicate possible causes of this error.
|
|
modes_erroneous.m:020:
|
|
modes_erroneous.m:020: In clause for `p(in, out)':
|
|
modes_erroneous.m:020: in argument 1 of call to predicate
|
|
modes_erroneous.m:020: `modes_erroneous.p'/2:
|
|
modes_erroneous.m:020: mode error: variable `V_5' has instantiatedness
|
|
modes_erroneous.m:020: `free',
|
|
modes_erroneous.m:020: expected instantiatedness was `ground'.
|
|
modes_erroneous.m:020:
|
|
modes_erroneous.m:019: In clause for `p(in, out)':
|
|
modes_erroneous.m:019: in argument 2 of clause head:
|
|
modes_erroneous.m:019: mode error in unification of `HeadVar__2' and `X'.
|
|
modes_erroneous.m:019: Variable `HeadVar__2' has instantiatedness `free',
|
|
modes_erroneous.m:019: variable `X' has instantiatedness `free'.
|