[Issue 2402] New: Type is not found if accessed via renamed import

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 8 13:10:28 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2402

           Summary: Type is not found if accessed via renamed import
           Product: D
           Version: 2.019
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: 2korden at gmail.com


module m1;
struct Foo { int x; }

module m2;
struct Foo { int x; int y; }

module m;

import M1 = m1;
import M2 = x2;  // line 4
import M2 = m2;  // line 5

M2.Foo convert(M1.Foo foo)
{
    M2.Foo result = void;
    result.x = foo.x;
    result.y = foo.y;
    return result;
}

m.d(7): Error: identifier 'Foo' of 'M2.Foo' is not defined
m.d(7): Error: M2.Foo is used as a type

Note that swapping lines 4 and 5 workarounds the issue.

But there appears another issue:
m.d(11): Error: no property 'y' for type 'Foo'

Which one? Error should mention be M1.Foo instead of just Foo.
(Shall I move it into separate enhancement issue?)


-- 



More information about the Digitalmars-d-bugs mailing list