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

@@ -193,7 +193,7 @@ parse_goal_2("<=>", [A0, B0], V0, equivalent(A, B), V):-
parse_goal(B0, V1, B, V).
parse_goal_2("some", [Vars0, A0], V0, some(Vars, A), V):-
term__vars(Vars0, Vars),
parse_list_of_vars(Vars0, Vars),
parse_goal(A0, V0, A, V).
% The following is a temporary hack to handle `is' in
@@ -227,9 +227,10 @@ parse_goal_with_purity(A0, V0, Purity, A, V) :-
parse_some_vars_goal(A0, VarSet0, Vars, A, VarSet) :-
(
A0 = term__functor(term__atom("some"), [Vars0, A1], _Context)
A0 = term__functor(term__atom("some"), [Vars0, A1], _Context),
parse_list_of_vars(Vars0, Vars1)
->
term__vars(Vars0, Vars),
Vars = Vars1,
parse_goal(A1, VarSet0, A, VarSet)
;
Vars = [],