Fix destructuring of block argument with default value by katafrakt · Pull Request #9376 · jruby/jruby · GitHub
Skip to content

Fix destructuring of block argument with default value#9376

Open
katafrakt wants to merge 1 commit intojruby:masterfrom
katafrakt:fix-destructuring-with-default-value
Open

Fix destructuring of block argument with default value#9376
katafrakt wants to merge 1 commit intojruby:masterfrom
katafrakt:fix-destructuring-with-default-value

Conversation

@katafrakt
Copy link
Copy Markdown
Contributor

It fixes #9375 - incorrect behaviour found in instance_exec, module_exec and class_exec:

Object.new.instance_exec([1, 2]) { |x = :unset| x } 
=> 1

The fix is similar to #9211

The alternative I considered is to maybe put that logic (sig.opt() + sig.required() == 1 && !sig.hasRest()) but I'm not sure it would be correct. Sounds like it, but it's not how the fix was applied in the other PR. Will be happy to change.

It fixes incorrect behaviour found in instance_exec, module_exec and
class_exec:

Object.new.instance_exec([1, 2]) { |x = :unset| x }
=> 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

instance_exec block argument destructuring when default value passed

1 participant