Skip to content

Document interaction of implicit resolution and macros #10213

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

Closed
rnd4222 opened this issue Nov 6, 2020 · 1 comment · Fixed by #9984
Closed

Document interaction of implicit resolution and macros #10213

rnd4222 opened this issue Nov 6, 2020 · 1 comment · Fixed by #9984
Assignees
Labels
Milestone

Comments

@rnd4222
Copy link

rnd4222 commented Nov 6, 2020

It is not very clear how implicit resolution works in presence of (possibly failing) macro expansions.

Example:

implicit inline def eqGenInt: Eq[Int] = ${ ... } // throws on expansion, so not actually overlapping
implicit def eqInt: Eq[Int] = new Eq[Int] { ... }

For now it seems that failing expansion is ignored and implicit resolution proceeds to other instances, even if they are "overlapping" (modulo expansion failures).

Can I rely on this behaviour?
If so, it would be great to have it documented somewhere.

@nicolasstucki
Copy link
Contributor

The behavior will slightly change after #9984.

In the current behavior, a failure to expand an implicit inline def when looking for implicit will only let the implicit search know that this is not the implicit it is looking for. Then implicit search continues looking and the error is not emitted.

After #9984 implicit transparent inline def will keep the current behavior. On the other hand, non-transparent ones will finish the implicit search on that method if the signature agrees and then it will emit the error.

@nicolasstucki nicolasstucki linked a pull request Jan 14, 2021 that will close this issue
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants