You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: complex_type.rb
    path of file: ./repos/solargraph/lib/solargraph
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Solargraph
  # A container for type data based on YARD type tags.
  #
  class ComplexType
    # @!parse
    #   include TypeMethods

    autoload :TypeMethods, 'solargraph/complex_type/type_methods'
    autoload :UniqueType,  'solargraph/complex_type/unique_type'

    # @param types [Array<UniqueType>]
    def initialize types = [UniqueType::UNDEFINED]
      @items = types.uniq(&:to_s)
    end

    # @param api_map [ApiMap]
    # @param context [String]
    # @return [ComplexType]
    def qualify api_map, context = ''
      types = @items.map do |t|
        next t if ['Boolean', 'nil', 'void', 'undefined'].include?(t.name)
        t.qualify api_map, context
      end
      ComplexType.new(types)
    end

    def first
      @items.first
    end

    def to_rbs
      ((@items.length > 1 ? '(' : '') + @items.map do |item|
        "#{item.namespace}#{item.parameters? ? "[#{item.subtypes.map { |s| s.to_rbs
    
    def to_rbs
      ((@items.length > 1 ? '(' : '') + @items.map do |item|
        "#{item.namespace}#{item.parameters? ? "[#{item.subtypes.map { |s| s.to_rbs }.join(', ')}]" : ''}"
      end.join(' | ') + (@items.length > 1 ? ')' : '')).gsub(/undefined/, 'untyped')
    end

    def map &block
      @items.map &block
    end

    # @yieldparam [UniqueType]
    # @return [Array]
    def each &block
      @items.each &block
    end

    # @yieldparam [UniqueType]
    # @return [Enumerator<UniqueType>]
    def each_unique_type &block
      return enum_for(__method__) unless block_given?

      @items.each do |item|
        item.each_unique_type &block
      end
    end

    def length
      @items.length
    end

    def [](index)
      @items[index]
    end

    def select &block
      @items.select &block
    end
    def namespace
      # cache this attr for high frequency call
      @namespace ||= method_missing(:namespace).to_s
    end

    def method_missing name, *args, &block
      return if @items.first.nil?
      return @items.first.send(name, *args, &block) if respond_to_missing?(name)
      super
    end

    def respond_to_missing?(name, include_private = false)
      TypeMethods.public_instance_methods.include?(name) || super
    end

    def to_s
      map(&:tag).join(', ')
    end

    def all? &block
      @items.all? &block
    end

    def any? &block
      @items.compact.any? &block
    end

    def selfy?
      @items.any?(&:selfy?)
    end

    def parameterized?
      any?(&:parameterized?)
    end

    def resolve_parameters definitions, context
      result = @items.map { |i| i.resolve_parameters(definitions, context) }
      ComplexType.parse(*result.map(&:tag))
    end

    # @param dst [String]
    # @return [ComplexType]
    def self_to dst
      return self unless selfy?
      red = reduce_class(dst)
      result = @items.map { |i| i.self_to red }
      ComplexType.parse(*result.map(&:to_s))
    end

    def nullable?
      @items.any?(&:nil_type?)
    end

    def all_params
      @items.first.all_params || []
    end

    private

    # @todo This is a quick and dirty hack that forces `self` keywords
    #   to reference an instance of their class and never the class itself.
    #   This behavior may change depending on which result is expected
    #   from YARD conventions. See https://github.com/lsegal/yard/issues/1257
    # @param dst [String]
    # @return [String]
    def reduce_class dst
      while dst =~ /^(Class|Module)\<(.*?)\>$/
        dst = dst.sub(/^(Class|Module)\</, '').sub(/\>$/, '')
      end
      dst
    end