Bug 10128 – import statement in base class members should be private by default

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-21T03:37:06Z
Last change time
2018-01-24T15:58:41Z
Keywords
accepts-invalid, pull
Assigned to
No Owner
Creator
Kenji Hara

Comments

Comment #0 by k.hara.pg — 2013-05-21T03:37:06Z
From: http://forum.dlang.org/post/CAFDvkcudf0S-DNHTPFHceBPVQj92vsErYuWTaPbC3Rd752ai9w@mail.gmail.com In module level, import declaration will add name lookup path _in private_. module a; import std.algorithm; // default is private module b; import a; void main() { [1,2,3].map!(a=>a); // Error: no property 'map' for type 'int[]' } But with current master, import declaration in base class member adds name lookup path _in public_. I had not recognize this behavior. class A { import std.algorithm; // default is public!? } class B : A { void test() { auto r = [1,2,3].map!(a=>a); // succeeds to compile } } void main() { auto r = B.map!(a=>a)([1,2,3]); // also succeeds to compile } I think this is inconsistent, and class case should be fixed.
Comment #1 by k.hara.pg — 2013-06-26T05:43:42Z