Hi so I have a trait with generics +T and +U.
def test[I >: T, V >: U](e: Traversable[I], f: V)
def test[I >: T, V >: U](e: (Traversable[I], V))
def test[I >: T, V >: U](e: Tuple2[Traversable[I], V])
The first one works fine. The last 2 however both spit out:
type mismatch;
[error] found : (String, Int)
[error] required: (Traversable[?], ?)
Why can scala not infer the types in the 2nd and 3rd examples? What am I missing?
Thanks
This looks like a compiler bug to me. I don't see a reason why it can convert String to Traversable in the first case but not the other two cases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With