-
Notifications
You must be signed in to change notification settings - Fork 21
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
Regression in implicit resolution #8065
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8065?orig=1 |
@retronym said (edited on Dec 10, 2013 4:38:39 PM UTC): trait E1[T] {
def f(that: T) = ()
}
class E2[R, C] extends E1[E2[R, C]]
object MyApp {
implicit def int2string(value: Int): String = ???
implicit def coef2rf[D, R, C](value: D)(implicit ev: D => C): E1[E2[R, C]] = ???
def test: Unit = {
val y: E2[E1[String], String] = ???
val i: Int = 0
i.f(y)
i.f(y) // chokes on the second occurence only (!)
()
}
} |
@xeno-by said: |
@retronym said: The order that implicit candidates are tried is dynamic based on frequency of applicability. See: // Implicits.scala
// most frequent one first
val sorted = matches sortBy (x => if (isView) -x.useCountView else -x.useCountArg) |
@adriaanm said: I'm sorry, but we're out of time for 2.11. I'll leave it open for a couple more days, but, unless I'm missing something, I think we should anticipate closing this as won't fix. trait E1[T] {
def f(that: T) = ()
}
class E2[R, C] extends E1[E2[R, C]]
trait Lower {
implicit def int2string(value: Int): String = ???
}
object MyApp extends Lower{
implicit def coef2rf[D, R, C](value: D)(implicit ev: D => C): E1[E2[R, C]] = ???
def test: Unit = {
val y: E2[E1[String], String] = ???
val i: Int = 0
i.f(y)
i.f(y) // chokes on the second occurence only (!)
()
}
} |
@rjolly said (edited on Feb 17, 2014 8:19:46 AM UTC):
In support of 1), removing sortBy does not fix compilation failure on the first occurrence (i.e. when int2string is moved after coef2rf). It does fix failure on the second occurence. Regarding my code, I have found a workaround of my own, but yours may be good too, I have to check it. Still, I think this bug (the original one, causing failure on the second identical line) is worth fixing (and simple to fix, see scala/scala#3408 about how removing sortBy has no effect on performance). Hence I have created a new pull request scala/scala#3540 |
@adriaanm said: |
@rjolly said: |
@adriaanm said (edited on Feb 18, 2014 7:52:43 PM UTC): |
@rjolly said: |
seems to have been resolved by 2.11.0:
and remains resolved in 2.13.16 |
Indeed, I think we can close the ticket then. Thanks for checking! |
It was working in 2.11.0-M6 and previous.
The text was updated successfully, but these errors were encountered: