Skip to content

Fix #3873: Properly unpickle shared TypeTrees #3874

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1054,8 +1054,12 @@ class TreeUnpickler(reader: TastyReader,
setPos(start, tree)
}

def readTpt()(implicit ctx: Context) =
if (nextByte == SHAREDterm || isTypeTreeTag(nextUnsharedTag)) readTerm()
def readTpt()(implicit ctx: Context): Tree =
if (nextByte == SHAREDterm) {
readByte()
forkAt(readAddr()).readTpt()
}
else if (isTypeTreeTag(nextByte)) readTerm()
else {
val start = currentAddr
val tp = readType()
Expand Down
6 changes: 6 additions & 0 deletions tests/pos/i3873.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
object Test {
inline def sum2(ys: List[Int]): Unit = {
ys.foldLeft(1)
}
val h1: ((List[Int]) => Unit) = sum2
}