Bug 11861 – Unable to selectively import a nested symbol
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-01-02T21:51:00Z
Last change time
2017-07-05T16:12:25Z
Assigned to
nobody
Creator
sergei.nosov
Comments
Comment #0 by sergei.nosov — 2014-01-02T21:51:33Z
Consider,
In a.d
static struct A
{
alias string S;
}
In b.d
import a : B = A.S;
void main() {}
Module b.d doesn't compile, issuing
b.d(1): Error: ';' expected
b.d(1): Error: no identifier for declarator S
on the 1st line
Comment #1 by dlang-bugzilla — 2017-07-05T16:12:25Z
I'm pretty sure that allowing to bind aliases for arbitrarily-nested symbols inside imported modules is not a feature that import statements are meant for.
I suggest using a static import + fully-qualified alias in the importing module instead.