Bug #18390
closed
Enumerator::Lazy#find returns invalid value
Added by cvss (Kirill Vechera) almost 3 years ago.
Updated almost 3 years ago.
Description
There is a regression bug in #find
# RUBY_VERSION 3.0.2
[1, 2, 3, 4].lazy.find(&:even?) # => nil (ERROR!), expected 2
[1, 2, 3, 4].find(&:even?).find(&:even?) # => 2
# RUBY_VERSION 2.4.1
[1, 2, 3, 4].lazy.find(&:even?) # => 2
[1, 2, 3, 4].find(&:even?) # => 2
Files
- Description updated (diff)
- Description updated (diff)
I cannot reproduce the issue
$ ~/local/bin/ruby -ve 'p [1, 2, 3, 4].lazy.find(&:even?)'
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]
2
Could you please elaborate what did you do? How did you install your ruby? What platform are you using? Is the script complete? How did you run the script?
I'm not sure about build parameters, I found this bug at the ruby playground https://try.ruby-lang.org/ I'm attaching a screenshot.
I just found that playground runs Opal, not MRI. Sorry for incorrect addressee, please close the issue.
- Status changed from Open to Third Party's Issue
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0Like0