Files
mercury/tests/hard_coded/any_free_unify.exp
David Overton 421a4e6558 Allow more precise (i.e. less conservative) mode checking in the case that an
Estimated hours taken: 7
Branches: main

Allow more precise (i.e. less conservative) mode checking in the case that an
`any' inst occurs in a negated context.  Normally we must disallow this
because we do not know whether the inst has become more instantiated over the
negated goal.  However, if the inst has simply been unified with `free' then
we know that it cannot have become more instantiated.  This change checks
for, and allows, that case.

This situation occurs quite frequently in code generated by the HAL compiler.

compiler/inst_match.m:
	Add a new inst comparison predicate
	`inst_is_at_least_as_instantiated' which is the same as
	`inst_matches_initial' except that it reverses the uniqueness
	comparison.
	Add a new variant of `inst_matches_binding' which allows `any' to match
	`any'.

compiler/modecheck_unify.m:
	When mode checking a unification, in the call to
	`modecheck_set_var_inst' pass the initial inst of the other side of
	the unification.

compiler/modes.m:
	Modify `modecheck_set_var_inst' so that in the case that the inst to
	be set is the final inst in a unification goal and the initial inst
	of the other side of the unification is available then it can make
	use of that information to improve the precision of the analysis.

tests/hard_coded/Mmakefile:
tests/hard_coded/any_free_unify.exp:
tests/hard_coded/any_free_unify.m:
tests/invalid/Mmakefile:
tests/invalid/bind_in_negated.m:
tests/invalid/bind_in_negated.err_exp:
	Add some test cases.
2003-06-02 04:56:31 +00:00

2 lines
4 B
Plaintext