From bb66728b6de738b5be215ed17a8308f7333e8783 Mon Sep 17 00:00:00 2001 From: Yuki Kurihara Date: Fri, 19 Dec 2025 14:48:10 +0900 Subject: [PATCH] Merge pull request #2765 from ksss/tuple-length Check tuple type length --- lib/rbs/test/type_check.rb | 1 + stdlib/objspace/0/objspace.rbs | 2 +- test/rbs/test/type_check_test.rb | 4 ++++ test/stdlib/ObjectSpace_test.rb | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/rbs/test/type_check.rb b/lib/rbs/test/type_check.rb index b7821f43e..16e34f640 100644 --- a/lib/rbs/test/type_check.rb +++ b/lib/rbs/test/type_check.rb @@ -364,6 +364,7 @@ def value(val, type) value(val, builder.expand_alias2(type.name.absolute!, type.args)) when Types::Tuple Test.call(val, IS_AP, ::Array) && + type.types.length == val.length && type.types.map.with_index {|ty, index| value(val[index], ty) }.all? when Types::Record Test::call(val, IS_AP, ::Hash) && diff --git a/stdlib/objspace/0/objspace.rbs b/stdlib/objspace/0/objspace.rbs index e51d42fd4..cdd89a3cb 100644 --- a/stdlib/objspace/0/objspace.rbs +++ b/stdlib/objspace/0/objspace.rbs @@ -411,7 +411,7 @@ module ObjectSpace # ObjectSpace.reachable_objects_from(1) # #=> nil # 1 is not markable (heap managed) object # - def self?.reachable_objects_from: (untyped) -> ([ untyped ] | nil) + def self?.reachable_objects_from: (untyped) -> (Array[untyped] | nil) #