Files
mercury/tests/invalid/io_in_ite_cond.m
Zoltan Somogyi 326049af00 Help coders with unique/mostly_unique mismatches.
compiler/mode_errors.m:
    When a mode mismatch is between an expected unique inst and an
    actual mostly_unique inst, mention the usual source of such mismatches.

tests/invalid/ho_unique_error.err_exp:
tests/invalid/io_in_ite_cond.err_exp:
tests/invalid/mostly_uniq1.err_exp:
tests/invalid/mostly_uniq2.err_exp:
tests/invalid/uniq_modes.err_exp:
tests/invalid/uniq_neg.err_exp:
    Update these files to expect the extra text in the error message.

tests/invalid/io_in_ite_cond.m:
    Improve programming style.
2021-05-17 13:31:56 +10:00

25 lines
633 B
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
:- module io_in_ite_cond.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- pred foo(io::di, io::uo) is semidet.
:- pragma external_pred(foo/2).
% This should be a unique mode error, since if foo does I/O before failing,
% we won't be able to undo it before printing "No".
main(!IO) :-
( if foo(!IO) then
io.write_string("Yes", !IO)
else
io.write_string("No", !IO)
).