From c6706bda5c0691be65949ec13036325f57f626ef Mon Sep 17 00:00:00 2001 From: SamW Date: Fri, 17 Oct 2025 15:22:29 -0700 Subject: [PATCH] [Kernel] Tweak signatures for conversion methods, and add unit tests in --- core/kernel.rbs | 30 +++-- lib/rbs/test/type_check.rb | 7 +- lib/rbs/unit_test/type_assertions.rb | 4 +- sig/unit_test/type_assertions.rbs | 10 +- test/stdlib/Kernel_test.rb | 191 +++++++++++++++++++++++---- 5 files changed, 195 insertions(+), 47 deletions(-) diff --git a/core/kernel.rbs b/core/kernel.rbs index b50e58111..277791eb1 100644 --- a/core/kernel.rbs +++ b/core/kernel.rbs @@ -480,9 +480,12 @@ module Kernel : BasicObject # def self?.Complex: (_ToC complex_like, ?exception: true) -> Complex | (_ToC complex_like, exception: bool) -> Complex? - | (Numeric | String real, ?Numeric | String imag, ?exception: true) -> Complex - | (Numeric | String real, ?Numeric | String imag, exception: bool) -> Complex? - | (untyped, ?untyped, ?exception: bool) -> Complex? + | (Numeric numeric, ?exception: bool) -> Complex + | (String real_or_both, ?exception: true) -> Complex + | (untyped real_or_both, exception: bool) -> Complex? + | (Numeric | String real, Numeric | String imag, ?exception: true) -> Complex + | (Numeric | String real, Integer | Float | Rational | Complex imag, exception: bool) -> Complex + | (Numeric | String real, untyped imag, exception: bool) -> Complex? #