diff --git a/compiler/src/dotty/tools/dotc/typer/Inliner.scala b/compiler/src/dotty/tools/dotc/typer/Inliner.scala index 70f6718de2da..0c5fe4c845eb 100644 --- a/compiler/src/dotty/tools/dotc/typer/Inliner.scala +++ b/compiler/src/dotty/tools/dotc/typer/Inliner.scala @@ -326,15 +326,18 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) { } computeParamBindings(tp.resultType, Nil, argss) case tp: MethodType => - assert(argss.nonEmpty, i"missing bindings: $tp in $call") - tp.paramNames.lazyZip(tp.paramInfos).lazyZip(argss.head).foreach { (name, paramtp, arg) => - paramSpan(name) = arg.span - paramBinding(name) = arg.tpe.dealias match { - case _: SingletonType if isIdempotentPath(arg) => arg.tpe - case _ => paramBindingDef(name, paramtp, arg, bindingsBuf).symbol.termRef + if argss.isEmpty then + // can happen if arguments have errors, see i7438.scala + ctx.error(i"mising arguments for inline method $inlinedMethod", call.sourcePos) + else + tp.paramNames.lazyZip(tp.paramInfos).lazyZip(argss.head).foreach { (name, paramtp, arg) => + paramSpan(name) = arg.span + paramBinding(name) = arg.tpe.dealias match { + case _: SingletonType if isIdempotentPath(arg) => arg.tpe + case _ => paramBindingDef(name, paramtp, arg, bindingsBuf).symbol.termRef + } } - } - computeParamBindings(tp.resultType, targs, argss.tail) + computeParamBindings(tp.resultType, targs, argss.tail) case _ => assert(targs.isEmpty) assert(argss.isEmpty) diff --git a/tests/neg/i7438.scala b/tests/neg/i7438.scala new file mode 100644 index 000000000000..c9e74ae31f5a --- /dev/null +++ b/tests/neg/i7438.scala @@ -0,0 +1,9 @@ +type Tr[+A] +inline def (tr: Tr[A]) map[A, B](f: A => B): Tr[B] = ??? + +def (d: Double) func: None.type => Some[Double] = ??? + +def run[A](query: None.type => Some[A]): Some[A] = ??? + +val noBug = run(3.14 func) map (x => x) +val buggy = run(3.14 func map (x => x)) // error: missing parameter type \ No newline at end of file