Bug 14016 – Nested inherited class doesn't know the type of its outer object

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-01-20T13:02:00Z
Last change time
2017-07-19T17:38:58Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2015-01-20T13:02:06Z
----- class A { class NestedA { } } class B : A { int field; class NestedB : NestedA { void foo ( ) { this.outer.field = 1; // disallowed (cast(B)this.outer).field = 1; // workaround } } } void main ( ) { } ----- $ dmd test.d > test.d(14): Error: no property 'field' for type 'test.A' I think the first line should work. AFAIK NestedB can only be instantiated with an outer type B, therefore 'this.outer' should be implicitly derived to be of type 'test.B'.
Comment #1 by k.hara.pg — 2015-02-21T13:43:13Z
Comment #2 by github-bugzilla — 2015-02-27T10:07:42Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/265fdb1e66678ef2b0918ba78fcfb7ab521d093b fix Issue 14016 - Nested inherited class doesn't know the type of its outer object https://github.com/D-Programming-Language/dmd/commit/c18178d86510d11e25567fe14e470f77091b4ea7 Merge pull request #4429 from 9rnsr/fix14016 Issue 14016 - Nested inherited class doesn't know the type of its outer object
Comment #3 by github-bugzilla — 2015-06-17T21:01:13Z
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/265fdb1e66678ef2b0918ba78fcfb7ab521d093b fix Issue 14016 - Nested inherited class doesn't know the type of its outer object https://github.com/D-Programming-Language/dmd/commit/c18178d86510d11e25567fe14e470f77091b4ea7 Merge pull request #4429 from 9rnsr/fix14016
Comment #4 by github-bugzilla — 2017-07-19T17:38:58Z
Commits pushed to dmd-cxx at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/265fdb1e66678ef2b0918ba78fcfb7ab521d093b fix Issue 14016 - Nested inherited class doesn't know the type of its outer object https://github.com/dlang/dmd/commit/c18178d86510d11e25567fe14e470f77091b4ea7 Merge pull request #4429 from 9rnsr/fix14016