Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
February 13, 2012 [Issue 7491] New: import symbol name unavailable in class scope | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7491 Summary: import symbol name unavailable in class scope Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: dawg@dawgfoto.de --- Comment #0 from dawg@dawgfoto.de 2012-02-12 19:19:44 PST --- struct S { private import std.stdio; } class Base { private import std.stdio; } class Derived : Base { static void print() { std.stdio.writeln("Derived"); } } void main() { S.std.stdio.writeln("S"); // Error: Base.std is not a declaration Base.std.stdio.writeln("Base"); // Error: Derived.std is not a declaration Derived.std.stdio.writeln("Derived"); Derived.print(); } --------- Solution would be to add the disabled code. https://github.com/D-Programming-Language/dmd/commit/4bce0eb3acbb9ecce5988c55281aa1b3fd5a42f0#L0R7832 ---- This is problematic in the following case. ---- module a; class Base { private import std.algorithm; } ---- module b; import a, std.stdio; class Derived : Base { void foo() { // 'std' is looked up through Base.std rather than through module level // but Derived has no access right to the private import. std.stdio.writeln("Derived"); } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 13, 2012 [Issue 7491] import symbol name unavailable in class scope | ||||
---|---|---|---|---|
| ||||
Posted in reply to dawg@dawgfoto.de | http://d.puremagic.com/issues/show_bug.cgi?id=7491 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |INVALID --- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2012-02-13 01:48:01 PST --- Right, the lookup rules are being followed by the compiler, that is, super classes are looked at before module scope is. To get around that, prefix with the . as in: module b; import a, std.stdio; class Derived : Base { void foo() { .std.stdio.writeln("Derived"); ^ note . prefix } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 13, 2012 [Issue 7491] import symbol name unavailable in class scope | ||||
---|---|---|---|---|
| ||||
Posted in reply to dawg@dawgfoto.de | http://d.puremagic.com/issues/show_bug.cgi?id=7491 dawg@dawgfoto.de changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID | --- Comment #2 from dawg@dawgfoto.de 2012-02-13 07:47:09 PST --- If that's how things are supposed to work we should enable 'Base.std.stdio' access. https://github.com/D-Programming-Language/dmd/pull/712 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 21, 2012 [Issue 7491] import symbol name unavailable in class scope | ||||
---|---|---|---|---|
| ||||
Posted in reply to dawg@dawgfoto.de | http://d.puremagic.com/issues/show_bug.cgi?id=7491 SomeDude <lovelydear@mailmetrash.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lovelydear@mailmetrash.com --- Comment #3 from SomeDude <lovelydear@mailmetrash.com> 2012-04-21 06:09:43 PDT --- See also issue 7494 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 21, 2012 [Issue 7491] import symbol name unavailable in class scope | ||||
---|---|---|---|---|
| ||||
Posted in reply to dawg@dawgfoto.de | http://d.puremagic.com/issues/show_bug.cgi?id=7491 --- Comment #4 from github-bugzilla@puremagic.com 2012-07-21 00:29:58 PDT --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/b19051227f2c06c72f248f23dca13aad73e1d321 Merge pull request #712 from dawgfoto/fix7491 fix Issue 7491 - import symbol name unavailable in class scope -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 21, 2012 [Issue 7491] import symbol name unavailable in class scope | ||||
---|---|---|---|---|
| ||||
Posted in reply to dawg@dawgfoto.de | http://d.puremagic.com/issues/show_bug.cgi?id=7491 --- Comment #5 from Kenji Hara <k.hara.pg@gmail.com> 2012-07-21 00:51:33 PDT --- Walter, D1 also has this bug, but the change of symbol lookup path would *break* existing codes. Therefore I think we should not *fix* this in D1. How about? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 05, 2013 [Issue 7491] import symbol name unavailable in class scope | ||||
---|---|---|---|---|
| ||||
Posted in reply to dawg@dawgfoto.de | http://d.puremagic.com/issues/show_bug.cgi?id=7491 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich@gmail.com Version|D2 |D1 --- Comment #6 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-05 13:09:41 PST --- Marking as D1-only, Walter can close it if he agrees with Kenji. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation