Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support unnamed restarg #1112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/steep/type_construction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def inspect
s + ">"
end

SPECIAL_LVAR_NAMES = Set[:_, :__any__, :__skip__]
SPECIAL_LVAR_NAMES = Set[nil, :_, :__any__, :__skip__]

include ModuleHelper

Expand Down
31 changes: 31 additions & 0 deletions test/type_check_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Loading