diff --git a/compiler/src/dotty/tools/dotc/typer/Typer.scala b/compiler/src/dotty/tools/dotc/typer/Typer.scala index b89d878e03c1..d7b0753bf288 100644 --- a/compiler/src/dotty/tools/dotc/typer/Typer.scala +++ b/compiler/src/dotty/tools/dotc/typer/Typer.scala @@ -3058,6 +3058,8 @@ class Typer extends Namer else tree match { case tree: Block => readaptSimplified(tpd.Block(tree.stats, tpd.Apply(tree.expr, args))) + case tree: NamedArg => + readaptSimplified(tpd.NamedArg(tree.name, tpd.Apply(tree.arg, args))) case _ => readaptSimplified(tpd.Apply(tree, args)) } diff --git a/tests/neg/i8925.scala b/tests/neg/i8925.scala new file mode 100644 index 000000000000..3467a0ca3ca8 --- /dev/null +++ b/tests/neg/i8925.scala @@ -0,0 +1,17 @@ +trait Parent { + type Child +} + +object Demo { + def params(arr: Int): Int = ??? + + def parametersOf[Parent, T]()(using m: String): Int = 0 + + def combineInternal(using p: Parent): Int = { + //this implicit needs to be available + implicit val s: String = "" + + //parameter needs to be named + params(arr = parametersOf[Parent, p.Child]) // error: method parametersOf must be called with () argument + } +} diff --git a/tests/pos/i8925.scala b/tests/pos/i8925.scala new file mode 100644 index 000000000000..2a97c88937c1 --- /dev/null +++ b/tests/pos/i8925.scala @@ -0,0 +1,17 @@ +trait Parent { + type Child +} + +object Demo { + def params(arr: Int): Int = ??? + + def parametersOf[Parent, T]()(using m: String): Int = 0 + + def combineInternal(using p: Parent): Int = { + //this implicit needs to be available + implicit val s: String = "" + + //parameter needs to be named + params(arr = parametersOf[Parent, p.Child]()) + } +}