Sha256: 106cb88c621bab5ea95e249888346be7df08455e54fed1329526803961247c2e

Contents?: true

Size: 624 Bytes

Versions: 242

Compression:

Stored size: 624 Bytes

Contents

# frozen_string_literal: true
# typed: true

module T::Types
  # Modeling self-types properly at runtime would require additional tracking,
  # so at runtime we permit all values and rely on the static checker.
  class SelfType < Base

    def initialize(); end

    # @override Base
    def name
      "T.self_type"
    end

    # @override Base
    def valid?(obj)
      true
    end

    # @override Base
    private def subtype_of_single?(other)
      case other
      when SelfType
          true
        else
          false
      end
    end

    module Private
      INSTANCE = SelfType.new.freeze
    end
  end
end

Version data entries

242 entries across 242 versions & 1 rubygems

Version Path
sorbet-runtime-0.5.9090 lib/types/types/self_type.rb
sorbet-runtime-0.5.9088 lib/types/types/self_type.rb
sorbet-runtime-0.5.9084 lib/types/types/self_type.rb
sorbet-runtime-0.5.9076 lib/types/types/self_type.rb
sorbet-runtime-0.5.9070 lib/types/types/self_type.rb
sorbet-runtime-0.5.9064 lib/types/types/self_type.rb
sorbet-runtime-0.5.9058 lib/types/types/self_type.rb
sorbet-runtime-0.5.9057 lib/types/types/self_type.rb
sorbet-runtime-0.5.9053 lib/types/types/self_type.rb
sorbet-runtime-0.5.9052 lib/types/types/self_type.rb
sorbet-runtime-0.5.9048 lib/types/types/self_type.rb
sorbet-runtime-0.5.9045 lib/types/types/self_type.rb
sorbet-runtime-0.5.9042 lib/types/types/self_type.rb
sorbet-runtime-0.5.9041 lib/types/types/self_type.rb
sorbet-runtime-0.5.9035 lib/types/types/self_type.rb
sorbet-runtime-0.5.9033 lib/types/types/self_type.rb
sorbet-runtime-0.5.9030 lib/types/types/self_type.rb
sorbet-runtime-0.5.9019 lib/types/types/self_type.rb
sorbet-runtime-0.5.9013 lib/types/types/self_type.rb
sorbet-runtime-0.5.9006 lib/types/types/self_type.rb