www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1403] New: Incorrect scope in unit test

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

           Summary: Incorrect scope in unit test
           Product: D
           Version: 2.003
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid, rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: reiner.pope gmail.com


As desired, the following code fails to compile:
unittest {
    interface Foo {
        int a();
    }
}

unittest {
    Foo f;
    f.a();
}

However, the following code *does* compile:
unittest {
    interface Foo {
        int a();
    }
}

unittest {
    interface Foo {
        int b();
    }

    Foo f;
    f.a(); // we have the wrong Foo here
}

and if f.a() is changed to f.b(), it doesn't compile.


-- 
Aug 05 2007