Project

General

Profile

Actions

Bug #13370

closed

instance_exec occurs "no receiver given (ArgumentError)"

Added by ta1kt0me (hiroki tokutomi) over 7 years ago. Updated over 7 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:80372]

Description

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

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #13074: When executing instance_exec with symbol.to_proc, it ignores first argument.ClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0