From 3d0bb6c23675fe3f164d813077883d6d9b607bca Mon Sep 17 00:00:00 2001 From: ksss Date: Sat, 25 Jan 2025 23:57:51 +0900 Subject: [PATCH 1/9] Fix bug: Treat nil as a return value --- lib/rbs/unit_test/spy.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/rbs/unit_test/spy.rb b/lib/rbs/unit_test/spy.rb index 9d85da267..a385d410f 100644 --- a/lib/rbs/unit_test/spy.rb +++ b/lib/rbs/unit_test/spy.rb @@ -20,6 +20,8 @@ class WrapSpy attr_reader :object attr_reader :method_name + NO_RETURN = Object.new + def initialize(object:, method_name:) @callback = -> (_) { } @object = object @@ -39,7 +41,7 @@ def wrapped_object define_method( spy.method_name, _ = -> (*args, &block) do - return_value = nil + return_value = NO_RETURN exception = nil block_calls = [] #: Array[Test::ArgumentsReturn] @@ -105,7 +107,7 @@ def wrapped_object arguments: args, exception: exception ) - when return_value + when ::RBS::UnitTest::Spy::WrapSpy::NO_RETURN != return_value Test::ArgumentsReturn.return( arguments: args, value: return_value From 7fbb8f5b48c98418475b04d51ceae9889a3c5774 Mon Sep 17 00:00:00 2001 From: ksss Date: Sat, 25 Jan 2025 23:58:47 +0900 Subject: [PATCH 2/9] GC::Profiler.raw_data can be `nil` --- core/gc.rbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/gc.rbs b/core/gc.rbs index 0fd4512e2..8a4b73dbf 100644 --- a/core/gc.rbs +++ b/core/gc.rbs @@ -111,7 +111,7 @@ module GC # `:HAVE_FINALIZE` # : # - def self.raw_data: () -> Array[Hash[Symbol, untyped]] + def self.raw_data: () -> Array[Hash[Symbol, untyped]]? #