mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 02:43:40 +00:00
This fixes an issue reported on m-users on sep 23, which was caused by
the compiler counting a type_info argument added by the polymorphism pass.
compiler/hlds_pred.m:
Add a field for recording the number of arguments added by the
polymorphism transformation. We could try to figure this out
by counting how many type_info and/or typeclass info args
the argument list contains as an initial subsequence,
and the compiler has code that does that, but this approach
is vulnerable if user code ever passes around e.g. type_infos
*explicitly*, which would be very unusual, but not impossible.
compiler/polymorphism.m:
Fill in this new field.
compiler/mode_errors.m:
Use the new field to fix the argument number in the error message.
(This seems to be the only mode error that makes such a reference.)
compiler/direct_arg_in_out.m:
Conform to the change in hlds_pred.m above.
compiler/mode_info.m:
Clarify some comments.
compiler/modes.m:
Fix indentation.
tests/invalid/mode_error_arg_number.{m,err_exp}:
The code in the original bug report, made into a new test case.
tests/invalid/Mmakefile:
Enable the new test case.
tests/invalid/bug278.err_exp:
tests/invalid/bug415.err_exp:
tests/invalid/merge_ground_any.err_exp:
Expect the correct argument number in these test cases. The old
expected argument numbers were wrong, which means that we had missed
at least three chances to find the bug that this diff fixes. The
wrong argument number was in merge_ground_any.err_exp at its creation
in 2001.
43 lines
1.5 KiB
Plaintext
43 lines
1.5 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([] ; '[|]'(( I =< ground ),
|
|
bug415.m:046: internal $merge_inst #1))
|
|
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: ).
|