[ruby-dev:51088] [Ruby master Bug#18067] Composite procs with `instance_exec` aren't executed within the context of the receiver
From:
info@...
Date:
2021-08-08 13:09:26 UTC
List:
ruby-dev #51088
Issue #18067 has been reported by ttanimichi (Tsukuru Tanimichi).
----------------------------------------
Bug #18067: Composite procs with `instance_exec` aren't executed within the context of the receiver
https://bugs.ruby-lang.org/issues/18067
* Author: ttanimichi (Tsukuru Tanimichi)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
```ruby
func1 = -> (x) { x + y }
class A
def y
10
end
end
A.new.instance_exec(1, &func1) # => 11
func2 = -> (x) { x * 2 }
f = func1 >> func2
A.new.instance_exec(1, &f) # => undefined local variable or method `y' for main:Object (NameError)
```
--
https://bugs.ruby-lang.org/