Skip to content

Commit

Permalink
fix massign return value
Browse files Browse the repository at this point in the history
  • Loading branch information
tompng committed Oct 18, 2023
1 parent 33bf06e commit 19c79bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/katakata_irb/type_simulator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ def evaluate_multi_write_node(node, scope)
end
)
evaluate_multi_write node, value, scope, evaluated_receivers
value
end

def evaluate_if_node(node, scope) = evaluate_if_unless(node, scope)
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 @@ -137,6 +137,7 @@ def test_lvar_singleton_method
end

def test_local_variable_assign
assert_call('(a = 1).', include: Integer)
assert_call('a = 1; a = ""; a.', include: String, exclude: Integer)
assert_call('1 => a; a.', include: Integer)
end
Expand Down Expand Up @@ -293,6 +294,7 @@ def test_ivar_no_scope
end

def test_massign
assert_call('(a,b,c=1).', include: Integer)
assert_call('a,=[1,2]; a.', include: Integer, exclude: Array)
assert_call('a,b=[1,2]; a.', include: Integer, exclude: Array)
assert_call('a,b=[1,2]; b.', include: Integer, exclude: Array)
Expand Down

0 comments on commit 19c79bd

Please sign in to comment.