Sha256: 858aa52361e98f72931d2dd8d6f60906ba8aa9120bdabd00382b62b16079278b

Contents?: true

Size: 891 Bytes

Versions: 172

Compression:

Stored size: 891 Bytes

Contents

# frozen_string_literal: true
# typed: true

# A marking class for when methods return void.
# Should never appear in types directly.
module T::Private::Types
  class Void < T::Types::Base
    ERROR_MESSAGE = "Validation is being done on an `Void`. Please report this bug at https://github.com/sorbet/sorbet/issues"

    # The actual return value of `.void` methods.
    #
    # Uses `module VOID` because this gives it a readable name when someone
    # examines it in Pry or with `#inspect` like:
    #
    #     T::Private::Types::Void::VOID
    #
    module VOID
      freeze
    end

    # overrides Base
    def name
      "<VOID>"
    end

    # overrides Base
    def valid?(obj)
      raise ERROR_MESSAGE
    end

    # overrides Base
    private def subtype_of_single?(other)
      raise ERROR_MESSAGE
    end

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

Version data entries

172 entries across 166 versions & 2 rubygems

Version Path
sorbet-runtime-0.5.11170 lib/types/private/types/void.rb
sorbet-runtime-0.5.11164 lib/types/private/types/void.rb
sorbet-runtime-0.5.11163 lib/types/private/types/void.rb
sorbet-runtime-0.5.11162 lib/types/private/types/void.rb
sorbet-runtime-0.5.11158 lib/types/private/types/void.rb
sorbet-runtime-0.5.11156 lib/types/private/types/void.rb
sorbet-runtime-0.5.11155 lib/types/private/types/void.rb
sorbet-runtime-0.5.11152 lib/types/private/types/void.rb
sorbet-runtime-0.5.11151 lib/types/private/types/void.rb
sorbet-runtime-0.5.11150 lib/types/private/types/void.rb
study_line-0.1.6 vendor/bundle/ruby/3.2.0/gems/sorbet-runtime-0.5.11104/lib/types/private/types/void.rb
study_line-0.1.6 vendor/bundle/ruby/3.2.0/gems/sorbet-runtime-0.5.11108/lib/types/private/types/void.rb
sorbet-runtime-0.5.11148 lib/types/private/types/void.rb
sorbet-runtime-0.5.11147 lib/types/private/types/void.rb
study_line-0.1.5 vendor/bundle/ruby/3.2.0/gems/sorbet-runtime-0.5.11108/lib/types/private/types/void.rb
study_line-0.1.5 vendor/bundle/ruby/3.2.0/gems/sorbet-runtime-0.5.11104/lib/types/private/types/void.rb
study_line-0.1.4 vendor/bundle/ruby/3.2.0/gems/sorbet-runtime-0.5.11104/lib/types/private/types/void.rb
study_line-0.1.4 vendor/bundle/ruby/3.2.0/gems/sorbet-runtime-0.5.11108/lib/types/private/types/void.rb
sorbet-runtime-0.5.11146 lib/types/private/types/void.rb
study_line-0.1.3 vendor/bundle/ruby/3.2.0/gems/sorbet-runtime-0.5.11104/lib/types/private/types/void.rb