diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index e4f2772ed960..42dec06f89c2 100644 --- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -774,7 +774,7 @@ class TreeUnpickler(reader: TastyReader, def readRhs(implicit ctx: Context): LazyTree = if (nothingButMods(end)) EmptyTree - else if (sym.isInlineMethod) + else if sym.isInlineMethod && !sym.is(Deferred) then // The body of an inline method is stored in an annotation, so no need to unpickle it again new Trees.Lazy[Tree] { def complete(implicit ctx: Context) = typer.Inliner.bodyToInline(sym) diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index 394b1cec1a37..8425f234af1d 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -2336,7 +2336,8 @@ class Typer extends Namer val newCtx = if (ctx.owner.isTerm && adaptCreationContext(mdef)) ctx else ctx.withNotNullInfos(initialNotNullInfos) typed(mdef)(using newCtx) match { - case mdef1: DefDef if !Inliner.bodyToInline(mdef1.symbol).isEmpty => + case mdef1: DefDef + if mdef1.symbol.is(Inline, butNot = Deferred) && !Inliner.bodyToInline(mdef1.symbol).isEmpty => buf ++= inlineExpansion(mdef1) // replace body with expansion, because it will be used as inlined body // from separately compiled files - the original BodyAnnotation is not kept.