diff --git a/lib/steep/type_construction.rb b/lib/steep/type_construction.rb index c59da954e..d8f1fdd6b 100644 --- a/lib/steep/type_construction.rb +++ b/lib/steep/type_construction.rb @@ -37,7 +37,7 @@ def inspect s + ">" end - SPECIAL_LVAR_NAMES = Set[:_, :__any__, :__skip__] + SPECIAL_LVAR_NAMES = Set[nil, :_, :__any__, :__skip__] include ModuleHelper diff --git a/test/type_check_test.rb b/test/type_check_test.rb index 68783f0ad..6d942f607 100644 --- a/test/type_check_test.rb +++ b/test/type_check_test.rb @@ -1787,6 +1787,37 @@ def bar ) end + def test_unnamed_restarg + run_type_check_test( + signatures: { + "a.rbs" => <<~RBS + class Foo + def foo: (*untyped, **untyped) -> void + + def bar: { (*untyped, **untyped) -> void } -> void + end + RBS + }, + code: { + "a.rb" => <<~RUBY + class Foo + def foo(*, **) + bar { |*, **| } + end + + def bar + end + end + RUBY + }, + expectations: <<~YAML + --- + - file: a.rb + diagnostics: [] + YAML + ) + end + def test_rescue_assignment run_type_check_test( signatures: {