Skip to content

Infinite compile time with type inference union-typed implicit #830

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

Closed
propensive opened this issue Oct 19, 2015 · 0 comments
Closed

Infinite compile time with type inference union-typed implicit #830

propensive opened this issue Oct 19, 2015 · 0 comments

Comments

@propensive
Copy link
Contributor

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants