From 1ab5a6d7073ce36385b4f8ee9d97f3046f6cf201 Mon Sep 17 00:00:00 2001 From: mmporong Date: Tue, 27 Oct 2026 16:43:32 +0900 Subject: [PATCH] Numeric#<=> returns nil unless the receiver is the argument `Numeric#<=>` returns 0 when `other` is the receiver and nil otherwise, as the comment above the signature says, but the return type was `Integer`. Use `Integer?`, and add a test for both cases. --- core/numeric.rbs | 2 +- test/stdlib/Numeric_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/numeric.rbs b/core/numeric.rbs index e8df26fe4..bc983b432 100644 --- a/core/numeric.rbs +++ b/core/numeric.rbs @@ -237,7 +237,7 @@ class Numeric # # No subclass in the Ruby Core or Standard Library uses this implementation. # - def <=>: (Numeric other) -> Integer + def <=>: (Numeric other) -> Integer? #