Skip to content

Commit 6a91c3d

Browse files
committed
instantiate if current class is final
1 parent 9d88998 commit 6a91c3d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/src/dotty/tools/dotc/transform/IsInstanceOfChecker.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ object Checkable {
105105
val bounds = ctx.typerState.constraint.entry(tvar.origin)
106106
if (bounds.loBound =:= bounds.hiBound)
107107
tvar.instantiateWith(bounds.loBound)
108-
else {
108+
else if (tycon.classSymbol.is(Final)) // 3324g.scala cannot happen because of final
109+
instantiateSelected(P1, tvar :: Nil)
110+
else { // see 3324g.scala
109111
val wildCard = ctx.newSymbol(ctx.owner, WildcardParamName.fresh().toTypeName, Case, tvar.origin.underlying, coord = pos)
110112
tvar.instantiateWith(wildCard.typeRef)
111113
}

0 commit comments

Comments
 (0)