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)), 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