mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-24 05:43:53 +00:00
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.
25 lines
633 B
Mathematica
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)
|
|
).
|