Skip to content

Fix #5488: properly unpickle RecTypes #5514

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
Nov 25, 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: 7 additions & 1 deletion compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,13 @@ class TreeUnpickler(reader: TastyReader,
case THIS =>
ThisType.raw(readType().asInstanceOf[TypeRef])
case RECtype =>
typeAtAddr.getOrElse(start, RecType(rt => registeringType(rt, readType())))
typeAtAddr.get(start) match {
case Some(tp) =>
skipTree(tag)
tp
case None =>
RecType(rt => registeringType(rt, readType()))
}
case RECthis =>
readTypeRef().asInstanceOf[RecType].recThis
case TYPEALIAS =>
Expand Down
3 changes: 3 additions & 0 deletions compiler/test/dotc/pos-decompilation.blacklist
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ tcpoly_checkkinds_mix.scala
i3050.scala
i4006b.scala
i4006c.scala

# Decompiling RecThis as "this" is incorrect
avoid.scala
7 changes: 7 additions & 0 deletions tests/pos/avoid.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ object test {
val z: String = x.y
}

trait M

// A tricky case involving inner classes, exercised
// in the large in dotty.tools.dotc.core.NameKinds.scala.
object Test2 {
Expand All @@ -24,4 +26,9 @@ object Test2 {
class C extends NK { type T = I }
new C
}

val z = {
class C extends NK { type T = I }
new C with M
}
}