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
improve diagnostic error for diverging implicit expansion #8454
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8454?orig=1 |
@retronym said:
|
@dlwh said: |
@retronym said (edited on Apr 4, 2014 1:22:05 PM UTC): @dlwh The compiler is supposed to tolerate one divergent path in the implicit search. If a second path is found, it can abort the search. The implementation of this is a touch buggy and can sometimes explore a bit further, but that's the intent. The implicit search space is explored in an order driven by the specificity of the candidates. The rules are analagous to those of static overload resolution. The levers are pretty crude, but you can deprioritize an implicit by putting it in a superclass of a the one that defined a competing implicit. This criteria is used to determine a winner if we have multiple eligible results. With this in mind, the compiler can pre-sort candidates based on the specificity, and avoid exploring less specific candidates if a more-specific result has already been found. See the neg and pos examples from this commit [1] for an example of how to use this to avoid divergence. Here's an example of how to use this to speedup implicit search [2]. [1] https://github.com/retronym/scala/tree/ticket/8460-3 |
@dlwh said: |
@retronym said: |
@dlwh said: |
@dlwh said: I hit another one of these that I couldn't figure out and thought I might try out your branch for tracking it down. Is it in a state where it might be usable? Thanks! |
Any recommendation on this? I've asked the same question for splain plugin (merged in scala 2.13.6), still no one has figured out how to do it with the latest compiler |
WIP: https://github.com/retronym/scala/compare/topic;diverging-explain?expand=1
example:
We could also display the corresponding complexity scores calculated in
dominates
.https://twitter.com/dlwh/status/412474285806993408
http://stackoverflow.com/questions/20566469/log-implicits-only-for-diverging-implicit-expansions
https://twitter.com/mapastr/status/449209695149236224
https://twitter.com/mnnakamura/status/434538504282861568
https://twitter.com/nlehuen/status/237494434634297345
http://stackoverflow.com/questions/7950014/whats-a-diverging-implicit-expansion-scalac-message-mean
The text was updated successfully, but these errors were encountered: