-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fixed Missing warning for invalid recursive val #14598
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
Conversation
Also #12943 which already seems to be fixed. |
@@ -83,7 +83,7 @@ class CheckLoopingImplicits extends MiniPhase: | |||
checkNotLooping(t.rhs) | |||
case _ => | |||
|
|||
if sym.isOneOf(GivenOrImplicit | Lazy | ExtensionMethod) then | |||
if sym.isOneOf(GivenOrImplicit | Lazy | ExtensionMethod) || mdef.isInstanceOf[ValDef] then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is | Lazy
still needed? Aren't all lazy values ValDef
s?
About the error message:
Currently:
Instead, I would suggest:
That could be achieved by simplifying def checkNotSelfRef(t: RefTree) =
if t.symbol eq sym then
report.warning("Infinite loop", t.srcPos) Seems to work for for extension methods and givens as well:
|
Minor: should we rename this phase to |
@gagandeepkalra do you plan to further work on this PR? It would be great to have it merged! 😃 |
Hi @mbovel, I'll get back to working this. |
Hey @gagandeepkalra do you still plan on returning to this? |
Closing in favor of |
resolves #14429
cc. @anatoliykmetyuk