mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-21 12:23:44 +00:00
tests/invalid/*.{m,err_exp}:
tests/misc_tests/*.m:
tests/mmc_make/*.m:
tests/par_conj/*.m:
tests/purity/*.m:
tests/stm/*.m:
tests/string_format/*.m:
tests/structure_reuse/*.m:
tests/submodules/*.m:
tests/tabling/*.m:
tests/term/*.m:
tests/trailing/*.m:
tests/typeclasses/*.m:
tests/valid/*.m:
tests/warnings/*.{m,exp}:
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 tests
that check compiler error messages, expect the new line numbers.
browser/cterm.m:
browser/tree234_cc.m:
Import only one module per line.
tests/hard_coded/boyer.m:
Fix something I missed.
64 lines
1.9 KiB
Mathematica
64 lines
1.9 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% This is a regression test. Some versions of the compiler abort on this code.
|
|
%
|
|
% The bug that this test case tests for is described by this comment from
|
|
% liveness.m:
|
|
%
|
|
% If a variable is not live on entry to a goal, but the goal gives it a value,
|
|
% the code of this module assumes that
|
|
%
|
|
% (a) any parallel goals also give it a value, or
|
|
% (b) the variable is local to this goal and hence does not occur in parallel
|
|
% goals.
|
|
%
|
|
% If a variable occurs in the nonlocal set of the goal, the code of this
|
|
% assumes that (b) is not true, and will therefore require (a) to be true.
|
|
% If some of the parallel goals cannot succeed, the first pass will include
|
|
% the variable in their post-birth sets.
|
|
%
|
|
% If a variable occurs in the nonlocal set of the goal, but is actually
|
|
% local to the goal, then any occurrence of that variable in the postbirth
|
|
% sets of parallel goals will lead to an inconsistency, because the variable
|
|
% will not die on those parallel paths, but will die on the path that
|
|
% actually gives a value to the variable.
|
|
|
|
:- module liveness_nonlocals.
|
|
|
|
:- interface.
|
|
|
|
:- import_module bool.
|
|
|
|
:- pred foo(T, bool).
|
|
:- mode foo(in, in(bound(yes))) is failure.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module list.
|
|
:- import_module require.
|
|
:- import_module string.
|
|
|
|
foo(Foo, IsFoo) :-
|
|
foo_int(Foo, Int),
|
|
int_to_bool(Int, IsFoo).
|
|
|
|
:- pred foo_int(T, int).
|
|
:- mode foo_int(in, out(bound(0))) is det.
|
|
|
|
:- pragma foreign_proc("C",
|
|
foo_int(_V2::in, Res::out(bound(0))),
|
|
[promise_pure, will_not_call_mercury],
|
|
"
|
|
Res = 0;
|
|
").
|
|
foo_int(_, 0).
|
|
|
|
:- pred int_to_bool(int, bool).
|
|
:- mode int_to_bool(in(bound(1)), out(bound(yes))) is det.
|
|
:- mode int_to_bool(in(bound(0)), out(bound(no))) is det.
|
|
|
|
int_to_bool(1, yes).
|
|
int_to_bool(0, no).
|