Skip to content

Commit eca1a27

Browse files
committed
wip
1 parent d70b1b4 commit eca1a27

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2612,18 +2612,18 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
26122612
* context, and also implements logic for performing contextual inference.
26132613
*/
26142614
private module ContextualTyping {
2615+
pragma[nomagic]
2616+
private TypeParameter getAConstrained(TypeParameter tp) {
2617+
result = getATypeParameterConstraint(tp).getTypeAt(_)
2618+
}
2619+
26152620
/**
26162621
* Holds if parameterizable `p` mentions type parameter `tp` at some parameter,
26172622
* possibly via a constraint on another mentioned type parameter.
26182623
*/
26192624
pragma[nomagic]
26202625
private predicate mentionsTypeParameterAtParameter(Parameterizable p, TypeParameter tp) {
2621-
tp = p.getParameter(_).getType().getTypeAt(_)
2622-
or
2623-
exists(TypeParameter mid |
2624-
mentionsTypeParameterAtParameter(p, mid) and
2625-
tp = getATypeParameterConstraint(mid).getTypeAt(_)
2626-
)
2626+
tp = getAConstrained*(p.getParameter(_).getType().getTypeAt(_))
26272627
}
26282628

26292629
/**
@@ -2674,9 +2674,12 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
26742674
target = invocation.(InvocationMatchingGetTypeArgumentInput::Access).getTarget() and
26752675
parameterizableReturnContextTypedAt(target, path, tp) and
26762676
tp = target.getTypeParameter(_) and
2677-
// check that no explicit type arguments have been supplied for `tp`
2678-
not exists(
2679-
InvocationMatchingGetTypeArgument::getTypeArgument(invocation, target, tp, _)
2677+
// check that no explicit type arguments have been supplied which bind `tp`
2678+
not exists(TypeParameter supplied |
2679+
tp = getAConstrained*(supplied) and
2680+
exists(
2681+
InvocationMatchingGetTypeArgument::getTypeArgument(invocation, target, supplied, _)
2682+
)
26802683
)
26812684
)
26822685
}

0 commit comments

Comments
 (0)