Files
mercury/tests/invalid/coerce_recursive_inst.err_exp
Peter Wang 233874403f Improve coerce mode error messages.
compiler/mode_errors.m:
    Replace the two existing options for coerce mode errors with one
    that includes:
    - the path to the input subterm where the error was detected
    - the type of the input subterm
    - the target type that the subterm should be converted to
    - the reason for the error

compiler/modecheck_coerce.m:
    Modify the code to produce the above information.
    Semidet predicates that previously failed when an error is detected
    are changed to det predicates that return the error information.

    In a couple of places where predicates previously would fail,
    we now abort because the conditions should not occur.

compiler/hlds_out_util.m:
    Describe coerce as "coerce expression" (shows up in mode errors).

tests/invalid/Mmakefile:
tests/invalid/coerce_mode_error2.err_exp:
tests/invalid/coerce_mode_error2.m:
    Add test case.

tests/invalid/coerce_clobbered.err_exp:
tests/invalid/coerce_implied_mode.err_exp:
tests/invalid/coerce_instvar.err_exp:
tests/invalid/coerce_int.err_exp:
tests/invalid/coerce_mode_error.err_exp:
tests/invalid/coerce_recursive_inst.err_exp:
tests/invalid/coerce_recursive_type.err_exp:
tests/invalid/coerce_unreachable.err_exp:
    Update expected error messages.
2021-05-17 12:55:58 +10:00

24 lines
1.5 KiB
Plaintext

coerce_recursive_inst.m:042: In clause for
coerce_recursive_inst.m:042: `bad1(in((coerce_recursive_inst.cons))) =
coerce_recursive_inst.m:042: out((coerce_recursive_inst.cons))':
coerce_recursive_inst.m:042: in coerce expression:
coerce_recursive_inst.m:042: mode error: in the argument term:
coerce_recursive_inst.m:042: in the first argument of function symbol `cons':
coerce_recursive_inst.m:042: cannot convert the subterm from type
coerce_recursive_inst.m:042: `coerce_recursive_inst.fruit' to
coerce_recursive_inst.m:042: `coerce_recursive_inst.citrus' because it has
coerce_recursive_inst.m:042: instantiatedness `ground', and
coerce_recursive_inst.m:042: `coerce_recursive_inst.fruit' is not a subtype
coerce_recursive_inst.m:042: of `coerce_recursive_inst.citrus'.
coerce_recursive_inst.m:048: In clause for
coerce_recursive_inst.m:048: `bad2(in((coerce_recursive_inst.cons))) = out':
coerce_recursive_inst.m:048: in coerce expression:
coerce_recursive_inst.m:048: mode error: in the argument term:
coerce_recursive_inst.m:048: in the first argument of function symbol `cons':
coerce_recursive_inst.m:048: cannot convert the subterm from type
coerce_recursive_inst.m:048: `coerce_recursive_inst.fruit' to
coerce_recursive_inst.m:048: `coerce_recursive_inst.citrus' because it has
coerce_recursive_inst.m:048: instantiatedness `ground', and
coerce_recursive_inst.m:048: `coerce_recursive_inst.fruit' is not a subtype
coerce_recursive_inst.m:048: of `coerce_recursive_inst.citrus'.