[ruby-core:80372] [Ruby trunk Bug#13370] instance_exec occurs "no receiver given (ArgumentError)"

From: p.wadachi@...
Date: 2017-03-27 07:12:15 UTC
List: ruby-core #80372
Issue #13370 has been reported by ta1kt0me (hiroki tokutomi).

----------------------------------------
Bug #13370: instance_exec occurs "no receiver given (ArgumentError)"
https://bugs.ruby-lang.org/issues/13370

* Author: ta1kt0me (hiroki tokutomi)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.4.1
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
ArgumentError occurs in 2.4.1 on below code. It's the same in trunk.

```
class Foo
  def one
    puts 1
  end
end

Foo.new.instance_exec(&:one)
# => ArgumentError: no receiver given
```

But it's differece behavior with 2.4.0 . Is this expected ?

```
# 2.4.0
Foo.new.instance_exec(&:one)
# 1
# => nil
```




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next