Skip to content

Commit bc26950

Browse files
committed
Make leak avoidance more robust
If class files are missing, finding an underlying class reference might give a NoType. This caused an asInstanceOf to fail. We now handle that case gracefully.
1 parent a71cb97 commit bc26950

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,14 @@ object Checking {
400400
case tp: ClassInfo =>
401401
tp.derivedClassInfo(
402402
prefix = apply(tp.prefix),
403-
classParents = tp.parentsWithArgs.map(p =>
404-
apply(p).underlyingClassRef(refinementOK = false).asInstanceOf[TypeRef]))
403+
classParents =
404+
tp.parentsWithArgs.map { p =>
405+
apply(p).underlyingClassRef(refinementOK = false) match {
406+
case ref: TypeRef => ref
407+
case _ => defn.ObjectType // can happen if class files are missing
408+
}
409+
}
410+
)
405411
case _ =>
406412
mapOver(tp)
407413
}

0 commit comments

Comments
 (0)