Skip to content

Revert "Fix i19859" #19880

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

Closed
wants to merge 1 commit into from
Closed
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
24 changes: 11 additions & 13 deletions compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -405,21 +405,19 @@ class TreePickler(pickler: TastyPickler, attributes: Attributes) {
pickleType(tp)
}
case This(qual) =>
// This may be needed when pickling a `This` inside a capture set. See #19662 and #19859.
// In this case, we pickle the tree as null.asInstanceOf[tree.tpe].
// Since the pickled tree is not the same as the input, special handling is needed
// in the tree printer when testing the pickler. See [[PlainPrinter#homogenize]].
inline def pickleCapturedThis =
pickleTree(Literal(Constant(null)).cast(tree.tpe).withSpan(tree.span))
if (qual.isEmpty)
if tree.tpe.isSingleton then pickleType(tree.tpe)
else pickleCapturedThis
else
tree.tpe match
case ThisType(tref) =>
writeByte(QUALTHIS)
pickleTree(qual.withType(tref))
case _ => pickleCapturedThis
else
// This may happen when pickling a `This` inside a capture set. See #19662.
// In this case, we pickle the tree as null.asInstanceOf[tree.tpe].
// Since the pickled tree is not the same as the input, special handling is needed
// in the tree printer when testing the pickler. See [[PlainPrinter#homogenize]].
pickleTree(Literal(Constant(null)).cast(tree.tpe).withSpan(tree.span))
else {
writeByte(QUALTHIS)
val ThisType(tref) = tree.tpe: @unchecked
pickleTree(qual.withType(tref))
}
case Select(qual, name) =>
name match {
case OuterSelectName(_, levels) =>
Expand Down