mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 11:23:46 +00:00
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.
47 lines
1.3 KiB
Mathematica
47 lines
1.3 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% Regression test. There was no out-of-line definition of
|
|
% private_builtin.store_at_ref which is required for
|
|
% --optimise-constructor-last-call and --no-inline-builtins to work together.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module lco_no_inline.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- import_module int.
|
|
:- import_module list.
|
|
:- import_module pair.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
main(!IO) :-
|
|
AL = ["one" - 1, "two" - 2],
|
|
to_list_2(AL, L),
|
|
io.write(L, !IO),
|
|
io.nl(!IO).
|
|
|
|
:- pred to_list_2(list(pair(string, int))::in, list(string)::out) is det.
|
|
|
|
to_list_2([], []).
|
|
to_list_2([X - Int | Xs], Out) :-
|
|
( Int =< 0 ->
|
|
to_list_2(Xs, Out)
|
|
;
|
|
NewInt = Int - 1,
|
|
to_list_2([X - NewInt | Xs], Out0),
|
|
Out = [X | Out0]
|
|
).
|
|
|
|
%---------------------------------------------------------------------------%
|