Closed
Description
The following appears to send the compiler into an infinite loop, but only when the return type of x
is used to infer the type parameter of the call to y
:
object C {
trait X[T]
implicit def u[A, B]: X[A | B] = new X[A | B] {}
def y[T](implicit x: X[T]): T = ???
val x: 1 & 2 | 2 & 3 = y
}
My guess is that the interaction between the type inference of y
's parameter T
and implicit search is underconstrained. The type expression (1 & 2 | 2 & 3
) must contain at least one repeated type (here, 2
).