Files
mercury/tests/hard_coded/trans_intermod_user_equality2.m
David Overton 127fe0f85f Fixes to allow testing of ground' matches bound'.
Estimated hours taken: 10
Branches: main

Fixes to allow testing of `ground' matches `bound'.

compiler/modules.m:
	When writing discriminated union types to the .int2 file, write
	out the full type definition rather than an abstract type
	declaration.  This is necessary because a module which
	transitively imports the .int2 file may need to know the
	constructors to allow `ground' to be compared with `bound'
	insts.  See the new test case `transitive_inst_type' for an
	example.  If the type has user-defined equality and/or comparison
	predicates then we write "... where type_is_abstract_noncanonical"
	to the .int2 file instead of giving the predicate names.

compiler/make_hlds.m:
	If a discriminated union type is imported from a .int2 file, mark it
	as `abstract_imported'.

compiler/typecheck.m:
	When type checking var-functor unifications, do not allow functors
	whose types are `abstract_imported', unless we are type checking an
	`opt_imported' predicate.

compiler/prog_data.m:
	Add a new alternative `abstract_noncanonical_type' to the type
	`unify_compare' to represent "where type_is_abstract_noncanonical"
	annotations read from .int2 files.

compiler/prog_io.m:
	Parse "where type_is_abstract_noncanonical" annotations on
	discriminated union types.

compiler/special_pred.m:
compiler/unify_proc.m:
	Avoid creating unification and comparison predicates
	for types with `type_is_abstract_noncanonical' annotations.

compiler/intermod.m:
	Handle the change to the `unify_compare' type.

compiler/type_util.m:
	Do not remove module qualifiers from constructors before looking
	them up in the cons table.  Some cons ids only have the
	qualified version in the table.

tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
tests/hard_coded/transitive_inst_type.exp:
tests/hard_coded/transitive_inst_type.m:
tests/hard_coded/transitive_inst_type2.m:
tests/hard_coded/transitive_inst_type3.m:
tests/hard_coded/trans_intermod_user_equality.exp:
tests/hard_coded/trans_intermod_user_equality.m:
tests/hard_coded/trans_intermod_user_equality2.m:
tests/hard_coded/trans_intermod_user_equality3.m:
	Add some test cases.
2003-07-22 07:04:26 +00:00

18 lines
329 B
Mathematica

:- module trans_intermod_user_equality2.
:- interface.
:- import_module trans_intermod_user_equality3.
:- type bar == foo.
:- pred make_bar(int::in, int::in, bar::out) is det.
:- pred use_bar(bar::in, int::out) is cc_multi.
:- implementation.
make_bar(M, N, ctor1(M, N)).
use_bar(ctor1(_, N), N).
use_bar(ctor2(_, N), N).