Files
mercury/tests/invalid/det_errors_cc.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

104 lines
1.5 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
:- module det_errors_cc.
:- interface.
:- pred p(int::in, int::out) is cc_nondet.
:- implementation.
:- import_module int.
:- type t
---> fa
; fb
; fc
; fd.
p(A, X) :-
p1(A, B),
p2(B, C),
p3(C, D),
p4(D, E),
p5(E, F),
p6(F, X).
:- pred p1(int::in, int::out) is cc_nondet.
p1(A, X) :-
p3(A, B),
p4(B, C),
C = 10,
B = C,
X = C.
:- pred p2(int::in, int::out) is cc_nondet.
p2(A, X) :-
p3(A, B),
( B < 5 ->
fail
;
X = B
).
:- pred p3(int::in, int::out) is cc_nondet.
p3(A, X) :-
p2(A, X),
not (X = 10).
:- pred p4(int::in, int::out) is cc_nondet.
p4(A, X) :-
p3(A, B),
P = r(B),
P(A, X).
:- pred p5(int::in, int::out) is cc_nondet.
p5(A, X) :-
p1(A, B),
( B < 5 ->
C = fa
; B < 10 ->
C = fb
;
C = fc
),
(
C = fa,
X = 5
;
C = fb,
X = 6
).
:- pred p6(int::in, int::out) is cc_nondet.
p6(A, X) :-
p1(A, B),
( B < 5 ->
C = fa
;
C = fb
),
(
C = fa,
X = 5
;
C = fb,
X = 6
).
:- pred q(int::in, int::out) is multi.
q(N, N).
q(N, N + 1).
:- pred r(int::in, int::in, int::out) is semidet.
r(N, N, N).