Mercury Bugs - mercury
View Issue Details
0000149mercuryBugpublic2010-05-25 13:362010-05-25 13:36
Reporterjuliensf 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000149: inter-module optimization and abstract exported equivalence types.
DescriptionFrom the BUGS file

-------------------

Subject: inter-module optimization and abstract exported equivalence types.
Date: Thu, 19 February 1998

In some cases the compiler reports spurious ambiguity errors when compiling
with `--intermodule-optimization'. This is due to the definition of abstract
exported equivalence types being made visible by inter-module optimization.
In this example, with `--intermodule-optimization' the compiler sees the
declaration `:- type var == int' from term.m and then cannot determine whether
`Elem' has type `int' or `pair(int)'.
The work-around is to add an explicit type qualification.

:- module foo.
:- interface.
:- import_module list, term.
:- pred test(list(var)::in) is det.
:- implementation.
:- import_module int, std_util.

test(Args0) :-
        MakeIndex =
                (pred(Elem0::in, Elem::out, Index0::in, Index::out) is det :-
                        Elem = Elem0 - Index0,
                        Index is Index0 + 1
        ),
        list.map_foldl(MakeIndex, Args0, _, 0, _).
TagsNo tags attached.
Attached Files

There are no notes attached to this issue.

Issue History
2010-05-25 13:36juliensfNew Issue