mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
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.
1.2 KiB
1.2 KiB
actual_expected.m:110: In clause for predicate `find_compulsory_lvals'/5:
actual_expected.m:110: in argument 2 of call to predicate
actual_expected.m:110: `actual_expected.find_compulsory_lvals'/5:
actual_expected.m:110: type error: variable `LiveMap' has type
actual_expected.m:110: tree234.tree234(
actual_expected.m:110: actual_expected.label,
actual_expected.m:110: set_ordlist.set_ordlist(actual_expected.lval)
actual_expected.m:110: );
actual_expected.m:110: expected type was
actual_expected.m:110: maybe.maybe(
actual_expected.m:110: tree234.tree234(
actual_expected.m:110: actual_expected.label,
actual_expected.m:110: set_ordlist.set_ordlist(actual_expected.lval)
actual_expected.m:110: )
actual_expected.m:110: ).
actual_expected.m:110: Arity mismatch for type constructor `tree234':
actual_expected.m:110: expected one argument, got two.
For more information, recompile with `-E'.
actual_expected.m:110: in argument 2 of call to predicate
actual_expected.m:110: `actual_expected.find_compulsory_lvals'/5:
actual_expected.m:110: type error: variable `LiveMap' has type
actual_expected.m:110: tree234.tree234(
actual_expected.m:110: actual_expected.label,
actual_expected.m:110: set_ordlist.set_ordlist(actual_expected.lval)
actual_expected.m:110: );
actual_expected.m:110: expected type was
actual_expected.m:110: maybe.maybe(
actual_expected.m:110: tree234.tree234(
actual_expected.m:110: actual_expected.label,
actual_expected.m:110: set_ordlist.set_ordlist(actual_expected.lval)
actual_expected.m:110: )
actual_expected.m:110: ).
actual_expected.m:110: Arity mismatch for type constructor `tree234':
actual_expected.m:110: expected one argument, got two.
For more information, recompile with `-E'.