mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 11:54:02 +00:00
tests/general/float_test.exp3:
tests/general/float_test.m:
tests/general/read_dir_regression.exp4:
tests/general/read_dir_regression.m:
tests/hard_coded/remove_file.exp2:
tests/hard_coded/remove_file.m:
Delete Erlang backend specific expected outputs.
tests/hard_coded/Mmakefile:
tests/hard_coded/erlang_deconstruct.exp:
tests/hard_coded/erlang_deconstruct.m:
tests/hard_coded/existential_list.exp:
tests/hard_coded/existential_list.m:
tests/valid/Mmakefile:
tests/valid/erl_ite_vars.m:
tests/valid/zf_erlang_bug.m:
Delete erlang target specific tests.
tests/*:
Delete Erlang foreign procs and foreign types.
58 lines
1.3 KiB
Mathematica
58 lines
1.3 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% Test that constraint propagation maintains unique mode correctness.
|
|
% The calls to q/2 and test/1 in p/2 must not be reordered.
|
|
|
|
:- module constraint_order.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
main(!IO) :-
|
|
( if p(3, Y) then
|
|
io.write_string("succeeded: ", !IO),
|
|
io.write_int(Y, !IO),
|
|
io.nl(!IO)
|
|
else
|
|
io.write_string("failed\n", !IO)
|
|
).
|
|
|
|
:- pred p(int::di, int::out) is semidet.
|
|
|
|
p(X, Y) :-
|
|
q(X, Y),
|
|
test(X).
|
|
|
|
:- pred q(int::ui, int::out) is det.
|
|
:- pragma promise_pure(q/2).
|
|
:- pragma no_inline(q/2).
|
|
:- pragma terminates(q/2).
|
|
|
|
q(_, 1) :-
|
|
impure puts("call to q").
|
|
|
|
:- pred test(int::di) is semidet.
|
|
:- pragma promise_pure(test/1).
|
|
:- pragma no_inline(test/1).
|
|
:- pragma terminates(test/1).
|
|
|
|
test(3) :-
|
|
impure puts("call to test").
|
|
|
|
:- impure pred puts(string::in) is det.
|
|
|
|
:- pragma foreign_proc("C", puts(Str::in), [], "puts(Str);").
|
|
:- pragma foreign_proc("C#", puts(Str::in), [],
|
|
"System.Console.WriteLine(Str);").
|
|
:- pragma foreign_proc("Java", puts(Str::in), [],
|
|
"
|
|
System.out.println(Str);
|
|
").
|