diff options
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Inliner.scala | 2 | ||||
-rw-r--r-- | tests/run/i1569.check | 2 | ||||
-rw-r--r-- | tests/run/i1569.scala | 5 |
3 files changed, 8 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala index 09487570d..cfc0003c6 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala @@ -327,7 +327,7 @@ class Inliner(call: tpd.Tree, rhs: tpd.Tree)(implicit ctx: Context) { (tp.paramNames, tp.paramTypes, argss.head).zipped.foreach { (name, paramtp, arg) => def isByName = paramtp.dealias.isInstanceOf[ExprType] paramBinding(name) = arg.tpe.stripAnnots.stripTypeVar match { - case argtpe: SingletonType if isByName || isIdempotentExpr(arg) => argtpe + case argtpe: SingletonType if isIdempotentExpr(arg) => argtpe case argtpe => val inlineFlag = if (paramtp.hasAnnotation(defn.InlineParamAnnot)) Inline else EmptyFlags val (bindingFlags, bindingType) = diff --git a/tests/run/i1569.check b/tests/run/i1569.check new file mode 100644 index 000000000..0d55bed3a --- /dev/null +++ b/tests/run/i1569.check @@ -0,0 +1,2 @@ +foo +foo diff --git a/tests/run/i1569.scala b/tests/run/i1569.scala new file mode 100644 index 000000000..2c5dd4e5a --- /dev/null +++ b/tests/run/i1569.scala @@ -0,0 +1,5 @@ +object Test { + inline def foo(inline n: => Int) = n + n + + def main(args: Array[String]): Unit = foo({ println("foo"); 42 }) +} |