mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
compiler/add_clause.m:
When a mode-specific clause is missing a ::mode annotation from some
arguments, print the identities of those arguments.
compiler/add_pred.m:
Improve the wording of a diagnostic.
tests/invalid/mode_decl_in_wrong_section.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/multimode_dcg.m:
tests/invalid/multimode_syntax.err_exp:
Expect updated diagnostics.
53 lines
1.2 KiB
Mathematica
53 lines
1.2 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module multimode_dcg.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
main(!IO) :-
|
|
In = 42,
|
|
test0(!IO),
|
|
test1(In, !IO),
|
|
test1(_Out0, !IO),
|
|
test2(In, In, !IO),
|
|
test2(In, _Out1, !IO),
|
|
test2(_Out2, In, !IO),
|
|
test2(_Out3, _Out4, !IO).
|
|
|
|
:- pred test0(io, io).
|
|
:- mode test0(di, uo) is det.
|
|
test0 -->
|
|
puts("test0").
|
|
|
|
:- pred test1(int, io, io).
|
|
:- mode test1(in, di, uo) is det.
|
|
:- mode test1(out, di, uo) is det.
|
|
test1(_::in) -->
|
|
puts("test1(in)").
|
|
test1(0::out, In::in, Out) :-
|
|
puts("test1(out)", In, Out).
|
|
|
|
:- pred test2(int, int, io, io).
|
|
:- mode test2(in, in, di, uo) is det.
|
|
:- mode test2(in, out, di, uo) is det.
|
|
:- mode test2(out, in, di, uo) is det.
|
|
:- mode test2(out, out, di, uo) is det.
|
|
test2(_::in, _::in) -->
|
|
puts("test2(in, in)").
|
|
test2(_::in, 0::out) -->
|
|
puts("test2(in, out)").
|
|
test2(0::out, _::in) -->
|
|
puts("test2(out, in)").
|
|
test2(0::out, 0::out) -->
|
|
puts("test2(out, out)").
|
|
|
|
:- pred puts(string::in, io::di, io::uo) is det.
|
|
puts(S) -->
|
|
io.write_string(S), nl.
|