From 49be95aa0c25b2e60310e7457019bb27283ac70f Mon Sep 17 00:00:00 2001 From: Dale Wijnand Date: Thu, 10 Nov 2022 14:21:24 +0000 Subject: [PATCH] Avoid crashing in ExplicitOuter on missing references --- compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala index 00074a6ea81a..99258b63359c 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala @@ -10,6 +10,7 @@ import core.Phases._ import core.Types._ import core.Flags._ import core.Decorators._ +import core.Scopes.* import core.StdNames.nme import core.Names._ import core.NameOps._ @@ -49,7 +50,7 @@ class ExplicitOuter extends MiniPhase with InfoTransformer { thisPhase => /** Add outer accessors if a class always needs an outer pointer */ override def transformInfo(tp: Type, sym: Symbol)(using Context): Type = tp match { case tp @ ClassInfo(_, cls, _, decls, _) if needsOuterAlways(cls) => - val newDecls = decls.cloneScope + val newDecls = if decls == EmptyScope then newScope else decls.cloneScope newOuterAccessors(cls).foreach(newDecls.enter) tp.derivedClassInfo(decls = newDecls) case _ =>