From b7574813d00d7b42b9002cb698712d927ee12600 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Fri, 5 Jan 2024 14:47:32 +0100 Subject: [PATCH] Inline `unapply`s in the inlining phase These currently got inlined while typing. Therefore they used to generate code that should not be pickled. --- compiler/src/dotty/tools/dotc/transform/Inlining.scala | 5 +++++ compiler/src/dotty/tools/dotc/typer/Typer.scala | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/transform/Inlining.scala b/compiler/src/dotty/tools/dotc/transform/Inlining.scala index 907fe948ac30..60d13066a75a 100644 --- a/compiler/src/dotty/tools/dotc/transform/Inlining.scala +++ b/compiler/src/dotty/tools/dotc/transform/Inlining.scala @@ -90,6 +90,11 @@ class Inlining extends MacroTransform, IdentityDenotTransformer { else super.transform(tree) case _: Typed | _: Block => super.transform(tree) + case tree: UnApply => + tree match + case tree1: UnApply if Inlines.needsInlining(tree1) => + transform(Inlines.inlinedUnapply(tree1)) + case tree1 => super.transform(tree1) case _ if Inlines.needsInlining(tree) => val tree1 = super.transform(tree) if tree1.tpe.isError then tree1 diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 2f03c79754e8..0d73dd8ef655 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -1938,7 +1938,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer if (bounds != null) sym.info = bounds } b - case t: UnApply if t.symbol.is(Inline) => Inlines.inlinedUnapply(t) case t => t } }