Open smarter opened 3 weeks ago
a2c53a16770ffb1d2f3929b74824402300c612eb
(Minimized from the two map methods in https://github.com/aherlihy/tyql/blob/expr-shape/src/main/scala/repro/overloadedmap.scala that lead to q2 not compiling).
map
q2
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
10 | val x2: (List[Int], List[String]) = foo(tup) | ^^^ | Found: (Test.tup : (Int, String)) | Required: Option[(List[Int], List[String])]
x2 should behave like x: overloading resolution should end up using the second overload since the first is clearly not appicable.
x2
x
The overloading changes in https://github.com/scala/scala3/pull/20054 do not have an impact on this issue (/cc @EugeneFlesselle).
Minimized a bit further:
class A type F[X] <: Any = X match case A => Int def foo[T](x: String): T = ??? def foo[U](x: U): F[U] = ??? val x1 = foo(A()) val y: Int = x1 val x2: Int = foo(A()) // error
Compiler version
a2c53a16770ffb1d2f3929b74824402300c612eb
Minimized code
(Minimized from the two
map
methods in https://github.com/aherlihy/tyql/blob/expr-shape/src/main/scala/repro/overloadedmap.scala that lead toq2
not compiling).Output
Expectation
x2
should behave likex
: overloading resolution should end up using the second overload since the first is clearly not appicable.The overloading changes in https://github.com/scala/scala3/pull/20054 do not have an impact on this issue (/cc @EugeneFlesselle).