mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
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.
43 lines
695 B
Mathematica
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).
|