mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +00:00
compiler/typecheck_errors.m:
Redo the way we generate diagnostics for unproven typeclass constraints.
The old approach was: for each type assign (of which there can be many),
print the list of unproven constraints in that type_assign. Given N
type assigns, this could print a constraint up to N times.
This diff switches to a new approach that computes
- the set of constraints that are unproven in *all* type assigns,
and which are therefore *definitely* errors, and
- the set of constraints that are unproven in *some but not all*
type assigns, which therefore *may be* errors, but also may be
non-errors,
and then prints both sets with an explanation of each. Besides the
classification being helpful to users, telling them which constraints
to concentrate on fixing first, this approach also guarantees that
each constraint in its output will appear just once. In other words,
it has much better worst-case behavior. (Unfortunately, the test suite
has no test cases that are more complicated than two unproven constraints
in a single type assign.)
compiler/mark_tail_calls.m:
Add color to the diagnostics generated by this module.
compiler/add_clause.m:
compiler/check_type_inst_mode_defns.m:
compiler/field_access.m:
Tweaks to move towards a situation where the messages generated
for similar errors either in different circumstances or to different
kinds of entities use the same terminology and use color the same way
to the extent possible.
tests/invalid/record_syntax_errors.err_exp:
tests/invalid/ref_to_implicit_comma.err_exp:
tests/invalid/repeated_field_name.err_exp:
tests/invalid/repeated_instance_vars_unsat.err_exp:
tests/invalid/require_tailrec_1.err_exp:
tests/invalid/require_tailrec_1.err_exp2:
tests/invalid/require_tailrec_2.err_exp:
tests/invalid/require_tailrec_2.err_exp2:
tests/invalid/require_tailrec_3.err_exp:
tests/invalid/require_tailrec_3.err_exp2:
tests/invalid/typeclass_test_13.err_exp:
tests/invalid/typeclass_test_7.err_exp:
tests/invalid/unsatisfiable_constraint_bug.err_exp:
tests/invalid/unsatisfiable_constraint_msg.err_exp:
tests/invalid/unsatisfiable_super.err_exp:
tests/invalid_nodepend/typeclass_test_1.err_exp:
tests/invalid_nodepend/typeclass_test_2.err_exp:
Expect updated diagnostics.
643 B
643 B
require_tailrec_3.m:038: In mode number 1 of function `even1'/1:
require_tailrec_3.m:038: warning: mutually recursive call to function
require_tailrec_3.m:038: `odd1'/1 is not tail recursive.
require_tailrec_3.m:053: In mode number 1 of function `even2'/1:
require_tailrec_3.m:053: error: mutually recursive call to function `odd2'/1
require_tailrec_3.m:053: is not tail recursive.
require_tailrec_3.m:068: In mode number 1 of function `even3'/1:
require_tailrec_3.m:068: warning: mutually recursive call to function
require_tailrec_3.m:068: `odd3'/1 is not tail recursive.
require_tailrec_3.m:038: warning: mutually recursive call to function
require_tailrec_3.m:038: `odd1'/1 is not tail recursive.
require_tailrec_3.m:053: In mode number 1 of function `even2'/1:
require_tailrec_3.m:053: error: mutually recursive call to function `odd2'/1
require_tailrec_3.m:053: is not tail recursive.
require_tailrec_3.m:068: In mode number 1 of function `even3'/1:
require_tailrec_3.m:068: warning: mutually recursive call to function
require_tailrec_3.m:068: `odd3'/1 is not tail recursive.