Skip to content

Commit 729327b

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 c15cc9c commit 729327b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
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+
transform(Inlines.inlinedUnapply(tree1))
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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1938,7 +1938,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
19381938
if (bounds != null) sym.info = bounds
19391939
}
19401940
b
1941-
case t: UnApply if t.symbol.is(Inline) => Inlines.inlinedUnapply(t)
1941+
case t: UnApply if t.symbol.isAllOf(Transparent | Inline) =>
1942+
// TODO expand once in Applications.scala. We alredy expand it there to get the types of the unapply.
1943+
Inlines.inlinedUnapply(t)
19421944
case t => t
19431945
}
19441946
}

0 commit comments

Comments
 (0)