%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% The code generated by the compiler of 11/6/2000 for this test case gets a
% segmentation fault at runtime because the compiler doesn't remove duplicates
% in the list of unconstrained type variables for which it adds type-infos to a
% typeclass-info. The predicate generated to call write_list_pair for the
% instance `p(list(T), list(T))' expects one type-info for `T' but was given
% two.

:- module instance_unconstrained_tvar_dup.
:- interface.

:- import_module io.

:- pred main(io::di, io::uo) is det.

:- typeclass p(T, U) where [
    pred m(T, U, io, io),
    mode m(in, in, di, uo) is det
].

:- implementation.

:- import_module list.

:- instance p(list(T), list(T)) where [
    pred(m/4) is write_list_pair
].

main(!IO) :-
    m([1, 2, 3], [4, 5, 6], !IO),
    io.nl(!IO).

:- pred write_list_pair(list(T)::in, list(U)::in, io::di, io::uo) is det.

write_list_pair(T, U, !IO) :-
    io.write_line(T, !IO),
    io.write_line(U, !IO).
