Files
mercury/tests/warnings/det_infer_warning.m
Zoltan Somogyi 83dc913329 Update the style of the warnings test cases.
tests/warnings/*.m:
    Bring the programming style of these modules up to date,
    except where the problem being tested for seems to be related
    to the old programming style

    In the infinite_recursion test case, add code that we *should*
    warn about, but currently don't.

tests/warnings/*.m:
    Update the expected outputs to account for the changes in line
    numbers, and the fact that the compiler computes the contexts
    of (if C then T else E) if-then-elses differently from (C -> T; E)
    if-then-else (it takes the context of the "then" vs the context
    of the ";").

    Delete arg_order_rearrangment.exp2. It was long unused, but
    deleting it in CVS would not have allowed us to put it back later.
2019-04-20 09:37:37 +10:00

47 lines
975 B
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% Tests that abstractly_unify_bound_inst_list handles the case of
% different length bound_inst lists where all the cons_ids are the same
% correctly.
% Should give a warning that determinism of test2 is inferred det, and
% not give a warning at all for test.
%
%---------------------------------------------------------------------------%
:- module det_infer_warning.
:- interface.
:- type two
---> true
; false.
:- pred test is semidet.
:- pred test2 is semidet.
:- implementation.
test :-
( if cond(true) then
RA = true
else
RA = false
),
( if cond(false) then
RB = true
else
RB = false
),
RA = RB.
test2 :-
RA = true,
RB = true,
RA = RB.
:- pred cond(two::in) is semidet.
cond(true).