Skip to content
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

Check that right hand sides of implicit defs don't loop (directly) #13589

Merged
merged 2 commits into from Sep 28, 2021

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Sep 22, 2021

Fixes #13542

Copy link
Contributor

@Kordyjan Kordyjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks correct.
I was concerned that we are checking for the direct recurrsion not only in the implicit defs but also in given instances with context parameters. However, I wasn't able to find any example of code that would give a false positive warning. So as far as I can tell it is a proper fix.

@Kordyjan Kordyjan merged commit 156e1c4 into scala:master Sep 28, 2021
@Kordyjan Kordyjan deleted the fix-13542 branch September 28, 2021 12:36
if !t.symbol.is(Lazy) then checkNotLooping(t.rhs)
case _ =>

if sym.isOneOf(GivenOrImplicit) then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to not extend this to non-implicit definitions too? It would help with extension methods too for example: #9880

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unintended recursive implicit conversion
3 participants