-
Notifications
You must be signed in to change notification settings - Fork 1.1k
transparent inline implicit conversion def is called again and again #12394
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
We probably do exactly the same queries for trait Bla[Of]:
val value : Of
type X
object Bla :
import scala.quoted.*
implicit def conv[Of, From](from : From)(using X): Bla[Of] =
??? the difference is that we cannot observe them as users. |
No, it only happens with transparent. If you remove the transparent and just leave it as |
The transparent macro gets executed only once if the compiler is run with So I think the import suggestion mechanism needs to be more careful to avoid chaining implicit conversions (or even not suggest implicit conversions at all since they're such a big source of issues), but in general if your macro is transparent, you can't control how many times it's going to be executed by the compiler since the typechecker will sometimes backtrack and by definition we need to execute the macro to get its result type. |
I think chaining is OK, as long as the conversion gets wider and wider and as a result, it is OK that there will be macro renentries. But the current search is completely irrelevant. |
Scala has never supported chaining implicit conversions. |
Compiler version
v3.0.0-RC3
Minimized code
Main code:
Test code:
Output
Expectation
After the error I think the conversion should give up, but even if not, it shouldn't go through all these weird retries. At most it should attempt to widen the value. This only happens if the inline is transparent.
The text was updated successfully, but these errors were encountered: