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

Fix forwarding arg bug #50

Merged
merged 1 commit into from
Oct 27, 2023
Merged
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
4 changes: 2 additions & 2 deletions lib/katakata_irb/type_analyzer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ def evaluate_call_node_arguments(call_node, scope)
# `f(a, ...)` treat like splat
nil
when Prism::SplatNode
evaluate arg.expression, scope
evaluate arg.expression, scope if arg.expression
nil # TODO: splat
else
evaluate arg, scope
Expand All @@ -815,7 +815,7 @@ def evaluate_call_node_arguments(call_node, scope)
nil
end
when Prism::AssocSplatNode
evaluate arg.value, scope
evaluate arg.value, scope if arg.value
nil
end
end.compact.to_h
Expand Down
2 changes: 2 additions & 0 deletions test/test_type_analyze.rb
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ def test_def
assert_call('def f(a,b=1,*c,d,x:0,y:,**z,&e); e.arity.', include: Integer)
assert_call('def f(...); 1.', include: Integer)
assert_call('def f(a,...); 1.', include: Integer)
assert_call('def f(...); g(...); 1.', include: Integer)
assert_call('def f(*,**,&); g(*,**,&); 1.', include: Integer)
assert_call('class Array; def f; self.', include: Array)
end

Expand Down