@@ -3498,6 +3498,38 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
34983498 }
34993499 }
35003500
3501+ /**
3502+ * Holds if the type of `n` at `path` is `t` and the `j`th element of `path`
3503+ * corresponds to the `i`th type parameter of the unknown type.
3504+ */
3505+ pragma [ nomagic]
3506+ private predicate infersUnknownTypeArg0 ( AstNode n , int i , int j , TypePath path , Type t ) {
3507+ exists ( TypeParameter tp |
3508+ ContextualTyping:: hasUnknownType ( n ) and
3509+ tp = any ( UnknownType ut ) .getPositionalTypeParameter ( i ) and
3510+ t = inferType ( n , path ) and
3511+ not t instanceof UnknownType and
3512+ tp = path .getElement ( j )
3513+ )
3514+ }
3515+
3516+ /**
3517+ * Holds if the type of `n` at `path` is `t`, where
3518+ * `path = prefix ++ tp_i ++ suffix` and `tp_i` is the `i`th type parameter
3519+ * of the unknown type.
3520+ */
3521+ pragma [ nomagic]
3522+ private predicate infersUnknownTypeArg1 (
3523+ AstNode n , TypePath prefix , int i , TypePath suffix , Type t
3524+ ) {
3525+ exists ( TypePath path , int j , TypePath suffix0 |
3526+ infersUnknownTypeArg0 ( n , i , j , path , t ) and
3527+ prefix = path .getProperPrefix ( j ) and
3528+ path = prefix .appendInverse ( suffix0 ) and
3529+ suffix0 .isCons ( _, suffix )
3530+ )
3531+ }
3532+
35013533 /**
35023534 * Holds if `n` has unknown type at `prefix`, but is still able to
35033535 * infer a known type at `suffix` for the `i`th type parameter of whatever
@@ -3519,13 +3551,8 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
35193551 private predicate infersUnknownTypeArg (
35203552 AstNode n , TypePath prefix , int i , TypePath suffix , Type t
35213553 ) {
3522- exists ( TypeParameter tp , TypePath suffix0 |
3523- ContextualTyping:: hasUnknownTypeAt ( n , prefix ) and
3524- suffix0 .isCons ( tp , suffix ) and
3525- tp = any ( UnknownType ut ) .getPositionalTypeParameter ( i ) and
3526- t = inferType ( n , prefix .appendInverse ( suffix0 ) ) and
3527- not t instanceof UnknownType
3528- )
3554+ ContextualTyping:: hasUnknownTypeAt ( n , prefix ) and
3555+ infersUnknownTypeArg1 ( n , prefix , i , suffix , t )
35293556 }
35303557
35313558 pragma [ nomagic]
0 commit comments