mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 01:13:30 +00:00
compiler/typecheck_error_undef.m:
When reporting an undefined name/arity pair, if the name happens
to be name of some functions and/or predicates which all have
different arities, add a sentence to the diagnostic to report this fact.
(Normally this happens only when the erroneous code provides
*too many* arguments, because if it does not, then the typechecker
would know that the code can be read as constructing a closure, and
would instead report errors for the arguments that have the wrong type.)
Don't color a closing parenthesis whose open parenthesis
is not colored.
Fix an old bug that we have no test case for: add the missing
initial part of the diagnostic for bugs that report undefined
*non*-user-defined function symbols. There shouldn't be any such
errors, but the types permit it ...
tests/invalid/wrong_arity_function.{m,err_exp}:
Extend this test case to test diagnostic extension described above.
tests/invalid/coerce_syntax.err_exp:
Expect the color change.
731 B
731 B
wrong_arity_function.m:034: In clause for predicate `main'/2:
wrong_arity_function.m:034: error: wrong number of arguments (5; should be 1
wrong_arity_function.m:034: or 2) in use of constructor `f'.
wrong_arity_function.m:034: If you are trying to construct a closure
wrong_arity_function.m:034: containing `f', you cannot do so with 5
wrong_arity_function.m:034: arguments: the predicates with this name have
wrong_arity_function.m:034: arities 3 and 4, and the only function with this
wrong_arity_function.m:034: name has arity 2.
wrong_arity_function.m:034: error: wrong number of arguments (5; should be 1
wrong_arity_function.m:034: or 2) in use of constructor `f'.
wrong_arity_function.m:034: If you are trying to construct a closure
wrong_arity_function.m:034: containing `f', you cannot do so with 5
wrong_arity_function.m:034: arguments: the predicates with this name have
wrong_arity_function.m:034: arities 3 and 4, and the only function with this
wrong_arity_function.m:034: name has arity 2.