-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Ruby: Fix isLocalSourceNode
implementation
#9022
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
The old code was equivalent with the code below, which seems wrong ``` not n instanceof ExprNode or n instanceof ExprNode and localFlowStepTypeTracker+(..., n) ``` From running on real DB I found that this meant that the following node types were also included as local source nodes: - `TReturningNode` - `TSynthReturnNode` - `TSummaryNode` - `TSsaDefinitionNode` My understanding is that the first 3 should not be included. I would guess that SsaDefinitionNode should indeed be included as a LocalSourceNode, but I'm not 100% sure, so I'll see what the test results say before making further changes.
Since this is not using inline-expectation-tests, I'm not entirely sure whether these changes are OK or not, so hope to get someone else to signoff on that.
// Expressions that can't be reached from another entry definition or expression. | ||
n instanceof ExprNode and |
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.
What happens if you instead remove this constraint, and the disjunct n instanceof SynthReturnNode
?
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.
I can certainly try 👍
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 seemed to do the trick 👌
The need for `SynthReturnNode` goes away if we don't restrict the nodes that can't be reached from another entry definition or expression to be `ExprNode`s
@@ -43,10 +43,6 @@ track | |||
| type_tracker.rb:12:1:16:3 | self in m | type tracker with call steps | type_tracker.rb:12:1:16:3 | self (m) | | |||
| type_tracker.rb:12:1:16:3 | self in m | type tracker without call steps | type_tracker.rb:12:1:16:3 | self in m | | |||
| type_tracker.rb:13:5:13:7 | var | type tracker without call steps | type_tracker.rb:13:5:13:7 | var | | |||
| type_tracker.rb:13:5:13:23 | ... = ... | type tracker with call steps | type_tracker.rb:2:5:5:7 | self (field=) | |
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.
For reference: The reason that ... - ...
is (correctly) no longer a LocalSourceNode
is because it represents the SsaDefinitionNode
for the assignment, not the ExprNode
.
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.
Thanks for fixing
The old code was equivalent with the code below, which seems wrong
From running on real DB I found that this meant that the following node
types were also included as local source nodes:
TReturningNode
TSynthReturnNode
TSummaryNode
TSsaDefinitionNode
It turned out that
TSynthReturnNode
was required for sure (but I don't fully undestand why), while the others don't immediately seems to be.@hvitved I've requested a review from you, since you seem to have been touching this code last. If you think it looks good, once we have filled out proper documentation for the TODO I left in the code, we can take it out of draft 👍