The compiler was not module qualifying the `where equality is ...'

Estimated hours taken: 4
Branches: main, release

The compiler was not module qualifying the `where equality is ...'
part of type declarations in interface files. This could cause the
compiler to use the wrong predicate in importing modules if the
user-defined equality predicate was not exported.

To avoid this problem we now require user-defined equality or
comparison predicates for a type to be defined in the same module
as the type. This is the only simple way to module qualify the
unification predicates in interface files without running
typechecking.

compiler/prog_io.m:
compiler/prog_io_pragma.m:
	Require user-defined equality or comparison predicates for a
	type to be defined in the same module as the type.

NEWS:
doc/reference_manual.texi:
	Document the change.

compiler/typecheck.m:
compiler/post_typecheck.m:
compiler/hlds_pred.m:
compiler/make_hlds.m:
compiler/*.m:
	Calls in the compiler generated unification predicates are
	now guaranteed to be fully qualified, so don't attempt
	to search for more qualified predicates.

	Add a new pred_marker 'calls_are_fully_qualifed' to
	identify predicates whose bodies contain only fully
	qualified calls, rather than testing the import_status.

tests/invalid/Mmakefile:
tests/invalid/exported_unify.m:
tests/invalid/exported_unify2.m:
tests/invalid/exported_unify2.err_exp:
tests/invalid/exported_unify3.m:
tests/invalid/exported_unify3.err_exp:
	Test cases.
This commit is contained in:
Simon Taylor
2003-05-19 14:24:36 +00:00
parent 0ee12a3296
commit b9f9de8ed2
17 changed files with 171 additions and 50 deletions

View File

@@ -37,7 +37,7 @@ parse_pragma(ModuleName, VarSet, PragmaTerms, Result) :-
(
% new syntax: `:- pragma foo(...).'
PragmaTerms = [SinglePragmaTerm0],
get_maybe_equality_compare_preds(SinglePragmaTerm0,
get_maybe_equality_compare_preds(ModuleName, SinglePragmaTerm0,
SinglePragmaTerm, UnifyCompareResult),
SinglePragmaTerm = term__functor(term__atom(PragmaType),
PragmaArgs, _),