Skip to content

Commit 13e2170

Browse files
committed
Another IDE hardening tweak
1 parent a4a2d04 commit 13e2170

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2112,7 +2112,12 @@ object Types {
21122112
abstract case class ThisType(tref: TypeRef) extends CachedProxyType with SingletonType {
21132113
def cls(implicit ctx: Context): ClassSymbol = tref.stableInRunSymbol.asClass
21142114
override def underlying(implicit ctx: Context): Type =
2115-
if (ctx.erasedTypes) tref else cls.classInfo.selfType
2115+
if (ctx.erasedTypes) tref
2116+
else cls.info match {
2117+
case cinfo: ClassInfo => cinfo.selfType
2118+
case cinfo: ErrorType if ctx.mode.is(Mode.Interactive) => cinfo
2119+
// can happen in IDE if `cls` is stale
2120+
}
21162121

21172122
override def computeHash = doHash(tref)
21182123

0 commit comments

Comments
 (0)