mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 20:03:44 +00:00
Estimated hours taken: 1
tests/valid/intermod_user_equality2.m:
tests/valid/intermod_user_equality_nested2.m:
Fix a bug in these test cases that caused a compile error
("unification for non-canonical type is not guaranteed to succeed")
when building things in MLDS grades. For the LLDS back-end,
these modules weren't being compiled, only the modules that
import them were being compiled; but for the MLDS back-end,
compiling the latter to `.o' requires generating the header
files for the former, and generating the header files requires
compilation.
40 lines
651 B
Mathematica
40 lines
651 B
Mathematica
:- module intermod_user_equality_nested2.
|
|
|
|
:- interface.
|
|
|
|
:- type foo.
|
|
|
|
:- typeclass class(T) where [
|
|
pred p(T::in, T::in) is semidet
|
|
].
|
|
|
|
:- instance class(foo).
|
|
|
|
:- pred foo_field1(foo::in, int::out) is cc_nondet.
|
|
|
|
:- module intermod_user_equality_nested2__sub.
|
|
|
|
:- interface.
|
|
|
|
:- type bar
|
|
---> bar(foo).
|
|
|
|
:- end_module intermod_user_equality_nested2__sub.
|
|
|
|
:- implementation.
|
|
|
|
:- type foo
|
|
---> ctor1(int, int)
|
|
; ctor2(int, int)
|
|
where equality is foo_unify.
|
|
|
|
:- instance class(foo) where [
|
|
pred(p/2) is foo_unify
|
|
].
|
|
|
|
:- pred foo_unify(foo::in, foo::in) is semidet.
|
|
foo_unify(X, X).
|
|
|
|
foo_field1(ctor1(X, _), X).
|
|
foo_field1(ctor2(X, _), X).
|