Skip to content

Performing block_given? from inside an orphan block always returns false #5039

Closed
@dearblue

Description

@dearblue

I noticed that while working on #5038, when I do a block_given? from within an orphan block, it always returns false.
When I tried the old mruby, it returned true until mruby-1.3.0.

% for i in 1.2.0 1.3.0 1.4.0 1.4.1 2.0.0 2.0.1 2.1.0 2.1.1 \
  do \
    echo -n "mruby-$i  " \
    mruby-$i/build/host/bin/mruby -e 'def f(&b); -> { [!!b, block_given?] }; end; p f{}.call' \
  done
mruby-1.2.0  [true, true]
mruby-1.3.0  [true, true]
mruby-1.4.0  [true, false]
mruby-1.4.1  [true, false]
mruby-2.0.0  [true, false]
mruby-2.0.1  [true, false]
mruby-2.1.0  [true, false]
mruby-2.1.1  [true, false]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions