Files
mercury/tests/warnings/warn_contiguous_foreign.m
Peter Wang 88047bbb45 Delete Erlang from tests.
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.
2020-10-27 11:10:11 +11:00

63 lines
1.4 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% This is a test of the compiler's ability to properly AVOID reporting
% non-contiguous clauses for a predicate when the totality of all clauses
% and foreign_procs of a predicate are contiguous, but the applicable ones
% are not contiguous.
%
%---------------------------------------------------------------------------%
:- module warn_contiguous_foreign.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module list.
:- import_module string.
main(!IO) :-
test(1, !IO),
test(3, !IO),
test(5, !IO),
test(7, !IO),
test(9, !IO),
test(11, !IO),
test(13, !IO).
:- pred test(int::in, io::di, io::uo) is det.
test(N, !IO) :-
p(N, M),
io.format("p(%d) = %d\n", [i(N), i(M)], !IO).
:- pred p(int::in, int::out) is det.
p(N, M) :-
M = N + 1.
:- pragma foreign_proc("Java",
p(N::in, M::out),
[will_not_call_mercury, promise_pure, thread_safe],
"
M = N + 1;
").
:- pragma foreign_proc("C#",
p(N::in, M::out),
[will_not_call_mercury, promise_pure, thread_safe],
"
M = N + 1;
").
:- pragma foreign_proc("C",
p(N::in, M::out),
[will_not_call_mercury, promise_pure, thread_safe],
"
M = N + 1;
").