https://issues.dlang.org/show_bug.cgi?id=18263
Issue ID: 18263
Summary: selective import with same name masks out this
reference in mixin template
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
The following code fails with an error:
mixin template HappyFunTime()
{
static void foo()
{
import std.meta : Filter;
alias bar = this.bar;
}
}
struct Filter
{
void bar() { }
mixin HappyFunTime;
}
test.d(9): Error: identifier 'bar' of 'Filter.bar' is not defined
What happens is that because both Filter and std.meta.Filter have the same
name, the import for std.meta.Filter somehow masks out the struct Filter for
the "this" lookup in the alias.
This is horrifying. If this lookup absolutely has to be done by name, it should
at least be done by fqn.
--