Sha256: 55eb159417a87ff68bd42bc1ab6416de702820fabb4d30c6a7cd670f464fd8b6

Contents?: true

Size: 566 Bytes

Versions: 2

Compression:

Stored size: 566 Bytes

Contents

require 'yoda/typing/tree/namespace_inferable'

module Yoda
  module Typing
    module Tree
      class SingletonClassTree < Base
        include NamespaceInferable

        # @!method node
        #   @return [AST::SingletonClassNode]

        # @return [Types::Type]
        def infer_type
          receiver_type = infer_child(node.receiver)

          new_context = context.derive_class_context(class_type: receiver_type.singleton_type)
          infer_child(node.body, context: new_context)

          generator.nil_type
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yoda-language-server-0.10.1 lib/yoda/typing/tree/singleton_class_tree.rb
yoda-language-server-0.10.0 lib/yoda/typing/tree/singleton_class_tree.rb