Thread overview
[Issue 16215] Nested class unable to resolve outer class variables in certain scenarios
Jun 28, 2016
ag0aep6g@gmail.com
Jun 29, 2016
Puneet Goel
May 07, 2019
Alexander
Jun 17, 2019
er.krali@gmail.com
Jun 17, 2019
Seb
Feb 13, 2020
Walter Bright
Feb 13, 2020
Walter Bright
Feb 24, 2021
RazvanN
Oct 28, 2021
Dlang Bot
June 28, 2016
https://issues.dlang.org/show_bug.cgi?id=16215

ag0aep6g@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |ag0aep6g@gmail.com

--
June 29, 2016
https://issues.dlang.org/show_bug.cgi?id=16215

--- Comment #1 from Puneet Goel <puneet@coverify.org> ---
Another reduced case:

class Foo {
  class FooInner {}
}
class Bar: Foo {
  byte foo;
  class BarInner(T): Foo.FooInner {
    byte zoo() {
      return foo;
    }
  }
  alias BarInnerThis = BarInner!Bar;
}

$ dmd -c test.d
test.d(8): Error: need 'this' for 'foo' of type 'byte'

--
May 07, 2019
https://issues.dlang.org/show_bug.cgi?id=16215

Alexander <ismailsiege@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ismailsiege@gmail.com

--- Comment #2 from Alexander <ismailsiege@gmail.com> ---
Analogous case that does not work in dmd 2.086.0, but works in 2.085.0:

class Base
{
    class BaseInner {}
}

final class Derived: Base
{
    bool someMethod() { return false; }

    final class DerivedInner: BaseInner
    {
         void func()
         {
             pragma(msg, typeof(this.outer)); // prints "Derived"
             someMethod();
         }
    }
}

void main() {}


compiler output:
Derived
onlineapp.d(17): Error: this for someMethod needs to be type Derived not type
onlineapp.Base

--
June 17, 2019
https://issues.dlang.org/show_bug.cgi?id=16215

er.krali@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |er.krali@gmail.com

--- Comment #3 from er.krali@gmail.com ---
Shouldn't this bug be marked now as a regression? Checking the code in the previous comment:

Up to      2.067.1: Success with output: Base
2.068.2 to 2.085.1: Success with output: Derived
Since      2.086.0: Failure with output:
-----
Derived
onlineapp.d(16): Error: `this` for `someMethod` needs to be type `Derived` not
type `onlineapp.Base`
-----

--
June 17, 2019
https://issues.dlang.org/show_bug.cgi?id=16215

Seb <greeenify@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |greeenify@gmail.com
           Severity|normal                      |regression

--
February 13, 2020
https://issues.dlang.org/show_bug.cgi?id=16215

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> ---
(In reply to Puneet Goel from comment #0)
> This is one of the corner cases that I could reduce.

-       return (zoo).frop();
+       return frop(zoo);

Note with the above change it compiles successfully.

--
February 13, 2020
https://issues.dlang.org/show_bug.cgi?id=16215

--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> ---
These actually appear to be three separate issues.

--
February 24, 2021
https://issues.dlang.org/show_bug.cgi?id=16215

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #6 from RazvanN <razvan.nitu1305@gmail.com> ---
(In reply to Walter Bright from comment #4)
> (In reply to Puneet Goel from comment #0)
> > This is one of the corner cases that I could reduce.
> 
> -       return (zoo).frop();
> +       return frop(zoo);
> 
> Note with the above change it compiles successfully.

That specific case seems to be running fine with today's compiler.

--
October 28, 2021
https://issues.dlang.org/show_bug.cgi?id=16215

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> ---
@RazvanN7 created dlang/dmd pull request #13236 "Fix Issue 16215 - Nested class unable to resolve outer class variables in certain scenarios" fixing this issue:

- Fix Issue 16215

https://github.com/dlang/dmd/pull/13236

--