mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-24 13:53:54 +00:00
compiler/polymorphism.m:
When building the type-infos to be packaged inside a typeclass-info,
apply the variable type bindings first.
tests/valid/instance_unconstrained_tvar.m:
Test case for this.
tests/valid/Mmakefile:
Turn this test on. Also turn another test on which I mistakenly
turned off in my previous commit (because the test was failing).
26 lines
530 B
Mathematica
26 lines
530 B
Mathematica
:- module instance_unconstrained_tvar.
|
|
|
|
:- interface.
|
|
|
|
:- import_module list.
|
|
|
|
:- typeclass c1(T) where [ ].
|
|
:- typeclass c2(T) <= c1(T) where [ ].
|
|
|
|
:- instance c1(list(T)) where [ ].
|
|
:- instance c2(list(T)) where [ ].
|
|
|
|
:- pred p is det.
|
|
|
|
:- implementation.
|
|
|
|
% The bug that this test case is checking for is at the creation of
|
|
% the typeclass info for this call, when creating the type-info the
|
|
% the int (1), the type bindings were not being applied properly.
|
|
p :- q([1]).
|
|
|
|
:- pred q(T) <= c2(T).
|
|
:- mode q(in) is det.
|
|
|
|
q(_).
|