File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
python/upgrades/f635b392038a494915307f913657cd3058f9b476 Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -139,11 +139,15 @@ where
139
139
newidx = oldidx + count ( callable .getInnerScope ( ) .getArg ( _) ) - count ( args .getDefault ( _) )
140
140
)
141
141
or
142
- // expr is a default for a keyword-only parameter
142
+ // expr is a default for a keyword-only parameter.
143
+ // before this upgrade, we would not always attach the default value to the correct keyword-only parameter,
144
+ // to fix this, we calculate the new index based on the source location of the default value (a default value
145
+ // must belong to the parameter that was defined immediately before the default value).
143
146
exists ( Arguments_ args , CallableExprAdjusted callable |
144
147
callable .getArgs ( ) = args and
145
148
args .getKwDefault ( oldidx ) = expr and
146
149
newidx =
150
+ // the last parameter to be defined before this default value
147
151
max ( int i |
148
152
exists ( Parameter_ param | param = callable .getInnerScope ( ) .getKwonlyarg ( i ) |
149
153
param .getLocation ( ) .getStartLine ( ) < expr .getLocation ( ) .getStartLine ( )
You can’t perform that action at this time.
0 commit comments