From a5856a40a739f0f1f342063b3da23a990105d847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Doeraene?= Date: Tue, 5 Mar 2024 10:03:52 +0100 Subject: [PATCH] Revert "Fix i19859" --- .../tools/dotc/core/tasty/TreePickler.scala | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala index 7d2d95aa9601..def27742c189 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala @@ -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) =>