-
Notifications
You must be signed in to change notification settings - Fork 22
Type inference issue in presence of overloads using varargs #11015
Copy link
Copy link
Closed
scala/scala
#7680Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)has PRvarargs
Milestone
Description
As reported in etorreborre/specs2#687 (comment), overloading resolution does not play well with type inference in the following case:
class X[A] {
def append(a: A): Unit = ()
def append(a: A*): Unit = ()
}
case class Foo[A](value: Int)
val x = new X[Foo[String]]
x.append(Foo(2))
// overloaded method value append with alternatives:
// (a: Playground.this.Foo[String]*)Unit
// (a: Playground.this.Foo[String])Unit
// cannot be applied to (Playground.this.Foo[Nothing])
x.append(Foo[String](2)) // OK if the type parameter of `Foo` is explicitly instantiatedThis could be a problem for us because scala/scala#6879 did introduce such problematic overloads.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)has PRvarargs