-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
QL: add restrictive transitive closure query #8411
base: main
Are you sure you want to change the base?
Conversation
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.
A few comments, otherwise this looks good to me.
Out of interest, is there a "canonical" fix for the case where you don't want the type to be restricted?
not exists(MemberCall memberCall | memberCall.getBase() = c | | ||
not exists(ClassPredicate pred | | ||
pred = superClass*(base).getClassPredicate(memberCall.getMemberName()) and | ||
memberCall.getNumberOfArguments() = pred.getArity() | ||
) | ||
) |
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.
not exists ... not
... Is this just a forall
?
The fix I went for was to replace: |
Identifies the mistake fixed in this PR: #8380
Basically, a transitive closure might restrict the type when you do zero steps through it, which might not be intentional.
I think the results found by the query are benign (except for the one already fixed, and the one in the experimental query).