From 183bcd3baabe846eca8e99338e96985080440228 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 22 Jan 2020 17:27:44 +0100 Subject: [PATCH] Fix #8050: Make isInlineable force less The isInleable test forced the inline body. This causes problem if the inline body is currently typechecked. --- compiler/src/dotty/tools/dotc/typer/Inliner.scala | 2 +- tests/neg/i8050.scala | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 tests/neg/i8050.scala diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala index db5359869706..2e63cdb8d9da 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala @@ -50,7 +50,7 @@ object Inliner { /** Should call to method `meth` be inlined in this context? */ def isInlineable(meth: Symbol)(implicit ctx: Context): Boolean = - meth.is(Inline) && !ctx.inInlineMethod && !bodyToInline(meth).isEmpty + meth.is(Inline) && meth.hasAnnotation(defn.BodyAnnot) && !ctx.inInlineMethod /** Should call be inlined in this context? */ def isInlineable(tree: Tree)(implicit ctx: Context): Boolean = tree match { diff --git a/tests/neg/i8050.scala b/tests/neg/i8050.scala new file mode 100644 index 000000000000..8b72b09bc275 --- /dev/null +++ b/tests/neg/i8050.scala @@ -0,0 +1,5 @@ +object stuff with + def exec(dir: Int) = ??? + +extension on (a: Int) with + inline def exec: Unit = stuff.exec("aaa") // error