-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Ruby: Context sensitive instance method resolution #10358
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
6044f14
to
4607adc
Compare
4607adc
to
7bae643
Compare
8695ba2
to
0e0923e
Compare
0e0923e
to
dc0720b
Compare
dc0720b
to
9937ae8
Compare
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.
Looks good to me.
@@ -14,6 +14,9 @@ class Module extends TModule { | |||
/** Gets the super class of this module, if any. */ | |||
Module getSuperClass() { result = getSuperClass(this) } | |||
|
|||
/** Gets a sub class of this module, if any. */ | |||
Module getASubClass() { this = getSuperClass(result) } |
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.
This predicate returns direct sub classes only, doesn't it? Let document that and perhaps also make it more clear from its name.
) | ||
or | ||
// `in C => c then c.foo` | ||
asModulePattern(n, tp) 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.
Perhaps also add C === x
tests. If I'm not mistaken, both types of case
expressions are implemented using that operator.
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.
Ah I see you just moved these predicate. Perhaps we should post-pone ===
for a future PR. We might want to desugar case
statements into if
at some point too.
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.
Yes, we can do that in another PR. I guess is could be added to hasAdjacentTypeCheckedReads
.
This PR implements call-sensitive instance method resolution, using the data-flow library's built-in support.
For example, in
we will no longer report flow from
taint
tosink
(but still tonon_sink
).