Files
mercury/tests/hard_coded/ho_func_default_inst.exp
David Overton 4f79ef0b59 Implement a change to the mode system suggested by Ralph Becket to make use of
Estimated hours taken: 12
Branches: main

Implement a change to the mode system suggested by Ralph Becket to make use of
higher order functions a bit easier.

During mode checking of higher order calls, if the variable being called has a
higher-order function type, but only a ground inst with no higher-order
information, assume that it has the default function modes.

Also, when doing anything that might cause a variable's inst to lose higher
order mode information, report a mode error if the variable has a non-standard
higher order function mode.  Situations where this may occur are at call sites,
exit sites and when merging insts at the end of a branched goal.

Note that because of this restriction, this change is not backwards compatible.

compiler/inst_util.m:
	Define some predicates to check for and produce pred_inst_infos for
	default function modes.
	In 'inst_merge', ensure that higher order inst information is not lost
	from non-standard function insts.

compiler/inst_match.m:
	In 'inst_matches_initial' and 'inst_matches_final', ensure that higher
	order inst information is not lost from non-standard function insts.
	Also allow 'inst_matches_{initial,final,binding}' to succeed
	where the first inst is a standard function inst and the
	second is ground.

compiler/modecheck_call.m:
	In 'modecheck_higher_order_call', if the variable to be called has no
	pred_inst_info, but the correct higher-order function type, assume it
	has the default function modes.

mode_util.m:
pd_util.m:
	Before replacing a ground inst with 'ground(Uniq, none)', ensure that it
	does not contain any nonstandard function insts.

tests/hard_coded/Mmakefile:
tests/hard_coded/ho_func_default_inst.m:
tests/hard_coded/ho_func_default_inst.exp:
tests/invalid/Mmakefile:
tests/invalid/ho_default_func_1.m:
tests/invalid/ho_default_func_1.err_exp:
tests/invalid/ho_default_func_2.m:
tests/invalid/ho_default_func_2.err_exp:
tests/invalid/ho_default_func_3.m:
tests/invalid/ho_default_func_3.err_exp:
	Add some test cases.

tests/invalid/Mmakefile:
tests/invalid/ho_default_func_4.m:
tests/invalid/ho_default_func_4.err_exp:
tests/invalid/inst_matches_final_bug.m:
tests/invalid/inst_matches_final_bug.err_exp:
	Add some test cases which we do not yet pass due to a bug in
	inst_matches_final.

NEWS:
doc/reference_manual.tex:
	Document the change.
2001-10-12 05:23:51 +00:00

3 lines
4 B
Plaintext