mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-17 18:33:58 +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.
51 lines
1.3 KiB
Mathematica
51 lines
1.3 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% rotd-2006-09-18 and before would not compile the following because
|
|
% the fact that the inst varsets attached to the clauses and the mode
|
|
% declarations are different meant that it couldn't work out which mode
|
|
% belonged to which clause. The fix is to allow for a renaming between
|
|
% inst variables.
|
|
%
|
|
% A similar thing occurs with the inst varset attached to foreign_export
|
|
% pragmas.
|
|
%
|
|
:- module param_mode_bug.
|
|
:- interface.
|
|
|
|
:- type list(T)
|
|
---> []
|
|
; [T | list(T)].
|
|
|
|
:- pred foo(list(T), list(T)).
|
|
:- mode foo(in(I), out(I)) is det.
|
|
:- mode foo(out(I), in(I)) is det.
|
|
|
|
:- pred bar(list(T)::in(I), list(T)::out(I)) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- pragma promise_equivalent_clauses(foo/2).
|
|
|
|
foo(X::in(I), X::out(I)).
|
|
foo(Y::out(I), X::in(I)) :-
|
|
foo_2(Y, X).
|
|
|
|
:- pred foo_2(list(T)::out(I), list(T)::in(I)) is det.
|
|
:- pragma foreign_proc("C",
|
|
foo_2(Y::out(I), X::in(I)),
|
|
[promise_pure, thread_safe, will_not_call_mercury],
|
|
"
|
|
Y = X;
|
|
").
|
|
:- pragma foreign_proc("Java",
|
|
foo_2(Y::out(I), X::in(I)),
|
|
[promise_pure, thread_safe, will_not_call_mercury],
|
|
"
|
|
Y = X;
|
|
").
|
|
|
|
:- pragma foreign_export("C", bar(in(I), out(I)), "BAR").
|
|
bar(X, X).
|