From bc269505221ac36e48ce64dcef2e1688d05d93c6 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 4 Apr 2017 20:47:04 +0200 Subject: 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. --- compiler/src/dotty/tools/dotc/typer/Checking.scala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'compiler/src/dotty/tools/dotc/typer') diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala index b43391592..4b5b4476d 100644 --- a/compiler/src/dotty/tools/dotc/typer/Checking.scala +++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala @@ -400,8 +400,14 @@ object Checking { case tp: ClassInfo => tp.derivedClassInfo( prefix = apply(tp.prefix), - classParents = tp.parentsWithArgs.map(p => - apply(p).underlyingClassRef(refinementOK = false).asInstanceOf[TypeRef])) + classParents = + tp.parentsWithArgs.map { p => + apply(p).underlyingClassRef(refinementOK = false) match { + case ref: TypeRef => ref + case _ => defn.ObjectType // can happen if class files are missing + } + } + ) case _ => mapOver(tp) } -- cgit v1.2.3