Skip to content

Commit

Permalink
Fix forwarding arg bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tompng committed Oct 27, 2023
1 parent 8ca0e08 commit 1145293
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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

0 comments on commit 1145293

Please sign in to comment.