mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-16 14:25:56 +00:00
Report an error if the first argument of a `some' goal
Estimated hours taken: 0.75 Report an error if the first argument of a `some' goal is not a list of variables. compiler/prog_io.m: compiler/prog_io_util.m: Move `parse_list_of_vars' from prog_io.m to prog_io_util.m. compiler/prog_io_goal.m: Check to make sure that the first argument to a some goal is a list of variables. (If not, we don't report an error here -- the error will be reported by typecheck.m.) compiler/typecheck.m: Report an proper error message if there is a call to an undefined predicate `some/2'. Also add `some/2' and `all/2' to the list of language builtins for which we report a special error message if they occur as undefined function symbols. tests/invalid/Mmakefile: tests/invalid/some.m: tests/invalid/some.err_exp: Regression test for the above change.
This commit is contained in:
@@ -1044,14 +1044,6 @@ parse_decl_attribute("all", [TVars, Decl],
|
||||
quantifier(univ, TVarsList), Decl) :-
|
||||
parse_list_of_vars(TVars, TVarsList).
|
||||
|
||||
:- pred parse_list_of_vars(term, list(var)).
|
||||
:- mode parse_list_of_vars(in, out) is semidet.
|
||||
|
||||
parse_list_of_vars(term__functor(term__atom("[]"), [], _), []).
|
||||
parse_list_of_vars(term__functor(term__atom("."), [Head, Tail], _), [V|Vs]) :-
|
||||
Head = term__variable(V),
|
||||
parse_list_of_vars(Tail, Vs).
|
||||
|
||||
:- pred check_no_attributes(maybe1(item), decl_attrs, maybe1(item)).
|
||||
:- mode check_no_attributes(in, in, out) is det.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user