D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2986 - wrong lookup: interface declaration inside function scope
Summary: wrong lookup: interface declaration inside function scope
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2009-05-15 16:48 UTC by Shin Fujishiro
Modified: 2015-06-09 01:27 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 Shin Fujishiro 2009-05-15 16:48:42 UTC
--------------------
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 Don 2011-02-12 14:40:35 UTC
Failed 2.030, Fixed DMD2.031.
Comment 2 github-bugzilla 2012-04-15 05:04:43 UTC
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/dc6c8c6c93ce4193b472c9cab4fefcdc66f2fb3f
Removed workarounds for resolved bug 2986

https://github.com/D-Programming-Language/phobos/commit/da44d0b006c0785538aa5537baf1626b6139a56d
Merge pull request #525 from denis-sh/remove-workarounds-for-2986

Removed workarounds for resolved bug 2986