Files
mercury/tests/hard_coded/deep_copy_bug.m
Zoltan Somogyi 33eb3028f5 Clean up the tests in half the test directories.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the debugger tests,
    specify the new line numbers in .inp files and expect them in .exp files.
2015-02-14 20:14:03 +11:00

68 lines
1.6 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__state::di, io__state::uo) is det.
:- implementation.
:- import_module int.
:- import_module list.
:- import_module solutions.
:- import_module term.
:- import_module varset.
main -->
test1,
test2,
test3.
:- pred test1(io__state::di, io__state::uo) is det.
test1 -->
{ Lambda = (pred(X::out) is nondet :-
varset__init(Varset0),
varset__new_vars(10, Vars, Varset0, _),
list__member(X, Vars)
) },
{ solutions(Lambda, List) },
io__write(List),
io__write_string("\n").
:- pred test2(io__state::di, io__state::uo) is det.
test2 -->
test2b("blahblah").
:- pred test2b(T::in, io__state::di, io__state::uo) is det.
test2b(S) -->
{ F = foo(S) },
{ solutions(F, List) },
io__write(List),
io__write_string("\n").
:- 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__state::di, io__state::uo) is det.
test3 -->
{ solutions((pred(X::out) is nondet :- bar(X)), List) },
io__write(List),
io__write_string("\n").
:- pred bar(int).
:- mode bar(out) is det.
bar(42).