Files
mercury/tests/invalid/bind_var_errors.err_exp
Andrew Bromage 046f2afecb Fix a semantic hole. Previously, unique variables could be used
Estimated hours taken: 6

Fix a semantic hole.  Previously, unique variables could be used
as non-local variables inside a lambda goal and shared within that
lambda.  This fixes the problem by requiring that all non-local
vars to a lambda must be ground-shared.

compiler/modecheck_unify.m:
	Changes detailed above.

compiler/mode_errors.m:
	Add a new kind of mode error, mode_error_non_local_lambda_var.
	One small change to find_important_errors/3 to ensure that this
	error will be reported if the lambda is an implicit call argument
	unification.

compiler/inst_util.m:
	Export make_shared_inst_list/4 for use by modecheck_unify.m.

compiler/instmap.m:
	New predicate: instmap__set_vars/4, which sets multiple vars
	in an instmap.

tests/invalid/bind_var_errors.m:
tests/invalid/bind_var_errors.err_exp:
	Regression test.
1998-02-13 10:12:35 +00:00

24 lines
1.6 KiB
Plaintext

bind_var_errors.m:033: In clause for `bind_var_in_negation':
bind_var_errors.m:033: scope error: attempt to bind a variable inside a negation.
bind_var_errors.m:033: Variable `X' has instantiatedness `free',
bind_var_errors.m:033: expected instantiatedness was `unique(42)'.
bind_var_errors.m:039: In clause for `bind_var_in_ite_cond(in)':
bind_var_errors.m:039: scope error: attempt to bind a non-local variable
bind_var_errors.m:039: inside the condition of an if-then-else.
bind_var_errors.m:039: Variable `Y' has instantiatedness `free',
bind_var_errors.m:039: expected instantiatedness was `unique(42)'.
bind_var_errors.m:048: In clause for `bind_var_in_lambda':
bind_var_errors.m:048: in argument 1 of call to predicate `call/1':
bind_var_errors.m:048: mode error: variable `Y' has instantiatedness `free',
bind_var_errors.m:048: expected instantiatedness for non-local variables
bind_var_errors.m:048: of lambda goals is `ground'.
bind_var_errors.m:053: In clause for `share_var_in_lambda(di)':
bind_var_errors.m:053: in argument 1 of call to predicate `bind_var_errors:destroy/1':
bind_var_errors.m:053: mode error: variable `X' has instantiatedness `ground',
bind_var_errors.m:053: expected instantiatedness was `unique'.
bind_var_errors.m:060: In clause for `clobber_var_in_lambda(di)':
bind_var_errors.m:060: in argument 1 of call to predicate `bind_var_errors:destroy/1':
bind_var_errors.m:060: unique-mode error: the called procedure would clobber
bind_var_errors.m:060: its argument, but variable `X' is still live.
For more information, try recompiling with `-E'.