Files
mercury/tests/hard_coded/user_defined_equality2.m
Zoltan Somogyi 33eb3028f5 Clean up the tests in half the test directories.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the debugger tests,
    specify the new line numbers in .inp files and expect them in .exp files.
2015-02-14 20:14:03 +11:00

40 lines
949 B
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% This is a regression test.
%
% The Mercury compiler of 27/10/2000 failed this test
% due to overeager specialization of unifications
% involving no-tag types with user-defined equality.
:- module user_defined_equality2.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is cc_multi.
:- implementation.
:- import_module std_util.
:- type foo ---> foo(int)
where equality is foo_equal.
:- pred foo_equal(foo::in, foo::in) is semidet.
foo_equal(_, _) :-
semidet_succeed.
main -->
( { unify_no_tag(foo(1), foo(2)) } ->
io__write_string("yes\n")
;
io__write_string("no\n")
).
:- pred unify_no_tag(T::in, T::in) is semidet.
:- pragma type_spec(unify_no_tag/2, T = foo).
unify_no_tag(T, T).