D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1403 - Incorrect scope in unit test
Summary: Incorrect scope in unit test
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid, rejects-valid
Depends on:
Blocks:
 
Reported: 2007-08-05 02:51 UTC by Reiner Pope
Modified: 2015-06-09 05:11 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Reiner Pope 2007-08-05 02:51:00 UTC
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.
Comment 1 yebblies 2012-01-29 19:41:44 UTC
Works with current dmd (2.058 & 1.068)
Comment 2 yebblies 2012-01-29 19:45:54 UTC
Wait a sec, Reiner Pope? Did we go to the same highschool?