Ruby: fix some name clashes between summarized callables #13265
Merged
+129
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Fixes an issue where the summaries for
deleteandassochad multiple implementations that applied to each others' call sites.We had code like this:
The existence of
DeleteSummaryinString.qllmeans all method calls nameddeleteare associated with the summary whose underlying string value isdelete. This meansDeleteUnknownSummary, if it exists, ends up applying to all calls nameddelete, regardless of the extra condition in its charpred.This means that calls of form
x.delete(:foo)would return all elements ofx, not just its:fooelement (because the call was treated as having an unknown key).A similar situation occurred with
AssocUnknownSummaryinHash.qllandAssocSummaryinArray.qll.This is a big enough footgun that I decided to add a new QL4QL query for it, which is part of this PR as well. In fact, that query is how I found the issue with
assoc(the issue withdeletewas discovered by investigating a FP).Evaluation looks reasonable. We lose some call edges and a few alerts - it's hard to verify at a glance whether these were correct, but I have a branch where some rather blatant FPs were causing by this issue and are fixed by this change.