Files
mercury/tests/invalid/det_errors.m
Zoltan Somogyi fdd141bf77 Clean up the tests in the other test directories.
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.
2015-02-16 12:32:18 +11:00

145 lines
2.2 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
:- module det_errors.
:- interface.
:- pred p1(int::in) is det.
:- pred p2(int::in) is det.
:- pred p3(int::in) is det.
:- pred p4(int::in) is det.
:- pred p5(int::in) is det.
:- type t
---> a
; b
; c
; d
; e
; f
; g
; h(int)
; i(int).
:- pred q(t::in, int::out) is det.
:- type u
---> u1
; u2
; u3(t)
; u4(t).
:- pred r(u::in, int::out) is det.
:- pred s(u::in, int::out) is det.
:- pred t(int::out) is det.
:- implementation.
:- import_module int.
:- import_module require.
p1(42).
p2(X) :- X = 42.
p3(X) :- X = 42.
p4(X) :- X = 21 + 21.
p5(_) :- true.
q(a, 1).
q(b, 2).
q(c, 3).
r(U, X) :-
(
U = u1,
X = 11
;
U = u3(a),
X = 31
;
U = u3(b),
X = 32
;
U = u3(c),
X = 33
;
U = u4(a),
X = 41
;
U = u4(b),
X = 42
;
U = u4(c),
X = 43
;
U = u4(d),
X = 441
;
U = u4(d),
X = 442
;
U = u4(e),
X = 45
;
U = u4(f),
X = 46
;
U = u4(g),
X = 47
).
s(U, X) :-
(
U = u1,
X = 11
;
U = u3(a),
X = 31
;
U = u3(b),
X = 32
;
U = u3(c),
X = 33
;
U = u4(V),
(
V = a,
X = 41
;
V = b,
X = 42
;
V = c,
X = 43
;
V = d,
X = 441
;
V = d,
X = 442
;
( V = e
; V = f
),
( X = 461
; X = 462
)
;
V = g,
X = 47
;
( V = h(_)
; V = i(_)
),
( X = 481
; X = 482
)
)
).
:- pragma no_determinism_warning(t/1).
t(_) :-
error("t called").