Files
mercury/tests/hard_coded/deep_copy_bug.m
Zoltan Somogyi 38f1f5faf2 Shut up many warnings in executable test dirs.
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.
2025-02-20 23:11:53 +11:00

71 lines
1.5 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% This is a regression test.
% The Mercury compiler of Apr 11 1997 failed for this in non-gc grades,
% because of a bug in deep_copy() of equivalence types.
:- module deep_copy_bug.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module int.
:- import_module list.
:- import_module solutions.
:- import_module term.
:- import_module varset.
main(!IO) :-
test1(!IO),
test2(!IO),
test3(!IO).
:- pred test1(io::di, io::uo) is det.
test1(!IO) :-
Lambda =
( pred(X::out) is nondet :-
varset.init(Varset0),
varset.new_vars(10, Vars, Varset0, _),
list.member(X : var, Vars)
),
solutions(Lambda, List),
io.write_line(List, !IO).
:- pred test2(io::di, io::uo) is det.
test2 -->
test2b("blahblah").
:- pred test2b(T::in, io::di, io::uo) is det.
test2b(S, !IO) :-
F = foo(S),
solutions(F, List),
io.write_line(List, !IO).
:- pred foo(T, var).
:- mode foo(in, out) is nondet.
foo(_Blah, X) :-
varset.init(Varset0),
varset.new_vars(10, Vars, Varset0, _),
list.member(X, Vars).
:- pred test3(io::di, io::uo) is det.
test3(!IO) :-
solutions((pred(X::out) is nondet :- bar(X)), List),
io.write_line(List, !IO).
:- pred bar(int).
:- mode bar(out) is det.
bar(42).