lib/steep/interface/method_type.rb
# Returns a new method type which can be used for the method implementation type of both `self` and `other`.
#
Returns a new method type which can be used for the method implementation type of both `self` and `other`.
Returns a new method type which can be used for the method implementation type of both ` self ` and ` other ` .
def unify_overload(other)
        type_params = []
        s1 = Substitution.build(self.type_params)
        type_params.push(*s1.dictionary.values.map(&:name))
        s2 = Substitution.build(other.type_params)
        type_params.push(*s2.dictionary.values.map(&:name))
        block = case
                when self.block && other.block
                  self.block.subst(s1) + other.block.subst(s2)
                when self.block
                  self.block.to_optional.subst(s1)
                when other.block
                  other.block.to_optional.subst(s2)
                end
        self.class.new(
          type_params: type_params,
          params: params.subst(s1) + other.params.subst(s2),
          block: block,
          return_type: AST::Types::Union.build(
            types: [return_type.subst(s1),other.return_type.subst(s2)]
          ),
          method_def: method_def,
          location: nil
        )
      end
def unify_overload ( other ) type_params = [ ] s1 = Substitution . build ( self . type_params ) type_params . push ( * s1 . dictionary . values . map ( & :name ) ) s2 = Substitution . build ( other . type_params ) type_params . push ( * s2 . dictionary . values . map ( & :name ) ) block = case when self . block && other . block self . block . subst ( s1 ) + other . block . subst ( s2 ) when self . block self . block . to_optional . subst ( s1 ) when other . block other . block . to_optional . subst ( s2 ) end self . class . new ( type_params : type_params , params : params . subst ( s1 ) + other . params . subst ( s2 ) , block : block , return_type : AST :: Types :: Union . build ( types : [ return_type . subst ( s1 ) , other . return_type . subst ( s2 ) ] ) , method_def : method_def , location : nil ) end
Returns a new method type which can be used for the method implementation type of both `self` and `other`.
Returns a new method type which can be used for the method implementation type of both ` self ` and ` other ` .
other
<not_specific>