Actions
Bug #20482
closednil variables in a guard clause of a standalone => or in expression
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
Description
The following expression produces a TypeError, which is quite unexpected:
[1, 2] in a, b if b == 2*a
x.rb:1:in `*': nil can't be coerced into Integer (TypeError)
[1, 2] in a, b if b == 2*a
^
from x.rb:1:in `<main>'
The expression above should be equivalent to the following one, which works as expected:
case [1, 2]
in a, b if b == 2*a
true
else
false
end
# => true
Apologies in advance if this is intentional or has been reported before.
Actions
Like1
Like1Like0Like0Like1