Files
mercury/tests/hard_coded/bug557_helper.m
Zoltan Somogyi e144a91c83 Fix silent failure during module qualification.
This fixes Mantis bug #557.

compiler/module_qual.qualify_items.m:
    When module qualifying checked type, inst and mode definitions,

    - qualify the checked definition as appropriate to the module section
      where the definition's body is, and

    - do not discard any error messages generated by this process in favor of
      the error messages (if any) generated by qualifying the source
      definitions the checked definition was constructed from.

    The source of the Mantis #557 bug was that in a type definition,
    an argument type was (a) uniquely qualifiable in the interface section,
    but (b) was ambiguous in the implementation section, due to an extra
    module import being visible in the implementation section. The first
    change above fixes this bug. The second change is there to ensure that
    if we set the flag that says we found a non-uniquely-module-qualifiable
    type, inst or mode name, the error message we generate when we do that
    won't be discarded. The second change also means that such errors get
    two error messages generated for them, but since we always sort
    error_specs and any remove duplicates, this is not a problem.

tests/hard_coded/bug557.{m,exp}:
tests/hard_coded/bug557_helper.m:
    The test case for this bug, with a comment explaining the bug.

tests/hard_coded/Mmakefile:
    Enable the new test case.
2022-04-11 13:37:41 +10:00

15 lines
380 B
Mathematica

%-----------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et
%-----------------------------------------------------------------------------%
:- module bug557_helper.
:- interface.
:- type ambiguous_type
---> a
; b
; c.
%-----------------------------------------------------------------------------%