Project

General

Profile

Actions

Bug #13087

closed

Regression of instance_exec behaviour in ruby 2.4

Bug #13087: Regression of instance_exec behaviour in ruby 2.4

Added by chucke (Tiago Cardoso) almost 9 years ago. Updated almost 9 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
[ruby-core:78905]

Description

I've just caught up this running our test suite against the newly released ruby 2.4. Here is the repro gist:

 class A def initialize(x) @x = x end def perform puts "performing #{@x} times" end end puts "basic" A.new(1).tap do |a| a.instance_exec do perform end end #puts "advanced"  A.new(1).tap do |a| a.instance_exec(A.new(3), &:perform) end 

The last one output "3 times in all ruby 2's except latest 2.4 .

This seems to apply the to_proc symbol to the object itself, and not the argument of instance_exec, which is a regression.


Related issues 1 (0 open1 closed)

Updated by chucke (Tiago Cardoso) almost 9 years ago Actions #1 [ruby-core:78906]

  • ruby -v set to ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago Actions #2

  • Is duplicate of Bug #13074: When executing instance_exec with symbol.to_proc, it ignores first argument. added

Updated by nobu (Nobuyoshi Nakada) almost 9 years ago Actions #3 [ruby-core:78908]

  • Status changed from Open to Closed
Actions

Also available in: PDF Atom