aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/unpickleScala2
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core/unpickleScala2')
-rw-r--r--src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
index 3b415c9e3..b1b229768 100644
--- a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
+++ b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
@@ -101,10 +101,12 @@ object Scala2Unpickler {
case cinfo => (Nil, cinfo)
}
val ost =
- if ((selfInfo eq NoType) && (denot is ModuleClass))
+ if ((selfInfo eq NoType) && (denot is ModuleClass) && denot.sourceModule.exists)
+ // it seems sometimes the source module does not exist for a module class.
+ // An example is `scala.reflect.internal.Trees.Template$. Without the
+ // `denot.sourceModule.exists` provision i859.scala crashes in the backend.
denot.owner.thisType select denot.sourceModule
else selfInfo
-
denot.info = ClassInfo(denot.owner.thisType, denot.classSymbol, Nil, decls, ost) // first rough info to avoid CyclicReferences
var parentRefs = ctx.normalizeToClassRefs(parents, cls, decls)
if (parentRefs.isEmpty) parentRefs = defn.ObjectType :: Nil