Closed
Description
Compiler version
Minimized code
(Minimized from the two map
methods in https://github.com/aherlihy/tyql/blob/10401e8162f59543a6fe1b960d449f72c409612a/src/main/scala/repro/overloadedmap.scala that lead to q2
not compiling).
object Test:
def foo[T](x: Option[T]): T = ???
def foo[T <: Tuple](x: T): Tuple.Map[T, List] = ???
val tup: (Int, String) = (1, "")
val x = foo(tup)
val y: (List[Int], List[String]) = x
val x2: (List[Int], List[String]) = foo(tup) // error
Output
10 | val x2: (List[Int], List[String]) = foo(tup)
| ^^^
| Found: (Test.tup : (Int, String))
| Required: Option[(List[Int], List[String])]
Expectation
x2
should behave like x
: overloading resolution should end up using the second overload since the first is clearly not appicable.
The overloading changes in #20054 do not have an impact on this issue (/cc @EugeneFlesselle).