Bug 2986 – wrong lookup: interface declaration inside function scope
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-05-15T16:48:00Z
Last change time
2015-06-09T01:27:56Z
Keywords
wrong-code
Assigned to
nobody
Creator
rsinfu
Comments
Comment #0 by rsinfu — 2009-05-15T16:48:42Z
--------------------
void foo()
{
interface I { }
}
void bar()
{
interface I { void foo(); }
I i;
i.foo();
}
--------------------
test.d(9): Error: no property 'foo' for type 'test.foo.I'
test.d(9): Error: function expected before (), not __error of type int
--------------------
The compiler uses foo.I instead of bar.I. This prevents me from using local interfaces inside unittests.
This does not happen with classes nor structs.
Comment #1 by clugdbug — 2011-02-12T14:40:35Z
Failed 2.030, Fixed DMD2.031.
Comment #2 by github-bugzilla — 2012-04-15T05:04:43Z