From 793eaec4ff11ad8bdf611eac19c6ec1e6ff94335 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 17 Mar 2020 13:31:17 +0100 Subject: [PATCH] Don't try to unpickle RHS of deferred inline methods --- compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala | 2 +- compiler/src/dotty/tools/dotc/typer/Typer.scala | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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.