Sha256: 49238d4fc804cbaebdd41eb79917a8495a8492081232035acbefe20503c5f428

Contents?: true

Size: 929 Bytes

Versions: 165

Compression:

Stored size: 929 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

    def build_type
      nil
    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

165 entries across 165 versions & 1 rubygems

Version Path
sorbet-runtime-0.5.11668 lib/types/private/types/void.rb
sorbet-runtime-0.5.11663 lib/types/private/types/void.rb
sorbet-runtime-0.5.11647 lib/types/private/types/void.rb
sorbet-runtime-0.5.11645 lib/types/private/types/void.rb
sorbet-runtime-0.5.11642 lib/types/private/types/void.rb
sorbet-runtime-0.5.11641 lib/types/private/types/void.rb
sorbet-runtime-0.5.11637 lib/types/private/types/void.rb
sorbet-runtime-0.5.11635 lib/types/private/types/void.rb
sorbet-runtime-0.5.11633 lib/types/private/types/void.rb
sorbet-runtime-0.5.11631 lib/types/private/types/void.rb
sorbet-runtime-0.5.11630 lib/types/private/types/void.rb
sorbet-runtime-0.5.11625 lib/types/private/types/void.rb
sorbet-runtime-0.5.11620 lib/types/private/types/void.rb
sorbet-runtime-0.5.11618 lib/types/private/types/void.rb
sorbet-runtime-0.5.11615 lib/types/private/types/void.rb
sorbet-runtime-0.5.11611 lib/types/private/types/void.rb
sorbet-runtime-0.5.11610 lib/types/private/types/void.rb
sorbet-runtime-0.5.11609 lib/types/private/types/void.rb
sorbet-runtime-0.5.11608 lib/types/private/types/void.rb
sorbet-runtime-0.5.11604 lib/types/private/types/void.rb