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
Starting Ruby 3.0, there is a difference between passing a hash or list of keywords as a method arguments. But Ruby 3.0 parser returns the same result for RubyParser::V30.new.parse:
Note that the result is the same, but it will lead to errors trying to execute it back via Ruby2Ruby if method has def method(hash, kw: 1) signature.
I've tried to make up with easier example. Noticed this error when looking at how is "kwargs = { b_keyword: false }; @article.method_with_kwargs('positional', a_keyword: true, **kwargs)" parsed:
Note that a_keyword becomes part of hash, even though it's obviously an explicit keyword. Moreover, **kwargs then become part of the same hash, which is just wrong. It sometimes work, just because { :a_keyword => true, **kwargs } is being naively extracted in https://github.com/seattlerb/ruby2ruby/blob/master/lib/ruby2ruby.rb#L262-L265.
Could you please tell me if it's expected or it's a bug?
The text was updated successfully, but these errors were encountered:
Starting Ruby 3.0, there is a difference between passing a hash or list of keywords as a method arguments. But Ruby 3.0 parser returns the same result for RubyParser::V30.new.parse:
Note that the result is the same, but it will lead to errors trying to execute it back via Ruby2Ruby if
method
hasdef method(hash, kw: 1)
signature.I've tried to make up with easier example. Noticed this error when looking at how is
"kwargs = { b_keyword: false }; @article.method_with_kwargs('positional', a_keyword: true, **kwargs)"
parsed:Note that
a_keyword
becomes part ofhash
, even though it's obviously an explicit keyword. Moreover,**kwargs
then become part of the same hash, which is just wrong. It sometimes work, just because{ :a_keyword => true, **kwargs }
is being naively extracted in https://github.com/seattlerb/ruby2ruby/blob/master/lib/ruby2ruby.rb#L262-L265.Could you please tell me if it's expected or it's a bug?
The text was updated successfully, but these errors were encountered: