-
Notifications
You must be signed in to change notification settings - Fork 1.1k
FullParameterization: fix rewiring of Returns #383
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
@smarter can you please include details about bug that you are fixing in commit message? |
case Ident(_) => rewireCall(thisRef) | ||
case Ident(_) => | ||
val rewired = rewiredTarget(tree, derived) | ||
if (rewired.exists) // This only happens when `tree` is the `from` part of a Return |
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.
If Ident
s inside Return
s need special handling, I'd prefer to handle them on Return
node level. IE add case t: Return =>
which has special handling of return.
@DarkDimius: My hope was that the commit message + the test case was enough to understand what the commit was doing, but I'll see if I can add something to the description |
9e3a9aa
to
a92f936
Compare
if (rewired.exists) | ||
Return(expr, Ident(rewired.termRef)) | ||
else | ||
EmptyTree |
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.
- That's a silent failure. Should at least issue
ctx.error
- From could be an EmptyTree(which means return from enclsoing method), in this case calling
rewiredTarget(NoSymbol, derived)
doesn't make sense.
Based on this I would better check iffrom.isEmpty
and only if nonempty rewirefrom
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.
Ahh, EmptyTree here is a sentinel value. Disregard my comment about ctx.error
The `from` field of a Return tree should either be EmptyTree or an Ident corresponding to the method we're returning from.
a92f936
to
a273f38
Compare
Issue addressed, I also replaced my use of |
|
FullParameterization: fix rewiring of Returns
Backport "Process Export for unused check" to 3.3 LTS
This assumes that an
Ident
corresponding to a method with extensions only occurs as thefrom
field of aReturn
, can someone confirm that this will always be the case?EDIT: I updated the code to do a
case Return
so the assumption above is no longer needed, but I'm still curious ifIdent
can appear anywhere else, otherwise we could remove thecase Ident
Review by @odersky or @DarkDimius .