From: "nobu (Nobuyoshi Nakada) via ruby-core" Date: 2025-03-07T10:29:27+00:00 Subject: [ruby-core:121257] [Ruby master Bug#21175] Range#max called on a beginles Integer Range with excluded end raises TypeError Issue #21175 has been updated by nobu (Nobuyoshi Nakada). https://github.com/ruby/ruby/pull/12879 ---------------------------------------- Bug #21175: Range#max called on a beginles Integer Range with excluded end raises TypeError https://bugs.ruby-lang.org/issues/21175#change-112210 * Author: andrykonchin (Andrew Konchin) * Status: Open * ruby -v: 3.4.2 * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- I would expect that for a Range with Integer right boundary `end - 1` is returned: ```ruby (nil...10).max # => (irb):1:in 'Range#max': cannot exclude end value with non Integer begin value (TypeError) ``` `#max` works well with non-nil `begin`: ```ruby (1...10).max # => 9 ``` Related issue - https://bugs.ruby-lang.org/issues/17034 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/