mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-12 12:26:29 +00:00
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.
24 lines
526 B
Mathematica
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).
|
|
|