Skip to content

Commit

Permalink
Remove supporting a[&b]=c a[**b]=c because it is removed in ruby 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
tompng committed Apr 6, 2024
1 parent d29d8ed commit fda837f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
3 changes: 1 addition & 2 deletions lib/repl_type_completor/type_analyzer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ def evaluate_missing_node(_node, _scope) = Types::NIL
def evaluate_call_node_arguments(call_node, scope)
# call_node.arguments is Prism::ArgumentsNode
arguments = call_node.arguments&.arguments&.dup || []
block_arg = call_node.block.expression if call_node.block.is_a?(Prism::BlockArgumentNode)
block_arg = call_node.block.expression if call_node.respond_to?(:block) && call_node.block.is_a?(Prism::BlockArgumentNode)
kwargs = arguments.pop.elements if arguments.last.is_a?(Prism::KeywordHashNode)
args_types = arguments.map do |arg|
case arg
Expand Down Expand Up @@ -1079,7 +1079,6 @@ def evaluate_multi_write_receiver(node, scope, evaluated_receivers)
end
end
end
evaluate node.block.expression, scope if node.block&.expression
receiver
when Prism::SplatNode
evaluate_multi_write_receiver node.expression, scope, evaluated_receivers if node.expression
Expand Down
7 changes: 0 additions & 7 deletions test/repl_type_completor/test_type_analyze.rb
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,8 @@ def test_massign
assert_call('a, ((b=1).c, d) = 1; b.', include: Integer)
assert_call('a, b[c=1] = 1; c.', include: Integer)
assert_call('a, b[*(c=1)] = 1; c.', include: Integer)
assert_call('a, b[**(c=1)] = 1; c.', include: Integer)
assert_call('a, b[&(c=1)] = 1; c.', include: Integer)
assert_call('a, b[] = 1; a.', include: Integer)
assert_call('def f(*); a, b[*] = 1; a.', include: Integer)
assert_call('def f(&); a, b[&] = 1; a.', include: Integer)
assert_call('def f(**); a, b[**] = 1; a.', include: Integer)
# incomplete massign
assert_analyze_type('a,b', :lvar_or_method, 'b')
assert_call('(a=1).b, a.a', include: Integer)
Expand Down Expand Up @@ -514,9 +510,6 @@ def test_rarely_used_syntax
assert_call('END{1.', include: Integer)
# MatchWrite
assert_call('a=1; /(?<a>)/=~b; a.', include: [String, NilClass], exclude: Integer)
# OperatorWrite with block `a[&b]+=c`
assert_call('a=[1]; (a[0,&:to_a]+=1.0).', include: Float)
assert_call('a=[1]; (a[0,&b]+=1.0).', include: Float)
end

def test_hash
Expand Down

0 comments on commit fda837f

Please sign in to comment.