When an Array literal is used to construct an array containing a hash (a baffling feature I did not know existed), it is marked as a kwargs hash. When a literal Hash is constructed the same way, it is not.
I believe the latter is incorrect, because non-symbol keys end up getting passed through as a kwargs HashNode, but kwargs should never have any non-symbol keys.
$ ast -e '["foo" => 1, a: 2] == [{"foo" => 1, a: 2}]'
AST:
RootNode line: 0
OperatorCallNode*:== line: 0
ArrayNode line: 0
HashNode line: 0, kwarg
StrNode line: 0
FixnumNode line: 0, long: 1
SymbolNode:a line: 0
FixnumNode line: 0, long: 2
ArrayNode line: 0
ArrayNode line: 0
HashNode line: 0, literal
StrNode line: 0
FixnumNode line: 0, long: 1
SymbolNode:a line: 0
FixnumNode line: 0, long: 2
, null
This came up while trying to finalize #9219. There may be other cases that are also being incorrectly marked as kwargs.
Reactions are currently unavailable
When an Array literal is used to construct an array containing a hash (a baffling feature I did not know existed), it is marked as a kwargs hash. When a literal Hash is constructed the same way, it is not.
I believe the latter is incorrect, because non-symbol keys end up getting passed through as a kwargs HashNode, but kwargs should never have any non-symbol keys.
$ ast -e '["foo" => 1, a: 2] == [{"foo" => 1, a: 2}]' AST: RootNode line: 0 OperatorCallNode*:== line: 0 ArrayNode line: 0 HashNode line: 0, kwarg StrNode line: 0 FixnumNode line: 0, long: 1 SymbolNode:a line: 0 FixnumNode line: 0, long: 2 ArrayNode line: 0 ArrayNode line: 0 HashNode line: 0, literal StrNode line: 0 FixnumNode line: 0, long: 1 SymbolNode:a line: 0 FixnumNode line: 0, long: 2 , nullThis came up while trying to finalize #9219. There may be other cases that are also being incorrectly marked as kwargs.