@@ -260,7 +260,9 @@ private module Cached {
260260 or
261261 FlowSummaryImplSpecific:: ParsePositions:: isParsedKeywordParameterPosition ( _, name )
262262 } or
263- THashSplatArgumentPosition ( )
263+ THashSplatArgumentPosition ( ) or
264+ TAnyArgumentPosition ( ) or
265+ TAnyKeywordArgumentPosition ( )
264266
265267 cached
266268 newtype TParameterPosition =
@@ -280,7 +282,8 @@ private module Cached {
280282 FlowSummaryImplSpecific:: ParsePositions:: isParsedKeywordArgumentPosition ( _, name )
281283 } or
282284 THashSplatParameterPosition ( ) or
283- TAnyParameterPosition ( )
285+ TAnyParameterPosition ( ) or
286+ TAnyKeywordParameterPosition ( )
284287}
285288
286289import Cached
@@ -482,11 +485,14 @@ class ParameterPosition extends TParameterPosition {
482485 predicate isHashSplat ( ) { this = THashSplatParameterPosition ( ) }
483486
484487 /**
485- * Holds if this position represents any parameter. This includes both positional
486- * and named parameters.
488+ * Holds if this position represents any parameter, except `self` parameters. This
489+ * includes both positional, named, and block parameters.
487490 */
488491 predicate isAny ( ) { this = TAnyParameterPosition ( ) }
489492
493+ /** Holds if this position represents any positional parameter. */
494+ predicate isAnyNamed ( ) { this = TAnyKeywordParameterPosition ( ) }
495+
490496 /** Gets a textual representation of this position. */
491497 string toString ( ) {
492498 this .isSelf ( ) and result = "self"
@@ -502,6 +508,8 @@ class ParameterPosition extends TParameterPosition {
502508 this .isHashSplat ( ) and result = "**"
503509 or
504510 this .isAny ( ) and result = "any"
511+ or
512+ this .isAnyNamed ( ) and result = "any-named"
505513 }
506514}
507515
@@ -519,6 +527,15 @@ class ArgumentPosition extends TArgumentPosition {
519527 /** Holds if this position represents a keyword argument named `name`. */
520528 predicate isKeyword ( string name ) { this = TKeywordArgumentPosition ( name ) }
521529
530+ /**
531+ * Holds if this position represents any argument, except `self` arguments. This
532+ * includes both positional, named, and block arguments.
533+ */
534+ predicate isAny ( ) { this = TAnyArgumentPosition ( ) }
535+
536+ /** Holds if this position represents any positional parameter. */
537+ predicate isAnyNamed ( ) { this = TAnyKeywordArgumentPosition ( ) }
538+
522539 /**
523540 * Holds if this position represents a synthesized argument containing all keyword
524541 * arguments wrapped in a hash.
@@ -535,12 +552,16 @@ class ArgumentPosition extends TArgumentPosition {
535552 or
536553 exists ( string name | this .isKeyword ( name ) and result = "keyword " + name )
537554 or
555+ this .isAny ( ) and result = "any"
556+ or
557+ this .isAnyNamed ( ) and result = "any-named"
558+ or
538559 this .isHashSplat ( ) and result = "**"
539560 }
540561}
541562
542563/** Holds if arguments at position `apos` match parameters at position `ppos`. */
543- pragma [ inline ]
564+ pragma [ nomagic ]
544565predicate parameterMatch ( ParameterPosition ppos , ArgumentPosition apos ) {
545566 ppos .isSelf ( ) and apos .isSelf ( )
546567 or
@@ -556,5 +577,11 @@ predicate parameterMatch(ParameterPosition ppos, ArgumentPosition apos) {
556577 or
557578 ppos .isHashSplat ( ) and apos .isHashSplat ( )
558579 or
559- ppos .isAny ( ) and exists ( apos )
580+ ppos .isAny ( ) and not apos .isSelf ( )
581+ or
582+ apos .isAny ( ) and not ppos .isSelf ( )
583+ or
584+ ppos .isAnyNamed ( ) and apos .isKeyword ( _)
585+ or
586+ apos .isAnyNamed ( ) and ppos .isKeyword ( _)
560587}
0 commit comments