Skip to content

Commit 4fdb20c

Browse files
committed
Only inline unapply methods in typer if is transparent
1 parent 3b1d780 commit 4fdb20c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/src/dotty/tools/dotc/inlines/Inlines.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ object Inlines:
200200
// and its type parameters are instantiated.
201201
val unapplySym = newSymbol(cls, sym.name.toTermName, Synthetic | Method, fun.tpe.widen, coord = sym.coord).entered
202202
val unapply = DefDef(unapplySym.asTerm, argss =>
203-
inlineCall(fun.appliedToArgss(argss).withSpan(unapp.span))(using ctx.withOwner(unapplySym))
203+
val body = fun.appliedToArgss(argss).withSpan(unapp.span)
204+
if body.symbol.is(Transparent) then inlineCall(body)(using ctx.withOwner(unapplySym))
205+
else body
204206
)
205207
unapplySym1 = unapplySym
206208
List(unapply)

0 commit comments

Comments
 (0)