Style/CombinableLoops
autocorrects loops with different element names
#13202
Labels
Style/CombinableLoops
autocorrects loops with different element names
#13202
Given the following example code:
with the following output:
rubocop autocorrects it to:
which breaks when run:
Expected behavior
To not generate invalid code, so either:
Actual behavior
Rubocop combined the two loops even though they used different element names, leading to the second one now having an unidentified variable.
I know that
Style/CombinableLoops
is marked as unsafe, but I presume generating invalid code is still a bug? If it is not, my apologies for the invalid report.Steps to reproduce the problem
Run rubocop on the provided example code and autocorrect the
Style/CombinableLoops
offenses, then run the resulting code.RuboCop version
The text was updated successfully, but these errors were encountered: