Skip to content

Commit 793eaec

Browse files
committed
Don't try to unpickle RHS of deferred inline methods
1 parent 9b0f8b7 commit 793eaec

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ class TreeUnpickler(reader: TastyReader,
774774
def readRhs(implicit ctx: Context): LazyTree =
775775
if (nothingButMods(end))
776776
EmptyTree
777-
else if (sym.isInlineMethod)
777+
else if sym.isInlineMethod && !sym.is(Deferred) then
778778
// The body of an inline method is stored in an annotation, so no need to unpickle it again
779779
new Trees.Lazy[Tree] {
780780
def complete(implicit ctx: Context) = typer.Inliner.bodyToInline(sym)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2336,7 +2336,8 @@ class Typer extends Namer
23362336
val newCtx = if (ctx.owner.isTerm && adaptCreationContext(mdef)) ctx
23372337
else ctx.withNotNullInfos(initialNotNullInfos)
23382338
typed(mdef)(using newCtx) match {
2339-
case mdef1: DefDef if !Inliner.bodyToInline(mdef1.symbol).isEmpty =>
2339+
case mdef1: DefDef
2340+
if mdef1.symbol.is(Inline, butNot = Deferred) && !Inliner.bodyToInline(mdef1.symbol).isEmpty =>
23402341
buf ++= inlineExpansion(mdef1)
23412342
// replace body with expansion, because it will be used as inlined body
23422343
// from separately compiled files - the original BodyAnnotation is not kept.

0 commit comments

Comments
 (0)