-
Notifications
You must be signed in to change notification settings - Fork 1.1k
transparent implicit conversion macro not emitting the proper error #12429
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
I think this is a feature, not a bug as explained in #12409 (comment), if a transparent implicit fails with an error, it's not considered a valid implicit for the current implicit search (because we can't type it), the alternative would be to always consider such implicits as matching, but that could easily lead to ambiguous implicit errors when multiple transparent implicits are in scope. |
What is the difference with a non-transparent inline implicit conversion or a transparent non-macro iniline conversion? |
And even if we consider this a "feature", I think the proper behavior would be to look at the implicit candidates:
|
By the rules of implicit search an implicit is applicable only if its application can be typed. For a transparent implicit, typing the application means typing the expansion. That explains the behavior, and I think that behavior is reasonable. So I also think there's nothing to fix here. |
Then why does
This behavior is different than Scala 2 whitebox macros (meaning, that if I use |
There is a simple workaround (that was suggested on a different issue by @nicolasstucki and works here), by changing
to
Given this simple workaround, and given that the brains behind Scala think this is the proper behavior, I'm closing this issue. |
Among various inlining and macro usages, only transparent macro does not emit the error message reported inside.
Compiler version
3.0 master branch
Minimized code
Main code:
Test code:
Output
Expectation
The last error should be "transparentMacroConversionError", instead of the type mismatch error.
Note: the transparent macro errors are emitted first. Once commented out, we can see the other errors properly emitted.
The text was updated successfully, but these errors were encountered: