Files
mercury/tests/valid/state_var_bug.m
Zoltan Somogyi c03b11ca48 Update the style of more test cases.
And updated expected outputs for changed line numbers.
2021-07-27 19:29:21 +10:00

28 lines
691 B
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% This is a regression test for a bug with the state variable transformation.
% It was not correctly handling the case where the condition of an if-then-else
% referred to a state variable, but the "then" part didn't.
% This lead to a determinism error in the following code.
:- module state_var_bug.
:- interface.
:- pred foo(int::in, int::out) is det.
:- implementation.
foo(!X) :-
( if copy(!X) then
true
else
true
),
(
fail
;
copy(!X)
).