Skip to content

Commit bacf9a6

Browse files
committed
Another IDE hardening tweak
1 parent 716d72e commit bacf9a6

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
@@ -2125,7 +2125,12 @@ object Types {
21252125
abstract case class ThisType(tref: TypeRef) extends CachedProxyType with SingletonType {
21262126
def cls(implicit ctx: Context): ClassSymbol = tref.stableInRunSymbol.asClass
21272127
override def underlying(implicit ctx: Context): Type =
2128-
if (ctx.erasedTypes) tref else cls.classInfo.selfType
2128+
if (ctx.erasedTypes) tref
2129+
else cls.info match {
2130+
case cinfo: ClassInfo => cinfo.selfType
2131+
case cinfo: ErrorType if ctx.mode.is(Mode.Interactive) => cinfo
2132+
// can happen in IDE if `cls` is stale
2133+
}
21292134

21302135
override def computeHash = doHash(tref)
21312136

0 commit comments

Comments
 (0)