[m-rev.] for review: better error messages for lambda exprs
zoltan.somogyi at runbox.com
Fri May 6 15:53:42 AEST 2016
On Fri, 6 May 2016 09:48:51 +1000 (AEST), Julien Fischer <jfischer at opturion.com> wrote:
> > tests/invalid/invalid_int.err_exp:
> > Expect the updated text of the error message for a too-big
> > integer constant.
> The alternative expected output, tests/invalid/invalid_int.err_exp2, will also
> require updating.
Thanks for catching that. I have now updated both, though I could do
the expected output for 32 bit machines only by hand, so it may not be
bit exact. Anyone who has a 32 bit machine should watch out for that.
I fixed the contexts of the error messages as well.
> > + functions and predicates. Since the terms usually did not any declared type
> did not belong to any declared type
Done. I tried to make that sentence even clearer; you may want to
have a look after the commit.
> > + % XXX Should we advertise any_pred/any_func?
> Yes, they're a publicly documented part of the language.
> > + Pieces = [words("Error: the clause head part of a lambda expression"),
> > + words("should have one of the following forms:"),
> > + quote("pred(<args>) is <determinism>"), nl,
> > + quote("any_pred(<args>) is <determinism>"), nl,
> > + quote("func(<args>) = <retarg> is <determinism>"), nl,
> > + quote("any_func(<args>) = <retarg> is <determinism>"), nl,
> > + quote("func(<args>) = <retarg>"), nl,
> > + quote("any_func(<args>) = <retarg>"), suffix(","), nl,
> > + words("or one of those forms preceded by either"),
> > + quote("semipure"), words("or"), quote("impure"), suffix("."), nl],
> > + Msg = simple_msg(get_term_context(PFArgsDetTerm), [always(Pieces)]),
> > + Spec = error_spec(severity_error, phase_parse_tree_to_hlds, [Msg]),
> > + qual_info_set_found_syntax_error(yes, !QualInfo),
> > + MaybeLambdaHead = error1([Spec])
> > ).
What I meant was, should we handle the any_ prefix the way
the above handles the impurity markers, i.e. by showing just the three common
forms, (pred with detism, func with detism, func without detism), and then
saying the pred and func can be replaced by any_pred and any_func respectively.
I followed your other suggestions.
> The rest looks fine.
Thanks for the review.
More information about the reviews