diff --git a/lib/repl_type_completor/type_analyzer.rb b/lib/repl_type_completor/type_analyzer.rb index 0e70b32..ffeb338 100644 --- a/lib/repl_type_completor/type_analyzer.rb +++ b/lib/repl_type_completor/type_analyzer.rb @@ -261,7 +261,9 @@ def evaluate_call_node(node, scope) when Prism::NumberedParametersNode assign_numbered_parameters node.block.parameters.maximum, block_scope, block_args, {} when Prism::BlockParametersNode - assign_parameters node.block.parameters.parameters, block_scope, block_args, {} + if node.block.parameters.parameters + assign_parameters node.block.parameters.parameters, block_scope, block_args, {} + end end result = node.block.body ? evaluate(node.block.body, block_scope) : Types::NIL block_scope.merge_jumps diff --git a/test/repl_type_completor/test_type_analyze.rb b/test/repl_type_completor/test_type_analyze.rb index a8f9a58..33004e9 100644 --- a/test/repl_type_completor/test_type_analyze.rb +++ b/test/repl_type_completor/test_type_analyze.rb @@ -680,6 +680,7 @@ def test_call_parameter end def test_block_args + assert_call('[1,2,3].tap{|| 1.', include: Integer) assert_call('[1,2,3].tap{|a| a.', include: Array) assert_call('[1,2,3].tap{|a,| a.', include: Integer) assert_call('[1,2,3].tap{|a,b| a.', include: Integer)