@@ -84,10 +84,11 @@ private module Input implements TypeFlowInput<Location> {
8484 }
8585
8686 /**
87- * Holds if data can flow from `n1` to `n2` in one step, and `n1` is not
88- * necessarily functionally determined by `n2`.
87+ * Holds if data can flow from `n1` to `n2` in one step.
88+ *
89+ * For a given `n2`, this predicate must include all possible `n1` that can flow to `n2`.
8990 */
90- predicate joinStep ( TypeFlowNode n1 , TypeFlowNode n2 ) {
91+ predicate step ( TypeFlowNode n1 , TypeFlowNode n2 ) {
9192 n2 .asExpr ( ) .( ChooseExpr ) .getAResultExpr ( ) = n1 .asExpr ( )
9293 or
9394 exists ( Field f , Expr e |
@@ -112,13 +113,7 @@ private module Input implements TypeFlowInput<Location> {
112113 // skip trivial recursion
113114 not arg = n2 .asSsa ( ) .getAUse ( )
114115 )
115- }
116-
117- /**
118- * Holds if data can flow from `n1` to `n2` in one step, and `n1` is
119- * functionally determined by `n2`.
120- */
121- predicate step ( TypeFlowNode n1 , TypeFlowNode n2 ) {
116+ or
122117 n2 .asExpr ( ) = n1 .asField ( ) .getAnAccess ( )
123118 or
124119 n2 .asExpr ( ) = n1 .asSsa ( ) .getAUse ( )
@@ -143,7 +138,7 @@ private module Input implements TypeFlowInput<Location> {
143138 exists ( LocalVariableDeclExpr decl |
144139 n .asSsa ( ) .( BaseSsaUpdate ) .getDefiningExpr ( ) = decl and
145140 not decl .hasImplicitInit ( ) and
146- not exists ( decl .getInit ( ) )
141+ not exists ( decl .getInitOrPatternSource ( ) )
147142 )
148143 }
149144
@@ -169,7 +164,7 @@ private module Input implements TypeFlowInput<Location> {
169164 */
170165 pragma [ nomagic]
171166 private predicate upcastCand ( TypeFlowNode n , RefType t1 , RefType t1e , RefType t2 , RefType t2e ) {
172- exists ( TypeFlowNode next | step ( n , next ) or joinStep ( n , next ) |
167+ exists ( TypeFlowNode next | step ( n , next ) |
173168 n .getType ( ) = t1 and
174169 next .getType ( ) = t2 and
175170 t1 .getErasure ( ) = t1e and
0 commit comments