Skip to content

Commit 1ccee1f

Browse files
committed
TreeUnpickler: Avoid capturing context in lazyStats
`lazyStats` creates a lazy tree using `readLater`, but the closure inside `readLater` calls `mergeTypeParamsAndAliases` which until this commit implicitly used the Context from the outer method `readTemplate`, this lead to crashes in the Language Server.
1 parent 09d2bf7 commit 1ccee1f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle
769769
cls.setApplicableFlags(fork.indexStats(end))
770770
val constr = readIndexedDef().asInstanceOf[DefDef]
771771

772-
def mergeTypeParamsAndAliases(tparams: List[TypeDef], stats: List[Tree]): (List[Tree], List[Tree]) =
772+
def mergeTypeParamsAndAliases(tparams: List[TypeDef], stats: List[Tree])(implicit ctx: Context): (List[Tree], List[Tree]) =
773773
(tparams, stats) match {
774774
case (tparam :: tparams1, (alias: TypeDef) :: stats1)
775775
if tparam.name == alias.name.expandedName(cls) =>

0 commit comments

Comments
 (0)