mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 09:23:44 +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.
9 lines
731 B
Plaintext
9 lines
731 B
Plaintext
wrong_arity_function.m:034: In clause for predicate `main'/2:
|
||
wrong_arity_function.m:034: error: [38;5;203mwrong number of arguments[39;49m ([38;5;203m5[39;49m; should be [38;5;40m1[39;49m
|
||
wrong_arity_function.m:034: or [38;5;40m2[39;49m) in use of constructor [38;5;87m`f'.[39;49m
|
||
wrong_arity_function.m:034: If you are trying to construct a closure
|
||
wrong_arity_function.m:034: containing [38;5;87m`f',[39;49m you cannot do so with [38;5;203m5[39;49m
|
||
wrong_arity_function.m:034: arguments: the predicates with this name have
|
||
wrong_arity_function.m:034: arities [38;5;40m3[39;49m and [38;5;40m4[39;49m, and the only function with this
|
||
wrong_arity_function.m:034: name has arity [38;5;40m2[39;49m.
|