Skip to content

Commit fee0287

Browse files
committed
Inline unapplys in the inlining phase
These currently got inlined while typing. Therefore they used to generate code that should not be pickled.
1 parent 7dc4d3d commit fee0287

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

compiler/src/dotty/tools/dotc/transform/Inlining.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ class Inlining extends MacroTransform, IdentityDenotTransformer {
9090
else super.transform(tree)
9191
case _: Typed | _: Block =>
9292
super.transform(tree)
93+
case tree: UnApply =>
94+
tree match
95+
case tree1: UnApply if Inlines.needsInlining(tree1) =>
96+
super.transform(cpy.UnApply(tree1)(fun = Inlines.inlinedUnapplyFun(tree1.fun)))
97+
case tree1 => super.transform(tree1)
9398
case _ if Inlines.needsInlining(tree) =>
9499
val tree1 = super.transform(tree)
95100
if tree1.tpe.isError then tree1

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1942,9 +1942,6 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
19421942
if (bounds != null) sym.info = bounds
19431943
}
19441944
b
1945-
case t: UnApply if t.symbol.is(Inline) =>
1946-
assert(!t.symbol.is(Transparent))
1947-
cpy.UnApply(t)(fun = Inlines.inlinedUnapplyFun(t.fun)) // TODO inline these in the inlining phase (see #19382)
19481945
case t => t
19491946
}
19501947
}

0 commit comments

Comments
 (0)