-
-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
checks for `isNeedThisScope` should check up the inheritance chain for nested classes.
- Loading branch information
1 parent
97b71f1
commit 05e4846
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// https://issues.dlang.org/show_bug.cgi?id=24716 | ||
int i = 1; | ||
void foo(int arg) | ||
{ | ||
assert( arg == 100*i); | ||
i++; | ||
} | ||
class Outer1 { | ||
int value1 = 100; | ||
|
||
class Inner1 { | ||
void print() { | ||
foo(value1); | ||
} | ||
} | ||
|
||
Inner1 make() { return new Inner1; } | ||
} | ||
|
||
class Outer2 : Outer1 { | ||
int value2 = 200; | ||
|
||
class Inner2 : Outer1.Inner1 { | ||
override void print() { | ||
foo(value1); // <- no problem! | ||
foo(value2); // error: accessing non-static variable `value2` requires an instance of `Outer2` | ||
} | ||
} | ||
|
||
override Inner2 make() { return new Inner2; } | ||
} | ||
|
||
void main() | ||
{ | ||
auto oouter = new Outer2; | ||
auto iinner = oouter.make(); | ||
iinner.print(); | ||
} |