Actions
Bug #18390
closedEnumerator::Lazy#find returns invalid value
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
Updated by mame (Yusuke Endoh) almost 3 years ago
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?
Updated by cvss (Kirill Vechera) almost 3 years ago
- File ruby_bug.png ruby_bug.png added
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.
Updated by cvss (Kirill Vechera) almost 3 years ago
I just found that playground runs Opal, not MRI. Sorry for incorrect addressee, please close the issue.
Updated by jeremyevans0 (Jeremy Evans) almost 3 years ago
- Status changed from Open to Third Party's Issue
Updated by mame (Yusuke Endoh) almost 3 years ago
Oh that's good to know. I see you have created a ticket for Opal: https://github.com/opal/opal/issues/2367 . Thank you for your report anyway!
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0