Skip to content

instance_exec block argument destructuring when default value passed #9375

Description

@katafrakt

Environment Information

  • JRuby 10.0.5.0
  • OS: MacOS (arm)

Expected Behavior

Same as with CRuby:

irb(main):001> RUBY_VERSION
=> "4.0.1"
irb(main):002> Object.new.instance_exec([1]) { |x = :unset| x }
=> [1]
irb(main):003> Object.new.instance_exec([1]) { |x| x }
=> [1]

Actual Behavior

irb(main):001> Object.new.instance_exec([1]) { |x = :unset| x }
=> 1
irb(main):002> Object.new.instance_exec([1]) { |x| x }
=> [1]

When there is and array and a default value, only params first value is returned. It also happens for the array with more than one element:

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

I looks similar to #9208

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions