Skip to content

Commit 388349a

Browse files
committed
Make non-final impure classes level owners
That's needed since a subclass might be a level owner.
1 parent c78df14 commit 388349a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler/src/dotty/tools/dotc/cc/CaptureOps.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,11 @@ extension (sym: Symbol)
397397
def isCaseClassSynthetic = // TODO drop
398398
symd.maybeOwner.isClass && symd.owner.is(Case) && symd.is(Synthetic) && symd.info.firstParamNames.isEmpty
399399
def classQualifies =
400-
takesCappedParamIn(symd.primaryConstructor.info)
401-
|| symd.asClass.givenSelfType.hasUniversalRootOf(sym)
400+
if sym.isEffectivelyFinal then
401+
takesCappedParamIn(symd.primaryConstructor.info)
402+
|| symd.asClass.givenSelfType.hasUniversalRootOf(sym)
403+
else
404+
!sym.isPureClass
402405
def compute =
403406
if symd.isClass then
404407
symd.is(CaptureChecked) && classQualifies || symd.isRoot

0 commit comments

Comments
 (0)