Files
mercury/tests/valid/record_syntax_bug_2.m
Simon Taylor 957c54c0b2 My previous bug fix for overloading resolution of field access functions
Estimated hours taken: 1

My previous bug fix for overloading resolution of field access functions
and constructors didn't work for existentially typed constructors.

compiler/post_typecheck.m:
	When checking whether a constructor matches a cons_id
	and argument types, make sure the actual argument types
	don't bind any of the existentially quantified type
	variables of the constructor.

compiler/typecheck.m:
compiler/type_util.m:
	Factor out the code to check whether the argument types
	of a call subsume the actual argument types into
	a new predicate, `type_util__arg_type_list_subsumes'.

tests/valid/Mmakefile:
tests/valid/record_syntax_bug_2.m:
	Test case.
2000-05-09 02:44:42 +00:00

24 lines
526 B
Mathematica

% The compiler of 8/5/2000 aborted on this test case because it
% didn't properly handle overloading of field access functions
% and constructors.
:- module record_syntax_bug_2.
:- interface.
:- type foo ---> some [T] debug(T) where equality is all_equal.
:- type bar ---> bar( debug :: foo ).
:- pred baz(foo, bar).
:- mode baz(in, out) is cc_multi.
:- pred all_equal(foo, foo).
:- mode all_equal(in, in) is semidet.
:- implementation.
:- import_module std_util.
all_equal(_, _) :- semidet_succeed.
baz(debug(X), X).