mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
tests/hard_coded/*.m:
Rename modules as mentioned above.
In a few cases, where the main module's name itself had a suffix,
such as "_mod_a" or "_main", remove that suffix. This entails
renaming the .exp file as well. (In some cases, this meant that
the name of a helper module was "taken over" by the main module
of the test case.)
Update all references to the moved modules.
General updates to programming style, such as
- replacing DCG notation with state var notation
- replacing (C->T;E) with (if C then T else E)
- moving pred/func declarations to just before their code
- replacing io.write/io.nl sequences with io.write_line
- replacing io.print/io.nl sequences with io.print_line
- fixing too-long lines
- fixing grammar errors in comments
tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
Update all references to the moved modules.
Enable the constant_prop_int test case. The fact that it wasn't enabled
before is probably an accident. (When constant_prop_int.m was created,
the test case was added to a list in the Mmakefile, but that list
was later removed due to never being referenced.)
tests/hard_coded/constant_prop_int.{m,exp}:
Delete the calls to shift operations with negative shift amounts,
since we have added a compile-time error for these since the test
was originally created.
52 lines
1.4 KiB
Mathematica
52 lines
1.4 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module deforest_cc_bug.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is cc_multi.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module list.
|
|
:- import_module std_util.
|
|
|
|
main(!IO) :-
|
|
bug(1, [2, 3, 4, 5, 6, 7], !IO).
|
|
|
|
:- pred bug(int::in, list(int)::in, io::di, io::uo) is cc_multi.
|
|
:- pragma no_inline(bug/4).
|
|
|
|
bug(FirstArg, ArgsRest, !IO) :-
|
|
get_inputs_and_result(FirstArg, ArgsRest, Inputs, _),
|
|
my_write_list(Inputs, write_decl_atom_arg, !IO),
|
|
io.nl(!IO).
|
|
|
|
:- pred write_decl_atom_arg(int, io, io).
|
|
:- mode write_decl_atom_arg(in, di, uo) is cc_multi.
|
|
|
|
write_decl_atom_arg(Arg, !IO) :-
|
|
cc_multi_equal(!IO),
|
|
io.write_int(Arg, !IO).
|
|
|
|
:- pred get_inputs_and_result(int, list(int), list(int), int).
|
|
:- mode get_inputs_and_result(in, in, out, out) is det.
|
|
|
|
get_inputs_and_result(A, [], [], A).
|
|
get_inputs_and_result(A1, [A2 | As], [A1 | Inputs0], Result) :-
|
|
get_inputs_and_result(A2, As, Inputs0, Result).
|
|
|
|
:- pred my_write_list(list(int)::in,
|
|
pred(int, io, io)::(pred(in, di, uo) is cc_multi),
|
|
io::di, io::uo) is cc_multi.
|
|
|
|
my_write_list([], _OutputPred, !IO).
|
|
my_write_list([E | Es], OutputPred, !IO) :-
|
|
OutputPred(E, !IO),
|
|
my_write_list(Es, OutputPred, !IO).
|
|
|
|
%---------------------------------------------------------------------------%
|