diff --git a/lib/steep/services/completion_provider.rb b/lib/steep/services/completion_provider.rb index 7a9b542cd..12bd57127 100644 --- a/lib/steep/services/completion_provider.rb +++ b/lib/steep/services/completion_provider.rb @@ -663,7 +663,7 @@ def constant_items_for_context(context, parent: nil, position:, prefix:, items:) if parent case parent.type when :const - const_name = typing.source_index.reference(constant_node: parent) + const_name = typing.source_index.reference(constant_node: parent) or raise "Unknown node in source_index: #{parent}" consts = context.type_env.constant_env.children(const_name) end else diff --git a/lib/steep/type_construction.rb b/lib/steep/type_construction.rb index e2429da42..332517723 100644 --- a/lib/steep/type_construction.rb +++ b/lib/steep/type_construction.rb @@ -2908,6 +2908,8 @@ def type_masgn_type(mlhs_node, rhs_type, masgn:, optional:) _, constr = constr.gvasgn(asgn_node, type) when :mlhs constr = (constr.type_masgn_type(asgn_node, type, masgn: masgn, optional: optional) or return) + else + _, constr = constr.synthesize_children(asgn_node).add_typing(asgn_node, type: AST::Builtin.any_type) end if node.type == :splat diff --git a/test/completion_provider_test.rb b/test/completion_provider_test.rb index 918755195..8fd953ee0 100644 --- a/test/completion_provider_test.rb +++ b/test/completion_provider_test.rb @@ -412,6 +412,27 @@ class World end end + def test_on_colon2_call_masgn + with_checker <