You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure what the bug is here? The offense is not because of the << operator, but because of the + operator. Since * has higher precedence than +, the parentheses disambiguate the right side of the + operation.
The idea is that the parentheses will make it obvious that this expression can be expressed as:
b=2 * (3 << 4)a=1 + b
In other words, if you didn't know the order of precedence in ruby, it's impossible to know if 1 + 2 * (3 << 4) is (1 + 2) * (3 << 4) or 1 + (2 * (3 << 4)), which is what this cop is addressing.
Please create file
sample.rb
:Expected behavior
Everything is fine.
Actual behavior
RuboCop version
See also #10047.
The text was updated successfully, but these errors were encountered: