mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 19:03:45 +00:00
compiler/error_msg_inst.m:
Most parts of this module consisted of pairs of predicates following
the naming scheme X_to_pieces and X_to_inline_pieces. Replace each such
pair of predicates with one predicate that takes a flag that says
which version we want, since this allows us to avoid doing double
maintenance. (The overall logic of the two versions was always the same;
the differences affected only the construction of the piece sequence.)
Get the compiler to recreate the original pair of procedures
by using two separate specialized mode declarations to require
the callers of each such predicate to specify whether they want
to generate multi line or inline piece sequences.
Move the !Expansion argument pairs to the end of the argument list
in each of the updated predicates, in order to conform to our usual
programming style.
Eliminate differences between the codes used to construct the multi line
and inline piece sequences that had no effect on the final output.
Fix three minor bugs in the process.
The first bug was that inst_name_to_pieces, which was intended to generate
structured multi line inst descriptions, called inst_to_inline_pieces
instead of inst_to_pieces in some cases.
The second bug involved code in pred_inst_info_to_pieces and its inline
version to special case the formatting of higher order values with no
arguments. (The special casing omits what would be an empty pair of
parentheses around the empty argument list.) While this is the right thing
to do for predicates, it is nonsense for functions, because functions
have at least one argument: the return value. Fix the code to special case
functions having no *non-return-value* arguments.
The third bug was a call to component_lists_to_pieces which could generate
a list of argument modes in pred_inst_info_to_pieces and its inline version
that could leave the last two modes *not* being separated by a comma.
tests/invalid/bug415.err_exp:
Update this expected output to account for the first bug fix.
49 lines
1.7 KiB
Plaintext
49 lines
1.7 KiB
Plaintext
bug415.m:046: In clause for `ip_chunk_2(in(list.list((I =< ground))), in,
|
|
bug415.m:046: in(list.list((I =< ground))), in, out(list.list((I =<
|
|
bug415.m:046: ground))))':
|
|
bug415.m:046: mode error: argument 5 became too instantiated.
|
|
bug415.m:046: Final instantiatedness of `HeadVar__5' was
|
|
bug415.m:046: bound(
|
|
bug415.m:046: []
|
|
bug415.m:046: ;
|
|
bug415.m:046: '[|]'(
|
|
bug415.m:046: ground,
|
|
bug415.m:046: bound(
|
|
bug415.m:046: []
|
|
bug415.m:046: ;
|
|
bug415.m:046: '[|]'(
|
|
bug415.m:046: ( I =< ground ),
|
|
bug415.m:046: internal $merge_inst #1
|
|
bug415.m:046: which expands to
|
|
bug415.m:046: bound(
|
|
bug415.m:046: []
|
|
bug415.m:046: ;
|
|
bug415.m:046: '[|]'(
|
|
bug415.m:046: ( I =< ground ),
|
|
bug415.m:046: internal $merge_inst #1
|
|
bug415.m:046: )
|
|
bug415.m:046: )
|
|
bug415.m:046: )
|
|
bug415.m:046: )
|
|
bug415.m:046: )
|
|
bug415.m:046: ),
|
|
bug415.m:046: expected final instantiatedness was
|
|
bug415.m:046: named inst list.list(
|
|
bug415.m:046: ( I =< ground )
|
|
bug415.m:046: )
|
|
bug415.m:046: which expands to
|
|
bug415.m:046: named inst list.list_skel(
|
|
bug415.m:046: ( I =< ground )
|
|
bug415.m:046: )
|
|
bug415.m:046: which expands to
|
|
bug415.m:046: bound(
|
|
bug415.m:046: []
|
|
bug415.m:046: ;
|
|
bug415.m:046: '[|]'(
|
|
bug415.m:046: ( I =< ground ),
|
|
bug415.m:046: named inst list.list_skel(
|
|
bug415.m:046: ( I =< ground )
|
|
bug415.m:046: )
|
|
bug415.m:046: )
|
|
bug415.m:046: ).
|