diff --git a/lib/steep/type_construction.rb b/lib/steep/type_construction.rb index d1a1965e..d4600f23 100644 --- a/lib/steep/type_construction.rb +++ b/lib/steep/type_construction.rb @@ -2657,34 +2657,11 @@ def check(node, type, constraints: Subtyping::Constraints.empty) def synthesize_sendish(node, hint:, tapp:) case node.type when :send - yield_self do - if self_class?(node) - module_type = expand_alias(module_context.module_type) - type = if module_type.is_a?(AST::Types::Name::Singleton) - AST::Types::Name::Singleton.new(name: module_type.name) - else - module_type - end - - add_typing(node, type: type) - else - type_send(node, send_node: node, block_params: nil, block_body: nil, tapp: tapp, hint: hint) - end - end + type_send(node, send_node: node, block_params: nil, block_body: nil, tapp: tapp, hint: hint) when :csend yield_self do send_type, constr = - if self_class?(node) - module_type = expand_alias(module_context.module_type) - type = if module_type.is_a?(AST::Types::Name::Singleton) - AST::Types::Name::Singleton.new(name: module_type.name) - else - module_type - end - add_typing(node, type: type).to_ary - else - type_send(node, send_node: node, block_params: nil, block_body: nil, unwrap: true, tapp: tapp, hint: hint).to_ary - end + type_send(node, send_node: node, block_params: nil, block_body: nil, unwrap: true, tapp: tapp, hint: hint).to_ary constr .update_type_env { context.type_env.join(constr.context.type_env, context.type_env) } @@ -4687,10 +4664,6 @@ def fallback_to_any(node) add_typing node, type: AST::Builtin.any_type end - def self_class?(node) - node.type == :send && node.children[0]&.type == :self && node.children[1] == :class - end - def namespace_module?(node) # @type var nodes: Array[Parser::AST::Node] nodes = diff --git a/sig/steep/type_construction.rbs b/sig/steep/type_construction.rbs index b4b17f00..8761809d 100644 --- a/sig/steep/type_construction.rbs +++ b/sig/steep/type_construction.rbs @@ -393,9 +393,6 @@ module Steep def fallback_to_any: (Parser::AST::Node node) ?{ () -> Diagnostic::Ruby::Base } -> Pair - # Return `true` if `node` is `self.class` - def self_class?: (Parser::AST::Node node) -> bool - # Returns `true` if the given `node` is a `class` or `module` declaration that only contains module/class definitions # def namespace_module?: (Parser::AST::Node node) -> bool