File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1175,6 +1175,13 @@ class Namer { typer: Typer =>
1175
1175
def canForward (mbr : SingleDenotation , alias : TermName ): CanForward = {
1176
1176
import CanForward .*
1177
1177
val sym = mbr.symbol
1178
+ /**
1179
+ * Check the export selects an abstract member (issue #22147).
1180
+ */
1181
+ def isAbstractMember : Boolean = sym.is(Deferred ) && (expr match
1182
+ case ths : This if ths.qual.isEmpty => true
1183
+ case _ => false
1184
+ )
1178
1185
if ! sym.isAccessibleFrom(pathType) then
1179
1186
No (" is not accessible" )
1180
1187
else if sym.isConstructor || sym.is(ModuleClass ) || sym.is(Bridge ) || sym.is(ConstructorProxy ) || sym.isAllOf(JavaModule ) then
@@ -1183,8 +1190,8 @@ class Namer { typer: Typer =>
1183
1190
// and either
1184
1191
// * the symbols owner is the cls itself
1185
1192
// * 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
1193
+ // * the symbol is an abstract member #22147
1194
+ else if cls.derivesFrom(sym.owner) && (sym.owner == cls || ! sym.is(Deferred ) || isAbstractMember ) then
1188
1195
No (i " is already a member of $cls" )
1189
1196
else if pathMethod.exists && mbr.isType then
1190
1197
No (" is a type, so it cannot be exported as extension method" )
You can’t perform that action at this time.
0 commit comments