Files
mercury/tests/valid/instance_superclass.m
David Jeffery e4fba268ec Fix test case... the compiler was getting tripped up by a different bug than
Estimated hours taken: 1/4

Fix test case... the compiler was getting tripped up by a different bug than
the one this was meant to be testing.

ts/valid/instance_superclass.m:
	Fixed so it doesn't have an unbound type variable.
	(Actually, I don't really see why the compiler thinks it is unbound).
1998-06-18 04:11:45 +00:00

31 lines
728 B
Mathematica

:- module instance_superclass.
% This is a regression test for the case where there is a superclass
% relationship, and the instance declaration has a type variable in the
% instance type.
:- 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(T::in) is det.
:- implementation.
% The bug that this test case is checking for is at the creation of
% the typeclass info for this call: if the substitution from "T" in
% the typeclass decl to "list(T)" in the instance is applied
% recursively, an infinite loop results.
p(X) :- q([X]).
:- pred q(T) <= c2(T).
:- mode q(in) is det.
q(_).