-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Implicit value can no longer be accessed via implicit conversion #15670
Comments
That one is as expected. We now refuse to search implicits for type variables that are unknown, and we know that this will refuse to compile some code that compiled before. The reason for the restriction is that there is a latent danger of unboundedly long implicit searches, in particular as programs grow. That's more important than a small expressiveness win. |
Related: #15160 |
I found a similar issue in Compiled for trait Box[E]
trait Domain
def fun[E, D[_] <: Domain](box: Box[E])(implicit domain: D[E]): Unit = {
val newBox: Box[E] = ???
fun(newBox)
} error: [error] ./main.scala:11:14: No given instance of type D[E] was found for parameter domain of method fun
[error]
[error] where: D is a type variable with constraint <: [_] =>> Domain
[error] fun(newBox)
[error] ^ Is this behavior also expected? @odersky |
Probably. It looks similar. We know for sure if it is the same commit that broke it. |
The commit that broke it is the same (db5956b), so it probably is also expected. |
) Two improvements for implicit searches involving type variables. 1. We now always add a comment when an implicit search is rejected due to the "too unspecific" criterion of #13886, commit [Refine checking for underspecified implicit queries](db5956b). There have been quite a few regressions that hit that problem, so it is good to know immediately what the issue is. 2. There is now a better wildcard approximation of higher-kinded type applications. This makes several programs (including original #15998) compile, which were classified as not specific enough before. Fixes #15998 Fixes #15820 Fixes #15670 Fixes #15160 Fixes #13986
Community build regression for https://github.com/giiita/refuel (maintainer @giiita)
Based on Open Community Build #1884
Part of #15647 regressions tracker
Compiler version
Works in 3.1.1
Fails in 3.1.2 and 3.1.3
Fails in 3.2.0-RC* and 3.2.1-RC1-bin-20220711-6efd92d-NIGHTLY
Minimized code
Output
Expectation
Should be able to find correct implicit value by usage of implicit conversion
The text was updated successfully, but these errors were encountered: