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:
Fergus Henderson
1998-10-29 14:59:13 +00:00
parent 4240cbc000
commit 270c12e80e
7 changed files with 56 additions and 14 deletions

View File

@@ -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.