Rust: Use doublyBoundedFastTC in TraitIsVisible#20362
Rust: Use doublyBoundedFastTC in TraitIsVisible#20362hvitved wants to merge 1 commit intogithub:mainfrom
doublyBoundedFastTC in TraitIsVisible#20362Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the TraitIsVisible module to use the more efficient doublyBoundedFastTC predicate instead of a custom recursive lookup implementation. The change improves performance by leveraging CodeQL's optimized transitive closure computation for determining trait visibility.
Key Changes
- Replaced recursive
traitLookuppredicate with a graph-based approach usingdoublyBoundedFastTC - Introduced a new type system (
TNode) to represent the nodes in the visibility graph - Simplified the main
traitIsVisiblepredicate logic
| exists(Trait t1, ItemNode i2 | | ||
| n1 = TTrait(t1) and | ||
| n2 = TItemNode(i2) and | ||
| t1 = i2.getASuccessor(_, _) |
There was a problem hiding this comment.
The getASuccessor call is missing the required name parameter. Based on the context, this should be t1 = i2.getASuccessor(_, _) where the first underscore represents the name parameter.
| exists(Trait t1, ItemNode i2 | | |
| n1 = TTrait(t1) and | |
| n2 = TItemNode(i2) and | |
| t1 = i2.getASuccessor(_, _) | |
| exists(Trait t1, ItemNode i2, string name | | |
| n1 = TTrait(t1) and | |
| n2 = TItemNode(i2) and | |
| t1 = i2.getASuccessor(name, _) |
| exists(ItemNode i1, ItemNode i2 | | ||
| n1 = TItemNode(i1) and | ||
| n2 = TItemNode(i2) and | ||
| i1 = getOuterScope(i2) |
There was a problem hiding this comment.
The direction of the relationship appears reversed. Based on the original traitLookup logic, this should be i2 = getOuterScope(i1) to represent moving from an inner scope to an outer scope.
| i1 = getOuterScope(i2) | |
| i2 = getOuterScope(i1) |
aa4b51d to
af9b4f4
Compare
No description provided.