Skip to content

Commit 409a9f5

Browse files
committed
Scala2Unpickler: fix symbol entering inside refinement classes
`finishSym` contains a few conditions determining when a symbol should not be entered into scope, but these were not checked when the owner of the symbol is a refinement class. When compiling stainless this lead to a compiler crash because of a refinement type containing another refinement type.
1 parent 3100b7c commit 409a9f5

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -467,16 +467,13 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
467467

468468
def finishSym(sym: Symbol): Symbol = {
469469
if (sym.isClass) sym.setFlag(Scala2x)
470-
val owner = sym.owner
471-
if (owner.isClass &&
472-
!( isUnpickleRoot(sym)
473-
|| (sym is Scala2Existential)
474-
|| isRefinementClass(sym)
475-
)
476-
)
477-
owner.asClass.enter(sym, symScope(owner))
478-
else if (isRefinementClass(owner))
479-
symScope(owner).openForMutations.enter(sym)
470+
if (!(isRefinementClass(sym) || isUnpickleRoot(sym) || (sym is Scala2Existential))) {
471+
val owner = sym.owner
472+
if (owner.isClass)
473+
owner.asClass.enter(sym, symScope(owner))
474+
else if (isRefinementClass(owner))
475+
symScope(owner).openForMutations.enter(sym)
476+
}
480477
sym
481478
}
482479

0 commit comments

Comments
 (0)