diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala index 968d93537d70..5319af6b97a2 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala @@ -255,8 +255,13 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) { * @param arg the argument corresponding to the parameter * @param bindingsBuf the buffer to which the definition should be appended */ - private def paramBindingDef(name: Name, paramtp: Type, arg: Tree, + private def paramBindingDef(name: Name, paramtp: Type, arg0: Tree, bindingsBuf: mutable.ListBuffer[ValOrDefDef])(implicit ctx: Context): ValOrDefDef = { + val arg = arg0 match { + case Typed(arg1, tpt) if tpt.tpe.isRepeatedParam && arg1.tpe.derivesFrom(defn.ArrayClass) => + wrapArray(arg1, arg0.tpe.elemType) + case _ => arg0 + } val argtpe = arg.tpe.dealiasKeepAnnots val isByName = paramtp.dealias.isInstanceOf[ExprType] var inlineFlags: FlagSet = InlineProxy diff --git a/tests/run/i6858.scala b/tests/run/i6858.scala new file mode 100644 index 000000000000..d849e91733f1 --- /dev/null +++ b/tests/run/i6858.scala @@ -0,0 +1,10 @@ +object Test extends App { + inline def foo(ys: Int*): Unit = bar(ys: _*) + def bar(ys: Int*) = () + + val xs: Array[Int] = new Array[Int](3) + foo(xs: _*) + + val ys: Seq[Int] = new Array[Int](3) + foo(ys: _*) +}