Skip to content

Commit

Permalink
Don't try to unpickle RHS of deferred inline methods
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Mar 17, 2020
1 parent 9b0f8b7 commit 793eaec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Expand Up @@ -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.
Expand Down

0 comments on commit 793eaec

Please sign in to comment.