Bug #2049

String#upto: Possible Regression

Added by runpaint (Run Paint Run Run) over 2 years ago. Updated about 1 year ago.

[ruby-core:25380]
Status:Closed Start date:09/05/2009
Priority:Low Due date:
Assignee:matz (Yukihiro Matsumoto) % Done:

0%

Category:core
Target version:1.9.2
ruby -v:ruby 1.9.2dev (2009-09-03 trunk 24741) [i686-linux]

Description

Prior to r24562:

  a = []
  "25".upto("5") { |s| a << s }
  a #=> ["25"]

Now:

  a = []
  "25".upto("5") { |s| a << s }
  a #=> []

IOW, previously when the argument was a stringified number that was less than self _and_ the argument was shorter than self, self was yielded to the block. Now the argument's numerical value is all that matters, so in this example nothing is yielded.

Presumably this is intentional because the new behaviour makes more sense than the previous, but as it broke a RubySpec, I'd just like to confirm before I fix the failing example.

Related issues

duplicates ruby-trunk - Bug #2179: 1.9.2において block のスコープがおかしいときがある Closed 10/06/2009

History

Updated by yugui (Yuki Sonoda) over 2 years ago

  • Assignee set to matz (Yukihiro Matsumoto)
  • Target version set to 1.9.2

Updated by naruse (Yui NARUSE) over 2 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF