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
java-defined static overloaded polymorphic method is hosed #7209
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7209?orig=1 |
Juha Heljoranta (p52mm3x) said: class S {
def s[T](x: Traversable[_ <: T]): Seq[T] = ???
def s[T](x: Iterable[_ <: T]): Seq[T] = ???
s[Int](Vector(1)) // ok
s(Vector(1)) // fail
} <console>:11: error: ambiguous reference to overloaded definition,
both method s in class S of type [T](x: Iterable[_ <: T])Seq[T]
and method s in class S of type [T](x: Traversable[_ <: T])Seq[T]
match argument types (scala.collection.immutable.Vector[Int])
s(Vector(1)) // fail
^ |
@retronym said (edited on Jun 26, 2013 9:49:55 AM UTC):
|
@retronym said:
Without explicit type arguments, the compiler chooses between [T](x: Traversable[_ <: T])Seq[T] and [U](x: Iterable[_ <: U])Seq[U]. I've changed the type parameter names to distinguish them. They are unrelated types, so neither function has parameters of types that are applicable to the other. |
Ignoring the fact that I have to give the type argument explicitly and annotate the type in great detail, it's safely a bug that it works once and then blows up from that point forward. (How do we even have bugs like that, what is hanging onto such state?)
The text was updated successfully, but these errors were encountered: