Project

General

Profile

Actions

Bug #18390

closed

Enumerator::Lazy#find returns invalid value

Added by cvss (Kirill Vechera) about 1 month ago. Updated about 1 month ago.

Status:
Third Party's Issue
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:106510]

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

ruby_bug.png (8.8 KB) ruby_bug.png cvss (Kirill Vechera), 12/06/2021 05:25 PM
Actions #1

Updated by cvss (Kirill Vechera) about 1 month ago

  • Description updated (diff)
Actions #2

Updated by cvss (Kirill Vechera) about 1 month ago

  • Description updated (diff)

Updated by mame (Yusuke Endoh) about 1 month 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) about 1 month ago

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) about 1 month ago

I just found that playground runs Opal, not MRI. Sorry for incorrect addressee, please close the issue.

Actions #6

Updated by jeremyevans0 (Jeremy Evans) about 1 month ago

  • Status changed from Open to Third Party's Issue

Updated by mame (Yusuke Endoh) about 1 month 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

Also available in: Atom PDF