File tree 1 file changed +8
-8
lines changed
shared/typeflow/codeql/typeflow/internal
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -85,23 +85,23 @@ module TypeFlow<LocationSig Location, TypeFlowInput<Location> I> {
85
85
pragma [ nomagic]
86
86
private predicate typeBound ( Type t ) { typeFlow ( _, t ) }
87
87
88
+ private predicate hasSupertype ( Type sub , Type ancestor ) { sub .getASupertype ( ) = ancestor }
89
+
88
90
/**
89
- * Gets a direct or indirect supertype of this type.
90
- * This does not include itself, unless this type is part of a cycle
91
- * in the type hierarchy.
91
+ * Holds if `ancestor` is a direct or indirect supertype of `sub`.
92
92
*/
93
- private Type getAStrictAncestor ( Type sub ) { result = getAnAncestor ( sub .getASupertype ( ) ) }
93
+ private predicate hasAncestorBound ( Type sub , Type ancestor ) =
94
+ doublyBoundedFastTC( hasSupertype / 2 , typeBound / 1 , typeBound / 1 ) ( sub , ancestor )
94
95
95
96
/**
96
97
* Holds if we have a bound for `n` that is better than `t`.
97
98
*/
98
99
pragma [ nomagic]
99
100
private predicate irrelevantBound ( TypeFlowNode n , Type t ) {
100
101
exists ( Type bound |
101
- typeFlow ( n , bound ) and
102
- t = getAStrictAncestor ( bound ) and
103
- typeBound ( t ) and
104
- typeFlow ( n , pragma [ only_bind_into ] ( t ) ) and
102
+ typeFlow ( n , pragma [ only_bind_into ] ( bound ) ) and
103
+ hasAncestorBound ( bound , t ) and
104
+ typeFlow ( n , t ) and
105
105
not getAnAncestor ( t ) = bound
106
106
or
107
107
n .getType ( ) = pragma [ only_bind_into ] ( bound ) and
You can’t perform that action at this time.
0 commit comments