The compiler can't "see" an inner class
Simen Kjærås
simen.kjaras at gmail.com
Sun Oct 27 19:54:06 UTC 2019
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
More information about the Digitalmars-d-learn
mailing list