-
Notifications
You must be signed in to change notification settings - Fork 21
unhelpful existentials refuse to get out of the way #8936
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
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8936?orig=1 |
@paulp said: |
@paulp said: implicit class Foo[A](x: A) { def bar[A1 >: A](f: A => Seq[A1]) = f(x) } The problem is that this method is called repeatedly/recursively. |
@retronym said (edited on Nov 1, 2014 12:15:49 PM UTC): trait C[A] { def bar(f: A => A) }
trait M[A] { def m: M[Y] forSome { type Y } = ??? }
object Test {
def c[A](a: A): C[A] = ???
def x1(m: M[Int]) = c/*[M[Int]]]*/(m).bar(_.m) // found M[Y] where type Y, required M[Int]
def x2(m: M[Int]) = c/*[M[X]]]*/(m : M[X] forSome { type X }).bar(_.m) //found M[Y] where type Y, required M[X] where type X
def x3(m: M[Int]) = c[M[Z] forSome {type Z}](m).bar(_.m)
} I don't believe that you can provide an argument to method |
@paulp said: It seems you are correct. It would need to leave some slack in the first type inferred for the second one ever to conform to it. |
Another in the thrilling series of language features which require the application of rocket science just to get them to leave you alone. All I want is the class object, must it be so hard? See also #8039 for what is in some sense the dual nightmare.
The text was updated successfully, but these errors were encountered: