Skip to content

Conversation

RasmusWL
Copy link
Member

@RasmusWL RasmusWL commented May 3, 2022

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

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 👍

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.
@github-actions github-actions bot added the Ruby label May 3, 2022
RasmusWL added 2 commits May 3, 2022 14:43
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.
@RasmusWL RasmusWL requested a review from hvitved May 3, 2022 13:50
// Expressions that can't be reached from another entry definition or expression.
n instanceof ExprNode and
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can certainly try 👍

Copy link
Member Author

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
@RasmusWL RasmusWL marked this pull request as ready for review May 4, 2022 14:33
@RasmusWL RasmusWL requested a review from a team as a code owner May 4, 2022 14:33
@RasmusWL RasmusWL requested a review from hvitved May 4, 2022 14:33
@RasmusWL RasmusWL added the no-change-note-required This PR does not need a change note label May 4, 2022
@@ -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=) |
Copy link
Contributor

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.

Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

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

Thanks for fixing

@RasmusWL RasmusWL merged commit add6579 into github:main May 11, 2022
@RasmusWL RasmusWL deleted the ruby-fix branch May 11, 2022 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Ruby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants