Skip to content

Commit ce10c6f

Browse files
oderskyDarkDimius
authored andcommitted
Handle inner classes in RestoreScopes
They need to be entered into their enclosing package scope, because flatten lifted them out to the toplevel.
1 parent 28412fe commit ce10c6f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/dotty/tools/dotc/transform/RestoreScopes.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ class RestoreScopes extends MiniPhaseTransform with IdentityDenotTransformer { t
2525
for (stat <- constr :: body)
2626
if (stat.isInstanceOf[MemberDef] && stat.symbol.exists)
2727
restoredDecls.enter(stat.symbol)
28-
val cinfo = tree.symbol.asClass.classInfo
28+
val cls = tree.symbol.asClass
29+
cls.owner.asClass.enter(cls)
30+
// Enter class in enclosing package scope, in case it was an inner class before flatten.
31+
// For top-level classes this does nothing.
32+
val cinfo = cls.classInfo
2933
tree.symbol.copySymDenotation(
3034
info = cinfo.derivedClassInfo( // Dotty deviation: Cannot expand cinfo inline without a type error
3135
decls = restoredDecls: Scope)).installAfter(thisTransform)

0 commit comments

Comments
 (0)