Files
mercury/tests/submodules/external_unification_pred.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

83 lines
1.9 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% The mercury compiler from 2003-12-01 generated uncompilable il code for this
% test case.
:- module external_unification_pred.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- module external_unification_pred.sub.
:- interface.
:- type ft.
:- func create_ft(int) = ft.
:- implementation.
:- pragma foreign_type(c, ft, "int") where equality is unify_ft.
:- pragma foreign_type("C#", ft, "int") where equality is unify_ft.
:- pragma foreign_type(java, ft, "Integer") where equality is unify_ft.
:- pred unify_ft(ft::in, ft::in) is semidet.
:- pragma foreign_proc("C",
unify_ft(X::in, Y::in),
[promise_pure],
"
SUCCESS_INDICATOR = (X == Y);
").
:- pragma foreign_proc("C#",
unify_ft(X::in, Y::in),
[promise_pure],
"
SUCCESS_INDICATOR = (X == Y);
").
:- pragma foreign_proc("Java",
unify_ft(X::in, Y::in),
[promise_pure],
"
SUCCESS_INDICATOR = (X == Y);
").
:- pragma foreign_proc("C",
create_ft(X::in) = (Y::out),
[promise_pure],
"
Y = X;
").
:- pragma foreign_proc("C#",
create_ft(X::in) = (Y::out),
[promise_pure],
"
Y = X;
").
:- pragma foreign_proc("Java",
create_ft(X::in) = (Y::out),
[promise_pure],
"
Y = X;
").
:- end_module external_unification_pred.sub.
:- import_module external_unification_pred.sub.
main(!IO) :-
X = create_ft(1),
Y = create_ft(2),
( X = Y ->
io__write_string("true.\n", !IO)
;
io__write_string("false.\n", !IO)
).
:- end_module external_unification_pred.