diff --git a/compiler/src/dotty/tools/dotc/transform/Inlining.scala b/compiler/src/dotty/tools/dotc/transform/Inlining.scala index 907fe948ac30..94df114290e4 100644 --- a/compiler/src/dotty/tools/dotc/transform/Inlining.scala +++ b/compiler/src/dotty/tools/dotc/transform/Inlining.scala @@ -90,10 +90,6 @@ class Inlining extends MacroTransform, IdentityDenotTransformer { else super.transform(tree) case _: Typed | _: Block => super.transform(tree) - case _ if Inlines.needsInlining(tree) => - val tree1 = super.transform(tree) - if tree1.tpe.isError then tree1 - else Inlines.inlineCall(tree1) case _: PackageDef => super.transform(tree) match case tree1: PackageDef => @@ -106,6 +102,15 @@ class Inlining extends MacroTransform, IdentityDenotTransformer { case tree1 => tree1 case _ => if tree.isType then tree + else if Inlines.needsInlining(tree) then + tree match + case tree: UnApply => + val fun1 = Inlines.inlinedUnapplyFun(tree.fun) + super.transform(cpy.UnApply(tree)(fun = fun1)) + case _ => + val tree1 = super.transform(tree) + if tree1.tpe.isError then tree1 + else Inlines.inlineCall(tree1) else super.transform(tree) } } diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 0b05bcd078ff..17329dd57f4b 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -1956,9 +1956,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer if (bounds != null) sym.info = bounds } b - case t: UnApply if t.symbol.is(Inline) => - assert(!t.symbol.is(Transparent)) - cpy.UnApply(t)(fun = Inlines.inlinedUnapplyFun(t.fun)) // TODO inline these in the inlining phase (see #19382) case t => t } }