mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 20:03:44 +00:00
tests/hard_coded/bitmap_test_helper_1.m:
tests/hard_coded/curry_2_helper_1.m:
tests/hard_coded/deep_copy_bug.m:
tests/hard_coded/erroneous_liveness.m:
tests/hard_coded/foreign_type_1.m:
tests/hard_coded/hash_table_test.m:
tests/hard_coded/ho_float_reg.m:
tests/hard_coded/impl_def_lex_string.m:
tests/hard_coded/impure_foreign.m:
tests/hard_coded/intermod_multimode_helper_1.m:
tests/hard_coded/multimode.m:
tests/hard_coded/qual_is_test.m:
tests/hard_coded/string_codepoint.m:
tests/hard_coded/string_codepoint_offset_ilseq.m:
tests/hard_coded/string_count_codepoints_ilseq.m:
tests/hard_coded/string_set_char.m:
tests/hard_coded/version_hash_table_test_2.m:
tests/submodules/parent_t2.m:
tests/typeclasses/arbitrary_constraint_pred_1.m:
tests/typeclasses/arbitrary_constraint_pred_2.m:
tests/typeclasses/instance_unconstrained_tvar_type_spec.m:
tests/typeclasses/typeclass_order_bug_1.m:
Change code to avoid compiler warnings where this is (a) possible,
and (b) does not interfere with the purpose of the test.
tests/hard_coded/string_codepoint.exp:
tests/hard_coded/string_codepoint_offset_ilseq.exp:
tests/hard_coded/string_codepoint_offset_ilseq.exp2:
The changes to the source files of these tests changed all references
to "codepoint" to "code_point", including in the text they output.
Expect the updated output.
tests/general/Mercury.options:
tests/hard_coded/Mercury.options:
tests/typeclasses/Mercury.options:
tests/submodules/Mercury.options:
Disable many of the remaining warnings.
135 lines
3.9 KiB
Mathematica
135 lines
3.9 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module intermod_multimode_helper_1.
|
|
:- interface.
|
|
|
|
:- func func0 = string.
|
|
:- mode func0 = out is det.
|
|
|
|
:- func func1(int) = string.
|
|
:- mode func1(in) = out is det.
|
|
:- mode func1(out) = out is det.
|
|
|
|
:- func func2(int, int) = string.
|
|
:- mode func2(in, in) = out is det.
|
|
:- mode func2(in, out) = out is det.
|
|
:- mode func2(out, in) = out is det.
|
|
:- mode func2(out, out) = out is det.
|
|
|
|
:- impure pred test0.
|
|
:- mode test0 is det.
|
|
|
|
:- impure pred test1(int).
|
|
:- mode test1(in) is det.
|
|
:- mode test1(out) is det.
|
|
|
|
:- impure pred test2(int, int).
|
|
:- mode test2(in, in) is det.
|
|
:- mode test2(in, out) is det.
|
|
:- mode test2(out, in) is det.
|
|
:- mode test2(out, out) is det.
|
|
|
|
:- impure pred puts(string::in) is det.
|
|
|
|
:- type determinism
|
|
---> det
|
|
; semidet
|
|
; cc_multi
|
|
; cc_nondet
|
|
; multi
|
|
; nondet
|
|
; erroneous
|
|
; failure.
|
|
|
|
:- pred get_determinism(pred(T), determinism).
|
|
:- mode get_determinism(pred(out) is det, out(bound(det))) is det.
|
|
:- mode get_determinism(pred(out) is semidet, out(bound(semidet))) is det.
|
|
:- mode get_determinism(pred(out) is multi, out(bound(multi))) is det.
|
|
:- mode get_determinism(pred(out) is nondet, out(bound(nondet))) is det.
|
|
:- mode get_determinism(pred(out) is cc_multi, out(bound(cc_multi))) is det.
|
|
:- mode get_determinism(pred(out) is cc_nondet, out(bound(cc_nondet))) is det.
|
|
|
|
:- implementation.
|
|
|
|
func0 = "func0 = out".
|
|
|
|
:- pragma promise_pure(func(func1/1)). % XXX technically this is a lie
|
|
func1(_::in) = ("func1(in) = out"::out).
|
|
func1(0::out) = ("func1(out) = out"::out).
|
|
|
|
:- pragma promise_pure(func2/2). % XXX technically this is a lie
|
|
:- pragma inline(func2/2).
|
|
func2(_::in, _::in) = (R::out) :-
|
|
R = "func2(in, in) = out".
|
|
func2(_::in, 0::out) = (R::out) :-
|
|
R = "func2(in, out) = out".
|
|
func2(0::out, _::in) = (R::out) :-
|
|
R = "func2(out, in) = out".
|
|
func2(0::out, 0::out) = (R::out) :-
|
|
R = "func2(out, out) = out".
|
|
|
|
test0 :-
|
|
impure puts("test0").
|
|
|
|
test1(_::in) :-
|
|
impure puts("test1(in)").
|
|
test1(0::out) :-
|
|
impure puts("test1(out)").
|
|
|
|
:- pragma inline(test2/2).
|
|
test2(_::in, _::in) :-
|
|
impure puts("test2(in, in)").
|
|
test2(_::in, 0::out) :-
|
|
impure puts("test2(in, out)").
|
|
test2(0::out, _::in) :-
|
|
impure puts("test2(out, in)").
|
|
test2(0::out, 0::out) :-
|
|
impure puts("test2(out, out)").
|
|
|
|
:- pragma foreign_proc("C",
|
|
puts(S::in),
|
|
[will_not_call_mercury],
|
|
"
|
|
puts(S)
|
|
").
|
|
:- pragma foreign_proc("C#",
|
|
puts(S::in),
|
|
[],
|
|
"
|
|
System.Console.WriteLine(S);
|
|
").
|
|
:- pragma foreign_proc("Java",
|
|
puts(S::in),
|
|
[will_not_call_mercury],
|
|
"
|
|
System.out.println(S);
|
|
").
|
|
|
|
:- pragma promise_pure(get_determinism/2).
|
|
:- pragma inline(get_determinism/2).
|
|
get_determinism(Pred::(pred(out) is det), Det::out(bound(det))) :-
|
|
get_determinism_2(Pred, Det).
|
|
get_determinism(Pred::(pred(out) is semidet), Det::out(bound(semidet))) :-
|
|
get_determinism_2(Pred, Det).
|
|
get_determinism(_Pred::(pred(out) is cc_multi),
|
|
cc_multi::out(bound(cc_multi))).
|
|
get_determinism(_Pred::(pred(out) is cc_nondet),
|
|
cc_nondet::out(bound(cc_nondet))).
|
|
get_determinism(_Pred::(pred(out) is multi), multi::out(bound(multi))).
|
|
get_determinism(_Pred::(pred(out) is nondet), nondet::out(bound(nondet))).
|
|
|
|
:- inst bound_to_det == bound(det).
|
|
:- inst bound_to_semidet == bound(semidet).
|
|
|
|
:- pred get_determinism_2(pred(T), determinism).
|
|
:- mode get_determinism_2(pred(out) is det, out(bound_to_det)) is det.
|
|
:- mode get_determinism_2(pred(out) is semidet, out(bound_to_semidet)) is det.
|
|
:- pragma promise_pure(get_determinism_2/2).
|
|
:- pragma inline(get_determinism_2/2).
|
|
|
|
get_determinism_2(_Pred::(pred(out) is det), det::out(bound_to_det)).
|
|
get_determinism_2(_Pred::(pred(out) is semidet),
|
|
semidet::out(bound_to_semidet)).
|