class RBS::TypeName

def +(other)

def +(other)
  if other.absolute?
    other
  else
    TypeName.new(
      namespace: self.to_namespace + other.namespace,
      name: other.name
    )
  end
end

def ==(other)

def ==(other)
  other.is_a?(self.class) && other.namespace == namespace && other.name == name
end

def absolute!

def absolute!
  self.class.new(namespace: namespace.absolute!, name: name)
end

def absolute?

def absolute?
  namespace.absolute?
end

def alias?

def alias?
  kind == :alias
end

def class?

def class?
  kind == :class
end

def hash

def hash
  namespace.hash ^ name.hash
end

def initialize(namespace:, name:)

def initialize(namespace:, name:)
  @namespace = namespace
  @name = name
  @kind = case name.to_s[0,1]
          when /[A-Z]/
            :class
          when /[a-z]/
            :alias
          when "_"
            :interface
          else
            # Defaults to :class
            :class
          end
end

def interface?

def interface?
  kind == :interface
end

def relative!

def relative!
  self.class.new(namespace: namespace.relative!, name: name)
end

def split

def split
  namespace.path + [name]
end

def to_json(state = _ = nil)

def to_json(state = _ = nil)
  to_s.to_json(state)
end

def to_namespace

def to_namespace
  namespace.append(self.name)
end

def to_s

def to_s
  "#{namespace.to_s}#{name}"
end

def with_prefix(namespace)

def with_prefix(namespace)
  self.class.new(namespace: namespace + self.namespace, name: name)
end