Files
mercury/tests/declarative_debugger/failed_cond.m
Zoltan Somogyi ecb5e4a9e6 Update the style of many test cases.
tests/declarative_debugger/*.m:
tests/exceptions/*.m:
tests/general/*.m:
tests/grade_subdirs/*.m:
tests/purity/*.m:
tests/submodules/*.m:
tests/typeclasses/*.m:
    Update programming style.

tests/declarative_debugger/*.inp:
    Update line numbers in breakpoint commands.
tests/declarative_debugger/*.exp:
    Update expected line numbers.

tests/exceptions/Mercury.options:
tests/general/Mercury.options:
    Disable some warnings that are irrelevant to the test.
2021-07-25 23:26:17 +10:00

43 lines
695 B
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% Test tracking the origin of a sub-term from a failed if-then-else condition.
:- module failed_cond.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
main(!IO) :-
p(X),
write(X, !IO),
nl(!IO).
:- type t
---> a
; b
; c.
:- pred p(t::out) is det.
p(Y) :- X = c, q(X, Y).
:- pred q(t::in, t::out) is det.
q(X, Y) :-
( if r(X) then
Y = a
else
Y = b
).
:- pred r(t::in) is semidet.
r(a).