Files
mercury/tests/invalid/ho_default_func_1.err_exp
Zoltan Somogyi b831562958 Improve error messages for some mode errors.
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.
2020-01-24 14:19:30 +11:00

22 lines
1.1 KiB
Plaintext

ho_default_func_1.m:034: In clause for `baz(in, out)':
ho_default_func_1.m:034: mode error in conjunction. The next 2 error messages
ho_default_func_1.m:034: indicate possible causes of this error.
ho_default_func_1.m:034:
ho_default_func_1.m:034: In clause for `baz(in, out)':
ho_default_func_1.m:034: in call to function `univ.univ'/1:
ho_default_func_1.m:034: mode error: argument `V_7' and the return value
ho_default_func_1.m:034: `V_6' have the following insts:
ho_default_func_1.m:034: /* unique */ (func(out) = in is det),
ho_default_func_1.m:034: free
ho_default_func_1.m:034: which does not match any of the modes for function
ho_default_func_1.m:034: `univ.univ'/1.
ho_default_func_1.m:034:
ho_default_func_1.m:034: In clause for `baz(in, out)':
ho_default_func_1.m:034: in call to predicate `univ.univ_to_type'/2:
ho_default_func_1.m:034: mode error: arguments `V_6, Y0' have the following
ho_default_func_1.m:034: insts:
ho_default_func_1.m:034: free,
ho_default_func_1.m:034: free
ho_default_func_1.m:034: which does not match any of the modes for predicate
ho_default_func_1.m:034: `univ.univ_to_type'/2.