File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1179,7 +1179,12 @@ class Namer { typer: Typer =>
1179
1179
No (" is not accessible" )
1180
1180
else if sym.isConstructor || sym.is(ModuleClass ) || sym.is(Bridge ) || sym.is(ConstructorProxy ) || sym.isAllOf(JavaModule ) then
1181
1181
Skip
1182
- else if cls.derivesFrom(sym.owner) && (sym.owner == cls || ! sym.is(Deferred )) then
1182
+ // if the cls is a subclass of the owner of the symbol
1183
+ // and either
1184
+ // * the symbols owner is the cls itself
1185
+ // * the symbol is not a deferred symbol
1186
+ // * the symbol is a deferred symbol and the selection is on a This
1187
+ else if cls.derivesFrom(sym.owner) && (sym.owner == cls || ! sym.is(Deferred ) || (sym.is(Deferred ) && expr.isInstanceOf [This ])) then
1183
1188
No (i " is already a member of $cls" )
1184
1189
else if pathMethod.exists && mbr.isType then
1185
1190
No (" is a type, so it cannot be exported as extension method" )
Original file line number Diff line number Diff line change
1
+ trait P :
2
+ def foo : Int
3
+
4
+ class A extends P :
5
+ export this .foo // error
You can’t perform that action at this time.
0 commit comments