Skip to content

Commit

Permalink
Inline unapplys in the inlining phase
Browse files Browse the repository at this point in the history
These currently got inlined while typing. Therefore they used to generate
code that should not be pickled.
  • Loading branch information
nicolasstucki committed Feb 8, 2024
1 parent 551eae4 commit 75a9813
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 5 additions & 0 deletions compiler/src/dotty/tools/dotc/transform/Inlining.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
super.transform(cpy.UnApply(tree1)(fun = Inlines.inlinedUnapplyFun(tree1.fun)))
case tree1 => super.transform(tree1)
case _ if Inlines.needsInlining(tree) =>
val tree1 = super.transform(tree)
if tree1.tpe.isError then tree1
Expand Down
3 changes: 0 additions & 3 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1937,9 +1937,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
}
}
Expand Down

0 comments on commit 75a9813

Please sign in to comment.