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
We're fixing this. As a note, it's best to never do that in real code though, as it's really an edge that is I believe not supposed to be used, notably because it behaves inconsistently when there is 0 or 1+ positional arguments, as your 1st and 4th examples show.
IOW, since Struct#new accepts keyword arguments (except with Struct.new(..., keyword_init: false)), it should only be given keyword arguments when passing no positional arguments, otherwise it's unclear and confusing how these keyword arguments are treated.
As a note, it's best to never do that in real code though
Agreed. I think the code that triggered this may have been originally written prior to ruby 3.0 and the many keyword arguments changes. (I don't actually recall offhand what triggered it... but I think it was also only in the tests.)
It looks like TruffleRuby behaves differently when a Struct is initialized with both positional and keyword args.
Here's a test script to demonstrate:
The text was updated successfully, but these errors were encountered: