class RBS::Types::Optional
def ==(other)
def ==(other) other.is_a?(Optional) && other.type == type end
def each_type
def each_type if block_given? yield type else enum_for :each_type end end
def free_variables(set = Set.new)
def free_variables(set = Set.new) type.free_variables(set) end
def hash
def hash self.class.hash ^ type.hash end
def initialize(type:, location:)
def initialize(type:, location:) @type = type @location = location end
def map_type(&block)
def map_type(&block) if block Optional.new( type: yield(type), location: location ) else enum_for :map_type end end
def map_type_name(&block)
def map_type_name(&block) Optional.new( type: type.map_type_name(&block), location: location ) end
def sub(s)
def sub(s) self.class.new(type: type.sub(s), location: location) end
def to_json(state = _ = nil)
def to_json(state = _ = nil) { class: :optional, type: type, location: location }.to_json(state) end
def to_s(level = 0)
def to_s(level = 0) case t = type when RBS::Types::Literal case t.literal when Symbol return "#{type.to_s(1)} ?" end end "#{type.to_s(1)}?" end