Skip to content

Commit c4bd5f5

Browse files
committed
perf
1 parent dc747e5 commit c4bd5f5

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

shared/typeinference/codeql/typeinference/internal/TypeInference.qll

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
13321332
tp = target.getDeclaredType(dpos, pathToTp) and
13331333
conditionSatisfiesConstraintTypeAt(_, condition, constraint, TypePath::nil(),
13341334
constraintRootType) and
1335-
constraintRootType = target.getDeclaredType(dpos, TypePath::nil()) and
1335+
constraintRootType.getATypeParameter() = pathToTp.getHead() and
13361336
argRootType = condition.getTypeAt(TypePath::nil())
13371337
)
13381338
}
@@ -1361,19 +1361,19 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
13611361
}
13621362

13631363
pragma[nomagic]
1364-
private predicate argRootTypeSatisfiesTargetTypeCand(
1365-
Type argRootType, Access a, AccessEnvironment e, Declaration target, AccessPosition apos,
1366-
TypeParameter tp, TypePath pathToTp
1364+
private predicate accessTargetsWithArgRootType(
1365+
Access a, AccessEnvironment e, Declaration target, AccessPosition apos, Type t
13671366
) {
13681367
target = a.getTarget(e) and
1369-
argRootTypeSatisfiesTargetTypeCand(argRootType, target, apos, tp, pathToTp) and
1370-
not exists(getTypeArgument(a, target, tp, _))
1368+
t = a.getInferredType(e, apos, TypePath::nil())
13711369
}
13721370

13731371
private newtype TRelevantAccess =
13741372
MkRelevantAccess(Access a, AccessPosition apos, AccessEnvironment e) {
1375-
argRootTypeSatisfiesTargetTypeCand(a.getInferredType(e, apos, TypePath::nil()), a, e, _,
1376-
apos, _, _)
1373+
exists(Declaration target, Type t |
1374+
accessTargetsWithArgRootType(a, e, target, apos, t) and
1375+
argRootTypeSatisfiesTargetTypeCand(t, target, apos, _, _)
1376+
)
13771377
}
13781378

13791379
private class RelevantAccess extends MkRelevantAccess {
@@ -1441,8 +1441,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
14411441
Access a, AccessEnvironment e, Declaration target, TypePath path, Type t, TypeParameter tp
14421442
) {
14431443
exists(AccessPosition apos, TypePath pathToTp |
1444-
argRootTypeSatisfiesTargetTypeCand(_, a, e, target, pragma[only_bind_into](apos), tp,
1445-
pathToTp) and
1444+
argRootTypeSatisfiesTargetTypeCand(_, target, pragma[only_bind_into](apos), tp, pathToTp) and
14461445
SatisfiesParameterConstraint::satisfiesConstraint(MkRelevantAccess(a,
14471446
pragma[only_bind_into](apos), e),
14481447
MkRelevantTarget(target, pragma[only_bind_into](apos)), pathToTp.appendInverse(path),

0 commit comments

Comments
 (0)