Files
mercury/tests/invalid/arith_wrong_module.err_exp
Zoltan Somogyi 83fe4d2331 Print more useful actual/expected type diffs.
compiler/typecheck_errors.m:
    When we report a mismatch between the actual and expected types,
    we print both types. When both these types are big, doing a "visual diff"
    between the two can be hard, which is why, for a while now, we have had
    code to print the diffs between the two types. However, the code computing
    this diff had a bug. It detected and reported situations in which the
    actual and expected types had, in the same position, the same type
    constructor name but with two different arities, but ignored situations
    in the type constructed differed in their names, which is a much more
    common problem. Fix this.

    When we report a mismatch between the actual and expected types,
    we print the types themselves colored incorrect and correct respectively.
    But when we diagnosed the sources of the difference, we printed
    only the report of the mismatch using the incorrect color, and printed
    the mismatched actual and expected entities using the "inconsistent" color.
    Fix this.

compiler/typecheck_error_type_assign.m:
    When the difference between actual and expected types occurs even when
    builtin qualifiers have been stripped type names in both, record the
    types so stripped not just in the format_pieces representations of the
    types, but the types themselves. This avoids the need for new code
    in typecheck_errors.m to consider the same issue.

compiler/error_spec.m:
    Minor improvements in comments.

tests/invalid/actual_expected.err_exp:
tests/invalid/arith_wrong_module.err_exp:
tests/invalid/bug197.err_exp:
tests/invalid/ext_type_bug.err_exp:
tests/invalid/fbnf.err_exp:
tests/invalid/higher_order_mode_mismatch.err_exp:
tests/invalid/type_diff.err_exp:
tests/invalid_purity/impure_pred_t1_fixed.err_exp:
tests/invalid_purity/impure_pred_t2.err_exp:
tests/invalid_purity/purity_nonsense_1.err_exp:
tests/invalid_purity/purity_nonsense_2.err_exp:
    Expect updated diagnostics.
2025-02-14 16:52:17 +11:00

2.7 KiB

arith_wrong_module.m:022: In clause for predicate `test_func'/3:
arith_wrong_module.m:022: type error in unification of variable `C'
arith_wrong_module.m:022: and functor `+'/2.
arith_wrong_module.m:022: Variable `C' has type
arith_wrong_module.m:022: uint32,
arith_wrong_module.m:022: functor `+'/2 has type
arith_wrong_module.m:022: `+'(int, int): int.
arith_wrong_module.m:022: Note that operations on values of type `uint32' are
arith_wrong_module.m:022: available only if module `uint32' is imported.
arith_wrong_module.m:025: In clause for predicate `test_pred'/3:
arith_wrong_module.m:025: in call to predicate `int.pow'/3:
arith_wrong_module.m:025: in argument 1:
arith_wrong_module.m:025: variable `A' has type
arith_wrong_module.m:025: int16,
arith_wrong_module.m:025: expected type was
arith_wrong_module.m:025: int;
arith_wrong_module.m:025: in argument 2:
arith_wrong_module.m:025: variable `B' has type
arith_wrong_module.m:025: uint16,
arith_wrong_module.m:025: expected type was
arith_wrong_module.m:025: int;
arith_wrong_module.m:025: in argument 3:
arith_wrong_module.m:025: variable `C' has type
arith_wrong_module.m:025: int16,
arith_wrong_module.m:025: expected type was
arith_wrong_module.m:025: int.
arith_wrong_module.m:025: Note that operations on values of types `int16'
arith_wrong_module.m:025: `uint16' are available only if modules `int16' and
arith_wrong_module.m:025: `uint16' are imported.
arith_wrong_module.m:028: In clause for predicate `game_loop'/4:
arith_wrong_module.m:028: in unification of variable `Diff'
arith_wrong_module.m:028: and term `(End - Start)':
arith_wrong_module.m:028: type error in arguments of functor `-'/2.
arith_wrong_module.m:028: Argument 1 (End) has type
arith_wrong_module.m:028: int64,
arith_wrong_module.m:028: expected type was
arith_wrong_module.m:028: int.
arith_wrong_module.m:028: Argument 2 (Start) has type
arith_wrong_module.m:028: int64,
arith_wrong_module.m:028: expected type was
arith_wrong_module.m:028: int.
arith_wrong_module.m:028: Note that operations on values of type `int64' are
arith_wrong_module.m:028: available only if module `int64' is imported.
For more information, recompile with `-E'.