File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -1179,7 +1179,10 @@ class Namer { typer: Typer =>
11791179 * Check the export selects an abstract member of the current class (issue #22147).
11801180 */
11811181 def isAbstractMember : Boolean = sym.is(Deferred ) && (expr match
1182- case ths : This if ths.qual.isEmpty => true
1182+ case ths : This if ths.qual.isEmpty => true // access through 'this'
1183+ case id : Ident => id.denot.info match // access through self type
1184+ case cls2 : ClassInfo => cls2.cls == cls
1185+ case _ => false
11831186 case _ => false
11841187 )
11851188 if ! sym.isAccessibleFrom(pathType) then
Original file line number Diff line number Diff line change @@ -2,4 +2,20 @@ trait P:
22 def foo : Int
33
44class A extends P :
5- export this .foo // error
5+ export this .foo // error
6+
7+ trait Q extends P :
8+ def bar : Int
9+
10+ trait R extends P :
11+ def baz : Int
12+ val a1 : A
13+ val a2 : A
14+
15+ class B extends R :
16+ self =>
17+ export this .baz // error
18+ export self .bar // error
19+ export this .a1 .foo
20+ export self .a2 .foo // error
21+ export a2 .foo // error
You can’t perform that action at this time.
0 commit comments