brew vendor-gems: commit updates.

This commit is contained in:
Bo Anderson 2022-10-06 17:43:48 +01:00
parent 2e4fd69e14
commit 7744ccd57c
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
86 changed files with 192 additions and 166 deletions

View File

@ -159,13 +159,13 @@ GEM
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sorbet (0.5.10175)
sorbet-static (= 0.5.10175)
sorbet-runtime (0.5.10175)
sorbet-static (0.5.10175-universal-darwin-14)
sorbet-static-and-runtime (0.5.10175)
sorbet (= 0.5.10175)
sorbet-runtime (= 0.5.10175)
sorbet (0.5.10461)
sorbet-static (= 0.5.10461)
sorbet-runtime (0.5.10461)
sorbet-static (0.5.10461-universal-darwin-14)
sorbet-static-and-runtime (0.5.10461)
sorbet (= 0.5.10461)
sorbet-runtime (= 0.5.10461)
spoom (1.1.11)
sorbet (>= 0.5.9204)
sorbet-runtime (>= 0.5.9204)

View File

@ -60,7 +60,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel-1.22.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parallel_tests-3.13.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parser-3.1.2.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rainbow-3.1.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-runtime-0.5.10175/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-runtime-0.5.10461/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/parlour-8.0.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/patchelf-1.3.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/plist-3.6.0/lib"
@ -96,9 +96,9 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-html-0.12.3
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov_json_formatter-0.1.4/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-0.21.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-cobertura-2.1.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-static-0.5.10175-universal-darwin-21/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-0.5.10175/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-static-and-runtime-0.5.10175/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-static-0.5.10461-universal-darwin-21/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-0.5.10461/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-static-and-runtime-0.5.10461/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thor-1.2.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/spoom-1.1.11/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/yard-0.9.28/lib"

View File

@ -130,7 +130,7 @@ module T
def self.cast(value, type, checked: true)
return value unless checked
Private::Casts.cast(value, type, cast_method: "T.cast")
Private::Casts.cast(value, type, "T.cast")
end
# Tells the typechecker to declare a variable of type `type`. Use
@ -145,7 +145,7 @@ module T
def self.let(value, type, checked: true)
return value unless checked
Private::Casts.cast(value, type, cast_method: "T.let")
Private::Casts.cast(value, type, "T.let")
end
# Tells the type checker to treat `self` in the current block as `type`.
@ -164,7 +164,7 @@ module T
def self.bind(value, type, checked: true)
return value unless checked
Private::Casts.cast(value, type, cast_method: "T.bind")
Private::Casts.cast(value, type, "T.bind")
end
# Tells the typechecker to ensure that `value` is of type `type` (if not, the typechecker will
@ -174,7 +174,7 @@ module T
def self.assert_type!(value, type, checked: true)
return value unless checked
Private::Casts.cast(value, type, cast_method: "T.assert_type!")
Private::Casts.cast(value, type, "T.assert_type!")
end
# For the static type checker, strips all type information from a value

View File

@ -11,6 +11,13 @@ module T::Helpers
### Class/Module Helpers ###
def abstract!
if defined?(super)
# This is to play nicely with Rails' AbstractController::Base,
# which also defines an `abstract!` method.
# https://api.rubyonrails.org/classes/AbstractController/Base.html#method-c-abstract-21
super
end
Private::Abstract::Declare.declare_abstract(self, type: :abstract)
end

View File

@ -71,6 +71,10 @@ class T::InterfaceWrapper
target_obj.send(method_name, *args, &blk)
end
if singleton_class.respond_to?(:ruby2_keywords, true)
singleton_class.send(:ruby2_keywords, method_name)
end
if target_obj.singleton_class.public_method_defined?(method_name)
# no-op, it's already public
elsif target_obj.singleton_class.protected_method_defined?(method_name)

View File

@ -3,7 +3,7 @@
module T::Private
module Casts
def self.cast(value, type, cast_method:)
def self.cast(value, type, cast_method)
begin
error = T::Utils.coerce(type).error_message_for_obj(value)
return value unless error
@ -22,7 +22,7 @@ module T::Private
# there's a lot of shared logic with the above one, but factoring
# it out like this makes it easier to hopefully one day delete
# this one
def self.cast_recursive(value, type, cast_method:)
def self.cast_recursive(value, type, cast_method)
begin
error = T::Utils.coerce(type).error_message_for_obj_recursive(value)
return value unless error

View File

@ -69,6 +69,27 @@ module T::Private::ClassUtils
end
end
def self.def_with_visibility(mod, name, visibility, method=nil, &block)
mod.module_exec do
# Start a visibility (public/protected/private) region, so that
# all of the method redefinitions happen with the right visibility
# from the beginning. This ensures that any other code that is
# triggered by `method_added`, sees the redefined method with the
# right visibility.
send(visibility)
if method
define_method(name, method)
else
define_method(name, &block)
end
if block && block.arity < 0 && respond_to?(:ruby2_keywords, true)
ruby2_keywords(name)
end
end
end
# Replaces a method, either by overwriting it (if it is defined directly on `mod`) or by
# overriding it (if it is defined by one of mod's ancestors). Returns a ReplacedMethod instance
# on which you can call `bind(...).call(...)` to call the original method, or `restore` to
@ -96,13 +117,9 @@ module T::Private::ClassUtils
overwritten = original_owner == mod
T::Configuration.without_ruby_warnings do
T::Private::DeclState.current.without_on_method_added do
mod.send(:define_method, name, &blk)
if blk.arity < 0 && mod.respond_to?(:ruby2_keywords, true)
mod.send(:ruby2_keywords, name)
end
def_with_visibility(mod, name, original_visibility, &blk)
end
end
mod.send(original_visibility, name)
new_method = mod.instance_method(name)
ReplacedMethod.new(mod, original_method, new_method, overwritten, original_visibility)

View File

@ -40,9 +40,8 @@ module T::Private::Methods::CallValidation
T::Configuration.without_ruby_warnings do
# get all the shims out of the way and put back the original method
T::Private::DeclState.current.without_on_method_added do
mod.send(:define_method, method_sig.method_name, original_method)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility, original_method)
end
mod.send(original_visibility, method_sig.method_name)
end
end
# Return the newly created method (or the original one if we didn't replace it)
@ -70,28 +69,25 @@ module T::Private::Methods::CallValidation
T::Configuration.without_ruby_warnings do
T::Private::DeclState.current.without_on_method_added do
if simple_method
create_validator_method_fast(mod, original_method, method_sig)
create_validator_method_fast(mod, original_method, method_sig, original_visibility)
elsif simple_procedure
create_validator_procedure_fast(mod, original_method, method_sig)
create_validator_procedure_fast(mod, original_method, method_sig, original_visibility)
elsif ok_for_fast_path && method_sig.return_type.is_a?(T::Private::Types::Void)
create_validator_procedure_medium(mod, original_method, method_sig)
create_validator_procedure_medium(mod, original_method, method_sig, original_visibility)
elsif ok_for_fast_path
create_validator_method_medium(mod, original_method, method_sig)
create_validator_method_medium(mod, original_method, method_sig, original_visibility)
else
create_validator_slow(mod, original_method, method_sig)
create_validator_slow(mod, original_method, method_sig, original_visibility)
end
end
mod.send(original_visibility, method_sig.method_name)
end
mod.send(original_visibility, method_sig.method_name)
end
def self.create_validator_slow(mod, original_method, method_sig)
mod.send(:define_method, method_sig.method_name) do |*args, &blk|
def self.create_validator_slow(mod, original_method, method_sig, original_visibility)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |*args, &blk|
CallValidation.validate_call(self, original_method, method_sig, args, blk)
end
if mod.respond_to?(:ruby2_keywords, true)
mod.send(:ruby2_keywords, method_sig.method_name)
end
end
def self.validate_call(instance, original_method, method_sig, args, blk)

View File

@ -6,27 +6,27 @@
# bazel test //gems/sorbet-runtime:update_call_validation
module T::Private::Methods::CallValidation
def self.create_validator_method_fast(mod, original_method, method_sig)
def self.create_validator_method_fast(mod, original_method, method_sig, original_visibility)
if method_sig.return_type.is_a?(T::Private::Types::Void)
raise 'Should have used create_validator_procedure_fast'
end
# trampoline to reduce stack frame size
if method_sig.arg_types.empty?
create_validator_method_fast0(mod, original_method, method_sig, method_sig.return_type.raw_type)
create_validator_method_fast0(mod, original_method, method_sig, original_visibility, method_sig.return_type.raw_type)
elsif method_sig.arg_types.length == 1
create_validator_method_fast1(mod, original_method, method_sig, method_sig.return_type.raw_type,
create_validator_method_fast1(mod, original_method, method_sig, original_visibility, method_sig.return_type.raw_type,
method_sig.arg_types[0][1].raw_type)
elsif method_sig.arg_types.length == 2
create_validator_method_fast2(mod, original_method, method_sig, method_sig.return_type.raw_type,
create_validator_method_fast2(mod, original_method, method_sig, original_visibility, method_sig.return_type.raw_type,
method_sig.arg_types[0][1].raw_type,
method_sig.arg_types[1][1].raw_type)
elsif method_sig.arg_types.length == 3
create_validator_method_fast3(mod, original_method, method_sig, method_sig.return_type.raw_type,
create_validator_method_fast3(mod, original_method, method_sig, original_visibility, method_sig.return_type.raw_type,
method_sig.arg_types[0][1].raw_type,
method_sig.arg_types[1][1].raw_type,
method_sig.arg_types[2][1].raw_type)
elsif method_sig.arg_types.length == 4
create_validator_method_fast4(mod, original_method, method_sig, method_sig.return_type.raw_type,
create_validator_method_fast4(mod, original_method, method_sig, original_visibility, method_sig.return_type.raw_type,
method_sig.arg_types[0][1].raw_type,
method_sig.arg_types[1][1].raw_type,
method_sig.arg_types[2][1].raw_type,
@ -36,8 +36,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_fast0(mod, original_method, method_sig, return_type)
mod.send(:define_method, method_sig.method_name) do |&blk|
def self.create_validator_method_fast0(mod, original_method, method_sig, original_visibility, return_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |&blk|
# This method is a manually sped-up version of more general code in `validate_call`
# The following line breaks are intentional to show nice pry message
@ -73,8 +73,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_fast1(mod, original_method, method_sig, return_type, arg0_type)
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
def self.create_validator_method_fast1(mod, original_method, method_sig, original_visibility, return_type, arg0_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -122,8 +122,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_fast2(mod, original_method, method_sig, return_type, arg0_type, arg1_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
def self.create_validator_method_fast2(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -183,8 +183,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_fast3(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
def self.create_validator_method_fast3(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -256,8 +256,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_fast4(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
def self.create_validator_method_fast4(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, arg3, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -341,24 +341,24 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_fast(mod, original_method, method_sig)
def self.create_validator_procedure_fast(mod, original_method, method_sig, original_visibility)
# trampoline to reduce stack frame size
if method_sig.arg_types.empty?
create_validator_procedure_fast0(mod, original_method, method_sig)
create_validator_procedure_fast0(mod, original_method, method_sig, original_visibility)
elsif method_sig.arg_types.length == 1
create_validator_procedure_fast1(mod, original_method, method_sig,
create_validator_procedure_fast1(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1].raw_type)
elsif method_sig.arg_types.length == 2
create_validator_procedure_fast2(mod, original_method, method_sig,
create_validator_procedure_fast2(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1].raw_type,
method_sig.arg_types[1][1].raw_type)
elsif method_sig.arg_types.length == 3
create_validator_procedure_fast3(mod, original_method, method_sig,
create_validator_procedure_fast3(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1].raw_type,
method_sig.arg_types[1][1].raw_type,
method_sig.arg_types[2][1].raw_type)
elsif method_sig.arg_types.length == 4
create_validator_procedure_fast4(mod, original_method, method_sig,
create_validator_procedure_fast4(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1].raw_type,
method_sig.arg_types[1][1].raw_type,
method_sig.arg_types[2][1].raw_type,
@ -368,8 +368,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_fast0(mod, original_method, method_sig)
mod.send(:define_method, method_sig.method_name) do |&blk|
def self.create_validator_procedure_fast0(mod, original_method, method_sig, original_visibility)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |&blk|
# This method is a manually sped-up version of more general code in `validate_call`
# The following line breaks are intentional to show nice pry message
@ -391,8 +391,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_fast1(mod, original_method, method_sig, arg0_type)
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
def self.create_validator_procedure_fast1(mod, original_method, method_sig, original_visibility, arg0_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -426,8 +426,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_fast2(mod, original_method, method_sig, arg0_type, arg1_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
def self.create_validator_procedure_fast2(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -473,8 +473,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_fast3(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
def self.create_validator_procedure_fast3(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -532,8 +532,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_fast4(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type, arg3_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
def self.create_validator_procedure_fast4(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type, arg3_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, arg3, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -603,27 +603,27 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_medium(mod, original_method, method_sig)
def self.create_validator_method_medium(mod, original_method, method_sig, original_visibility)
if method_sig.return_type.is_a?(T::Private::Types::Void)
raise 'Should have used create_validator_procedure_medium'
end
# trampoline to reduce stack frame size
if method_sig.arg_types.empty?
create_validator_method_medium0(mod, original_method, method_sig, method_sig.return_type)
create_validator_method_medium0(mod, original_method, method_sig, original_visibility, method_sig.return_type)
elsif method_sig.arg_types.length == 1
create_validator_method_medium1(mod, original_method, method_sig, method_sig.return_type,
create_validator_method_medium1(mod, original_method, method_sig, original_visibility, method_sig.return_type,
method_sig.arg_types[0][1])
elsif method_sig.arg_types.length == 2
create_validator_method_medium2(mod, original_method, method_sig, method_sig.return_type,
create_validator_method_medium2(mod, original_method, method_sig, original_visibility, method_sig.return_type,
method_sig.arg_types[0][1],
method_sig.arg_types[1][1])
elsif method_sig.arg_types.length == 3
create_validator_method_medium3(mod, original_method, method_sig, method_sig.return_type,
create_validator_method_medium3(mod, original_method, method_sig, original_visibility, method_sig.return_type,
method_sig.arg_types[0][1],
method_sig.arg_types[1][1],
method_sig.arg_types[2][1])
elsif method_sig.arg_types.length == 4
create_validator_method_medium4(mod, original_method, method_sig, method_sig.return_type,
create_validator_method_medium4(mod, original_method, method_sig, original_visibility, method_sig.return_type,
method_sig.arg_types[0][1],
method_sig.arg_types[1][1],
method_sig.arg_types[2][1],
@ -633,8 +633,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_medium0(mod, original_method, method_sig, return_type)
mod.send(:define_method, method_sig.method_name) do |&blk|
def self.create_validator_method_medium0(mod, original_method, method_sig, original_visibility, return_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |&blk|
# This method is a manually sped-up version of more general code in `validate_call`
# The following line breaks are intentional to show nice pry message
@ -670,8 +670,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_medium1(mod, original_method, method_sig, return_type, arg0_type)
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
def self.create_validator_method_medium1(mod, original_method, method_sig, original_visibility, return_type, arg0_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(
@ -719,8 +719,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_medium2(mod, original_method, method_sig, return_type, arg0_type, arg1_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
def self.create_validator_method_medium2(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(
@ -780,8 +780,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_medium3(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
def self.create_validator_method_medium3(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(
@ -853,8 +853,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_medium4(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
def self.create_validator_method_medium4(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, arg3, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(
@ -938,24 +938,24 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_medium(mod, original_method, method_sig)
def self.create_validator_procedure_medium(mod, original_method, method_sig, original_visibility)
# trampoline to reduce stack frame size
if method_sig.arg_types.empty?
create_validator_procedure_medium0(mod, original_method, method_sig)
create_validator_procedure_medium0(mod, original_method, method_sig, original_visibility)
elsif method_sig.arg_types.length == 1
create_validator_procedure_medium1(mod, original_method, method_sig,
create_validator_procedure_medium1(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1])
elsif method_sig.arg_types.length == 2
create_validator_procedure_medium2(mod, original_method, method_sig,
create_validator_procedure_medium2(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1],
method_sig.arg_types[1][1])
elsif method_sig.arg_types.length == 3
create_validator_procedure_medium3(mod, original_method, method_sig,
create_validator_procedure_medium3(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1],
method_sig.arg_types[1][1],
method_sig.arg_types[2][1])
elsif method_sig.arg_types.length == 4
create_validator_procedure_medium4(mod, original_method, method_sig,
create_validator_procedure_medium4(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1],
method_sig.arg_types[1][1],
method_sig.arg_types[2][1],
@ -965,8 +965,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_medium0(mod, original_method, method_sig)
mod.send(:define_method, method_sig.method_name) do |&blk|
def self.create_validator_procedure_medium0(mod, original_method, method_sig, original_visibility)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |&blk|
# This method is a manually sped-up version of more general code in `validate_call`
# The following line breaks are intentional to show nice pry message
@ -988,8 +988,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_medium1(mod, original_method, method_sig, arg0_type)
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
def self.create_validator_procedure_medium1(mod, original_method, method_sig, original_visibility, arg0_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(
@ -1023,8 +1023,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_medium2(mod, original_method, method_sig, arg0_type, arg1_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
def self.create_validator_procedure_medium2(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(
@ -1070,8 +1070,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_medium3(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
def self.create_validator_procedure_medium3(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(
@ -1129,8 +1129,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_medium4(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type, arg3_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
def self.create_validator_procedure_medium4(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type, arg3_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, arg3, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(

View File

@ -6,27 +6,27 @@
# bazel test //gems/sorbet-runtime:update_call_validation
module T::Private::Methods::CallValidation
def self.create_validator_method_fast(mod, original_method, method_sig)
def self.create_validator_method_fast(mod, original_method, method_sig, original_visibility)
if method_sig.return_type.is_a?(T::Private::Types::Void)
raise 'Should have used create_validator_procedure_fast'
end
# trampoline to reduce stack frame size
if method_sig.arg_types.empty?
create_validator_method_fast0(mod, original_method, method_sig, method_sig.return_type.raw_type)
create_validator_method_fast0(mod, original_method, method_sig, original_visibility, method_sig.return_type.raw_type)
elsif method_sig.arg_types.length == 1
create_validator_method_fast1(mod, original_method, method_sig, method_sig.return_type.raw_type,
create_validator_method_fast1(mod, original_method, method_sig, original_visibility, method_sig.return_type.raw_type,
method_sig.arg_types[0][1].raw_type)
elsif method_sig.arg_types.length == 2
create_validator_method_fast2(mod, original_method, method_sig, method_sig.return_type.raw_type,
create_validator_method_fast2(mod, original_method, method_sig, original_visibility, method_sig.return_type.raw_type,
method_sig.arg_types[0][1].raw_type,
method_sig.arg_types[1][1].raw_type)
elsif method_sig.arg_types.length == 3
create_validator_method_fast3(mod, original_method, method_sig, method_sig.return_type.raw_type,
create_validator_method_fast3(mod, original_method, method_sig, original_visibility, method_sig.return_type.raw_type,
method_sig.arg_types[0][1].raw_type,
method_sig.arg_types[1][1].raw_type,
method_sig.arg_types[2][1].raw_type)
elsif method_sig.arg_types.length == 4
create_validator_method_fast4(mod, original_method, method_sig, method_sig.return_type.raw_type,
create_validator_method_fast4(mod, original_method, method_sig, original_visibility, method_sig.return_type.raw_type,
method_sig.arg_types[0][1].raw_type,
method_sig.arg_types[1][1].raw_type,
method_sig.arg_types[2][1].raw_type,
@ -36,8 +36,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_fast0(mod, original_method, method_sig, return_type)
mod.send(:define_method, method_sig.method_name) do |&blk|
def self.create_validator_method_fast0(mod, original_method, method_sig, original_visibility, return_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |&blk|
# This method is a manually sped-up version of more general code in `validate_call`
# The following line breaks are intentional to show nice pry message
@ -73,8 +73,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_fast1(mod, original_method, method_sig, return_type, arg0_type)
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
def self.create_validator_method_fast1(mod, original_method, method_sig, original_visibility, return_type, arg0_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -122,8 +122,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_fast2(mod, original_method, method_sig, return_type, arg0_type, arg1_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
def self.create_validator_method_fast2(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -183,8 +183,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_fast3(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
def self.create_validator_method_fast3(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -256,8 +256,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_fast4(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
def self.create_validator_method_fast4(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, arg3, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -341,24 +341,24 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_fast(mod, original_method, method_sig)
def self.create_validator_procedure_fast(mod, original_method, method_sig, original_visibility)
# trampoline to reduce stack frame size
if method_sig.arg_types.empty?
create_validator_procedure_fast0(mod, original_method, method_sig)
create_validator_procedure_fast0(mod, original_method, method_sig, original_visibility)
elsif method_sig.arg_types.length == 1
create_validator_procedure_fast1(mod, original_method, method_sig,
create_validator_procedure_fast1(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1].raw_type)
elsif method_sig.arg_types.length == 2
create_validator_procedure_fast2(mod, original_method, method_sig,
create_validator_procedure_fast2(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1].raw_type,
method_sig.arg_types[1][1].raw_type)
elsif method_sig.arg_types.length == 3
create_validator_procedure_fast3(mod, original_method, method_sig,
create_validator_procedure_fast3(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1].raw_type,
method_sig.arg_types[1][1].raw_type,
method_sig.arg_types[2][1].raw_type)
elsif method_sig.arg_types.length == 4
create_validator_procedure_fast4(mod, original_method, method_sig,
create_validator_procedure_fast4(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1].raw_type,
method_sig.arg_types[1][1].raw_type,
method_sig.arg_types[2][1].raw_type,
@ -368,8 +368,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_fast0(mod, original_method, method_sig)
mod.send(:define_method, method_sig.method_name) do |&blk|
def self.create_validator_procedure_fast0(mod, original_method, method_sig, original_visibility)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |&blk|
# This method is a manually sped-up version of more general code in `validate_call`
# The following line breaks are intentional to show nice pry message
@ -391,8 +391,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_fast1(mod, original_method, method_sig, arg0_type)
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
def self.create_validator_procedure_fast1(mod, original_method, method_sig, original_visibility, arg0_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -426,8 +426,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_fast2(mod, original_method, method_sig, arg0_type, arg1_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
def self.create_validator_procedure_fast2(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -473,8 +473,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_fast3(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
def self.create_validator_procedure_fast3(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -532,8 +532,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_fast4(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type, arg3_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
def self.create_validator_procedure_fast4(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type, arg3_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, arg3, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0.is_a?(arg0_type)
CallValidation.report_error(
@ -603,27 +603,27 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_medium(mod, original_method, method_sig)
def self.create_validator_method_medium(mod, original_method, method_sig, original_visibility)
if method_sig.return_type.is_a?(T::Private::Types::Void)
raise 'Should have used create_validator_procedure_medium'
end
# trampoline to reduce stack frame size
if method_sig.arg_types.empty?
create_validator_method_medium0(mod, original_method, method_sig, method_sig.return_type)
create_validator_method_medium0(mod, original_method, method_sig, original_visibility, method_sig.return_type)
elsif method_sig.arg_types.length == 1
create_validator_method_medium1(mod, original_method, method_sig, method_sig.return_type,
create_validator_method_medium1(mod, original_method, method_sig, original_visibility, method_sig.return_type,
method_sig.arg_types[0][1])
elsif method_sig.arg_types.length == 2
create_validator_method_medium2(mod, original_method, method_sig, method_sig.return_type,
create_validator_method_medium2(mod, original_method, method_sig, original_visibility, method_sig.return_type,
method_sig.arg_types[0][1],
method_sig.arg_types[1][1])
elsif method_sig.arg_types.length == 3
create_validator_method_medium3(mod, original_method, method_sig, method_sig.return_type,
create_validator_method_medium3(mod, original_method, method_sig, original_visibility, method_sig.return_type,
method_sig.arg_types[0][1],
method_sig.arg_types[1][1],
method_sig.arg_types[2][1])
elsif method_sig.arg_types.length == 4
create_validator_method_medium4(mod, original_method, method_sig, method_sig.return_type,
create_validator_method_medium4(mod, original_method, method_sig, original_visibility, method_sig.return_type,
method_sig.arg_types[0][1],
method_sig.arg_types[1][1],
method_sig.arg_types[2][1],
@ -633,8 +633,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_medium0(mod, original_method, method_sig, return_type)
mod.send(:define_method, method_sig.method_name) do |&blk|
def self.create_validator_method_medium0(mod, original_method, method_sig, original_visibility, return_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |&blk|
# This method is a manually sped-up version of more general code in `validate_call`
# The following line breaks are intentional to show nice pry message
@ -670,8 +670,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_medium1(mod, original_method, method_sig, return_type, arg0_type)
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
def self.create_validator_method_medium1(mod, original_method, method_sig, original_visibility, return_type, arg0_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(
@ -719,8 +719,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_medium2(mod, original_method, method_sig, return_type, arg0_type, arg1_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
def self.create_validator_method_medium2(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(
@ -780,8 +780,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_medium3(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
def self.create_validator_method_medium3(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(
@ -853,8 +853,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_method_medium4(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
def self.create_validator_method_medium4(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, arg3, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(
@ -938,24 +938,24 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_medium(mod, original_method, method_sig)
def self.create_validator_procedure_medium(mod, original_method, method_sig, original_visibility)
# trampoline to reduce stack frame size
if method_sig.arg_types.empty?
create_validator_procedure_medium0(mod, original_method, method_sig)
create_validator_procedure_medium0(mod, original_method, method_sig, original_visibility)
elsif method_sig.arg_types.length == 1
create_validator_procedure_medium1(mod, original_method, method_sig,
create_validator_procedure_medium1(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1])
elsif method_sig.arg_types.length == 2
create_validator_procedure_medium2(mod, original_method, method_sig,
create_validator_procedure_medium2(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1],
method_sig.arg_types[1][1])
elsif method_sig.arg_types.length == 3
create_validator_procedure_medium3(mod, original_method, method_sig,
create_validator_procedure_medium3(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1],
method_sig.arg_types[1][1],
method_sig.arg_types[2][1])
elsif method_sig.arg_types.length == 4
create_validator_procedure_medium4(mod, original_method, method_sig,
create_validator_procedure_medium4(mod, original_method, method_sig, original_visibility,
method_sig.arg_types[0][1],
method_sig.arg_types[1][1],
method_sig.arg_types[2][1],
@ -965,8 +965,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_medium0(mod, original_method, method_sig)
mod.send(:define_method, method_sig.method_name) do |&blk|
def self.create_validator_procedure_medium0(mod, original_method, method_sig, original_visibility)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |&blk|
# This method is a manually sped-up version of more general code in `validate_call`
# The following line breaks are intentional to show nice pry message
@ -988,8 +988,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_medium1(mod, original_method, method_sig, arg0_type)
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
def self.create_validator_procedure_medium1(mod, original_method, method_sig, original_visibility, arg0_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(
@ -1023,8 +1023,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_medium2(mod, original_method, method_sig, arg0_type, arg1_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
def self.create_validator_procedure_medium2(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(
@ -1070,8 +1070,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_medium3(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
def self.create_validator_procedure_medium3(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(
@ -1129,8 +1129,8 @@ module T::Private::Methods::CallValidation
end
end
def self.create_validator_procedure_medium4(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type, arg3_type)
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
def self.create_validator_procedure_medium4(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type, arg3_type)
T::Private::ClassUtils.def_with_visibility(mod, method_sig.method_name, original_visibility) do |arg0, arg1, arg2, arg3, &blk|
# This method is a manually sped-up version of more general code in `validate_call`
unless arg0_type.valid?(arg0)
CallValidation.report_error(

View File

@ -300,7 +300,9 @@ class T::Props::Decorator
.checked(:never)
end
private def prop_nilable?(cls, rules)
T::Utils::Nilable.is_union_with_nilclass(cls) || (cls == T.untyped && rules.key?(:default) && rules[:default].nil?)
# NB: `prop` and `const` do not `T::Utils::coerce the type of the prop if it is a `Module`,
# hence the bare `NilClass` check.
T::Utils::Nilable.is_union_with_nilclass(cls) || ((cls == T.untyped || cls == NilClass) && rules.key?(:default) && rules[:default].nil?)
end
# checked(:never) - Rules hash is expensive to check

View File

@ -20,7 +20,7 @@ module T::Types
# overrides Base
def name
"T.all(#{@types.map(&:name).sort.join(', ')})"
"T.all(#{@types.map(&:name).compact.sort.join(', ')})"
end
# overrides Base

View File

@ -32,7 +32,7 @@ module T::Utils
# in some cases this runtime check can be very expensive, especially
# with large collections of objects.
def self.check_type_recursive!(value, type)
T::Private::Casts.cast_recursive(value, type, cast_method: "T.check_type_recursive!")
T::Private::Casts.cast_recursive(value, type, "T.check_type_recursive!")
end
# Returns the set of all methods (public, protected, private) defined on a module or its