From 25f28c1e14e2135f6427826d04994a7580ebeefe Mon Sep 17 00:00:00 2001 From: Oskar Eichler <62393985+OskarEichler@users.noreply.github.com> Date: Sat, 29 Aug 2026 18:43:03 +0200 Subject: [PATCH 1/2] Preserve runtime prototype keyword rest names --- lib/rbs/prototype/runtime.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rbs/prototype/runtime.rb b/lib/rbs/prototype/runtime.rb index 6cf73b879..3ae0a2b3b 100644 --- a/lib/rbs/prototype/runtime.rb +++ b/lib/rbs/prototype/runtime.rb @@ -211,7 +211,8 @@ def method_type(method) name or raise optional_keywords[name] = Types::Function::Param.new(name: nil, type: untyped) when :keyrest - rest_keywords = Types::Function::Param.new(name: nil, type: untyped) + name = nil if name == :** # For `def f(...) end` syntax + rest_keywords = Types::Function::Param.new(name: name, type: untyped) when :block block = Types::Block.new( type: Types::Function.empty(untyped).update(rest_positionals: Types::Function::Param.new(name: nil, type: untyped)), From f7fa06f6f324bc6c1adb8e37c34ce4075365f251 Mon Sep 17 00:00:00 2001 From: Oskar Eichler Date: Sun, 30 Aug 2026 16:00:28 +0700 Subject: [PATCH 2/2] Update runtime prototype keyrest expectations --- test/rbs/runtime_prototype_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/rbs/runtime_prototype_test.rb b/test/rbs/runtime_prototype_test.rb index a0c89afc1..85131f46a 100644 --- a/test/rbs/runtime_prototype_test.rb +++ b/test/rbs/runtime_prototype_test.rb @@ -81,7 +81,7 @@ def self.baz: () { (*untyped) -> untyped } -> untyped alias bar foo - def foo: (untyped foo, ?untyped bar, *untyped baz, untyped a, b: untyped, ?c: untyped, **untyped) -> untyped + def foo: (untyped foo, ?untyped bar, *untyped baz, untyped a, b: untyped, ?c: untyped, **untyped d) -> untyped private @@ -148,7 +148,7 @@ def self.baz: () { (*untyped) -> untyped } -> untyped alias bar foo - def foo: (untyped foo, ?untyped bar, *untyped baz, untyped a, b: untyped, ?c: untyped, **untyped) -> untyped + def foo: (untyped foo, ?untyped bar, *untyped baz, untyped a, b: untyped, ?c: untyped, **untyped d) -> untyped private