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