Skip to content

fix #8925: check for NamedArg when inserting implicit arguments #9122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
17 changes: 17 additions & 0 deletions tests/neg/i8925.scala
Original file line number Diff line number Diff line change
@@ -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
}
}
17 changes: 17 additions & 0 deletions tests/pos/i8925.scala
Original file line number Diff line number Diff line change
@@ -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]())
}
}