Skip to content

Commit c2e5011

Browse files
authored
Merge pull request #3874 from dotty-staging/fix-shared-tpt-again
Fix #3873: Properly unpickle shared TypeTrees
2 parents ade92c6 + 47e604d commit c2e5011

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -1054,8 +1054,12 @@ class TreeUnpickler(reader: TastyReader,
10541054
setPos(start, tree)
10551055
}
10561056

1057-
def readTpt()(implicit ctx: Context) =
1058-
if (nextByte == SHAREDterm || isTypeTreeTag(nextUnsharedTag)) readTerm()
1057+
def readTpt()(implicit ctx: Context): Tree =
1058+
if (nextByte == SHAREDterm) {
1059+
readByte()
1060+
forkAt(readAddr()).readTpt()
1061+
}
1062+
else if (isTypeTreeTag(nextByte)) readTerm()
10591063
else {
10601064
val start = currentAddr
10611065
val tp = readType()

tests/pos/i3873.scala

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
object Test {
2+
inline def sum2(ys: List[Int]): Unit = {
3+
ys.foldLeft(1)
4+
}
5+
val h1: ((List[Int]) => Unit) = sum2
6+
}

0 commit comments

Comments
 (0)