mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 02:43:40 +00:00
compiler/typecheck_errors.m:
Improve the diagnostics we generate for mismatches between actual and
expected types. If the mismatch was between a single actual type and
a single expected type, we already printed a message whose format
was specialized for that case, but in every other case, we fell back
to a more general but less readable error message template. Improve on this
by splitting the task into two halves, one for the actual type(s) and one
for the expected type(s), each of which generates simpler text if
there is only one such type.
Separate the actual type part of the diagnostic from the expected type part
using a semicolon instead of a comma, because we now use commas to
separate multiple actual types from each other, and multiple expected
types from each other.
Don't insist on putting a newline after the "type error:" part of the
diagnostic.
Do all of the above in just one predicate, factoring out code that
used to be duplicated.
Delete a function that has never been used. (I added it around 2008
for later use by a student working on software transactional memory,
but that use never happened.) This used to contain a third copy
of the code that was factored out.
For functions that used to take both a typecheck_info and a
type_error_clause_context, delete the latter argument, since the caller
invariably took it out of the typecheck_info that it also passed.
compiler/typecheck.m:
Don't pass now-unneeded type_error_clause_contexts.
compiler/typecheck_error_type_assign.m:
Fix typo in a field name.
tests/invalid/abstract_eqv.err_exp:
tests/invalid/actual_expected.err_exp:
tests/invalid/actual_more_expected.err_exp:
tests/invalid/bug197.err_exp:
tests/invalid/ext_type_bug.err_exp:
tests/invalid/fbnf.err_exp:
tests/invalid/foreign_procs_exist_type.err_exp:
tests/invalid/higher_order_mode_mismatch.err_exp:
tests/invalid/integral_constant_no_suffix.err_exp:
tests/invalid/method_impl.err_exp:
tests/invalid/mixed_up_streams.err_exp:
tests/invalid/try_bad_params.err_exp:
tests/invalid/type_diff.err_exp:
tests/invalid/type_error_ambiguous.err_exp:
tests/invalid/types2.err_exp:
tests/invalid_nodepend/errors2.err_exp:
tests/invalid_purity/impure_pred_t1_fixed.err_exp:
tests/invalid_purity/impure_pred_t2.err_exp:
tests/invalid_purity/purity_nonsense.err_exp:
tests/invalid_purity/purity_nonsense2.err_exp:
Update expected error messages.
12 lines
576 B
Plaintext
12 lines
576 B
Plaintext
method_impl.m:026: In clause for type class method implementation:
|
|
method_impl.m:026: in argument 2 of predicate `method_impl.foo_m1'/2:
|
|
method_impl.m:026: type error: variable `HeadVar__2' has type
|
|
method_impl.m:026: int;
|
|
method_impl.m:026: expected type was
|
|
method_impl.m:026: string.
|
|
method_impl.m:026: The partial type assignment was:
|
|
method_impl.m:026: HeadVar__1_1: method_impl.foo
|
|
method_impl.m:026: HeadVar__2_2: int
|
|
method_impl.m:029: In clause for type class method implementation:
|
|
method_impl.m:029: error: undefined predicate `bar_m1'/2.
|