mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 19:03:45 +00:00
tests/invalid/*.{m,err_exp}:
tests/misc_tests/*.m:
tests/mmc_make/*.m:
tests/par_conj/*.m:
tests/purity/*.m:
tests/stm/*.m:
tests/string_format/*.m:
tests/structure_reuse/*.m:
tests/submodules/*.m:
tests/tabling/*.m:
tests/term/*.m:
tests/trailing/*.m:
tests/typeclasses/*.m:
tests/valid/*.m:
tests/warnings/*.{m,exp}:
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 tests
that check compiler error messages, expect the new line numbers.
browser/cterm.m:
browser/tree234_cc.m:
Import only one module per line.
tests/hard_coded/boyer.m:
Fix something I missed.
85 lines
1.8 KiB
Mathematica
85 lines
1.8 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module constrained_poly_insts2.
|
|
:- interface.
|
|
|
|
:- pred test1 is det.
|
|
:- pred test2 is det.
|
|
:- pred test3 is det.
|
|
:- pred test4 is det.
|
|
|
|
:- pred test5 is det.
|
|
:- pred test6 is det.
|
|
:- pred test7 is det.
|
|
:- pred test8 is det.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- type fruit ---> apple ; orange.
|
|
:- inst apple ---> apple.
|
|
:- inst orange ---> orange.
|
|
|
|
:- pred apple1(fruit).
|
|
:- mode apple1(in(apple)) is det.
|
|
|
|
apple1(_).
|
|
|
|
:- pred apple2(fruit).
|
|
:- mode apple2(in(I =< apple)) is det.
|
|
|
|
apple2(_).
|
|
|
|
test1 :- p(apple1, apple).
|
|
test2 :- p(apple1, orange).
|
|
test3 :- p(apple2, apple).
|
|
test4 :- p(apple2, orange).
|
|
|
|
test5 :- q(apple1, apple).
|
|
test6 :- q(apple1, orange). % error
|
|
test7 :- q(apple2, apple).
|
|
test8 :- q(apple2, orange). % error
|
|
|
|
:- pred p(pred(T), T).
|
|
:- mode p(pred(in(I =< ground)) is det, in) is det.
|
|
|
|
p(P, X) :- P(X). % error
|
|
|
|
:- pred p2(pred(T), T).
|
|
:- mode p2(pred(in(I =< ground)) is det, in(J =< apple)) is det.
|
|
|
|
p2(P, X) :- P(X). % error
|
|
|
|
:- pred p3(pred(T), T).
|
|
:- mode p3(pred(in(I =< apple)) is det, in(orange)) is det.
|
|
|
|
p3(P, X) :- P(X). % error
|
|
|
|
:- pred p4(pred(T), T).
|
|
:- mode p4(pred(in(I =< apple)) is det, in(J =< apple)) is det.
|
|
|
|
p4(P, X) :- P(X). % error
|
|
|
|
:- pred p5(pred(T), T).
|
|
:- mode p5(pred(in(I =< apple)) is det, in(apple)) is det.
|
|
|
|
p5(P, X) :- P(X). % error
|
|
|
|
:- pred q(pred(T), T).
|
|
:- mode q(pred(in(I =< ground)) is det, in(I =< ground)) is det.
|
|
|
|
q(P, X) :- P(X).
|
|
|
|
:- pred q2(pred(T), T).
|
|
:- mode q2(pred(in(I =< apple)) is det, in(I =< apple)) is det.
|
|
|
|
q2(P, X) :- P(X).
|
|
|
|
:- pred q3(pred(T), T).
|
|
:- mode q3(pred(in(apple)) is det, in(I =< apple)) is det.
|
|
|
|
q3(P, X) :- P(X).
|