Project

General

Profile

Bug #16414

Updated by sawa (Tsuyoshi Sawada) 10 months ago

The following Following code is raised an error `wrong number of arguments (given 1, expected 2) (ArgumentError)` in master. 

 ``` 
 $ ruby -e 'lambda = -> (s, i) { "#{i}:#{s}" }; p %w(a b c).each.lazy.with_index.map(&lambda).first(2)' 
 # expected result expect results => ["0:a", "1:b"] 
 ``` 

 This code is valid up till until Ruby 2.6.5 and 2.7.0-preview1, but it raised the error in since Ruby 2.7.0-preview2 or later. Maybe, 2.7.0-preview2. 
 (Maybe, this behavior has been there since the implementation of `Enumerator::Lazy#with_index`. `Enumerator::Lazy#with_index`.) 

 Is this behaviour intended? intentional change?

Back