www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - The compiler can't "see" an inner class

reply Emmanuelle <VuLXn6DBW PPtUm7TvV6nsw.com> writes:
Hello! See snippet:

---
interface AST
{
     static interface Expr : AST
     {
         final static class Name : Expr
         {
             override void accept(AST.Visitor v) { 
v.visitName(this); }
         }
     }

     final static class Visitor
     {
         void visitName(AST.Expr.Name name);
     }

     void accept(AST.Visitor v);
}
---

If you try to compile that, dmd v2.088.0 complains:

---
Error: no property Name for type onlineapp.AST.Expr
---

How come? It's defined right there. I would really like some 
pointers on this, thanks!
Oct 27 2019
parent reply Simen =?UTF-8?B?S2rDpnLDpXM=?= <simen.kjaras gmail.com> writes:
On Sunday, 27 October 2019 at 17:52:51 UTC, Emmanuelle wrote:
 Hello! See snippet:

 ---
 interface AST
 {
     static interface Expr : AST
     {
         final static class Name : Expr
         {
             override void accept(AST.Visitor v) { 
 v.visitName(this); }
         }
     }

     final static class Visitor
     {
         void visitName(AST.Expr.Name name);
     }

     void accept(AST.Visitor v);
 }
 ---

 If you try to compile that, dmd v2.088.0 complains:

 ---
 Error: no property Name for type onlineapp.AST.Expr
 ---

 How come? It's defined right there. I would really like some 
 pointers on this, thanks!
It's a bug: interface A { interface B : A { class C : B { } } // Fails: no property 'C' for type 'foo.A.B' void inside(A.B.C c) { } } // Works void outside(A.B.C c) { } https://issues.dlang.org/show_bug.cgi?id=20329 -- Simen
Oct 27 2019
parent Emmanuelle <VuLXn6DBW PPtUm7TvV6nsw.com> writes:
On Sunday, 27 October 2019 at 19:54:06 UTC, Simen Kjærås wrote:
 It's a bug:

 interface A {
     interface B : A {
         class C : B {
         }
     }
     // Fails: no property 'C' for type 'foo.A.B'
     void inside(A.B.C c) { }
 }
 // Works
 void outside(A.B.C c) { }

 https://issues.dlang.org/show_bug.cgi?id=20329

 --
   Simen
Yikes! Thanks for submitting the issue to bugzilla :)
Oct 27 2019