Merge pull request #13977 from Bo98/sorbet-update
Update Sorbet to 0.5.10461
This commit is contained in:
commit
a7c4de27e0
@ -159,13 +159,13 @@ GEM
|
|||||||
simplecov (~> 0.19)
|
simplecov (~> 0.19)
|
||||||
simplecov-html (0.12.3)
|
simplecov-html (0.12.3)
|
||||||
simplecov_json_formatter (0.1.4)
|
simplecov_json_formatter (0.1.4)
|
||||||
sorbet (0.5.10175)
|
sorbet (0.5.10461)
|
||||||
sorbet-static (= 0.5.10175)
|
sorbet-static (= 0.5.10461)
|
||||||
sorbet-runtime (0.5.10175)
|
sorbet-runtime (0.5.10461)
|
||||||
sorbet-static (0.5.10175-universal-darwin-14)
|
sorbet-static (0.5.10461-universal-darwin-14)
|
||||||
sorbet-static-and-runtime (0.5.10175)
|
sorbet-static-and-runtime (0.5.10461)
|
||||||
sorbet (= 0.5.10175)
|
sorbet (= 0.5.10461)
|
||||||
sorbet-runtime (= 0.5.10175)
|
sorbet-runtime (= 0.5.10461)
|
||||||
spoom (1.1.11)
|
spoom (1.1.11)
|
||||||
sorbet (>= 0.5.9204)
|
sorbet (>= 0.5.9204)
|
||||||
sorbet-runtime (>= 0.5.9204)
|
sorbet-runtime (>= 0.5.9204)
|
||||||
|
@ -3642,19 +3642,6 @@ class OpenSSL::BN
|
|||||||
def negative?(); end
|
def negative?(); end
|
||||||
end
|
end
|
||||||
|
|
||||||
module OpenSSL::KDF
|
|
||||||
end
|
|
||||||
|
|
||||||
class OpenSSL::KDF::KDFError
|
|
||||||
end
|
|
||||||
|
|
||||||
class OpenSSL::KDF::KDFError
|
|
||||||
end
|
|
||||||
|
|
||||||
module OpenSSL::KDF
|
|
||||||
def self.pbkdf2_hmac(*arg); end
|
|
||||||
end
|
|
||||||
|
|
||||||
class OpenSSL::OCSP::Request
|
class OpenSSL::OCSP::Request
|
||||||
def signed?(); end
|
def signed?(); end
|
||||||
end
|
end
|
||||||
@ -6700,9 +6687,6 @@ class URI::File
|
|||||||
DEFAULT_PORT = ::T.let(nil, ::T.untyped)
|
DEFAULT_PORT = ::T.let(nil, ::T.untyped)
|
||||||
end
|
end
|
||||||
|
|
||||||
class URI::File
|
|
||||||
end
|
|
||||||
|
|
||||||
class URI::HTTP
|
class URI::HTTP
|
||||||
def buffer_open(buf, proxy, options); end
|
def buffer_open(buf, proxy, options); end
|
||||||
end
|
end
|
||||||
@ -6745,10 +6729,6 @@ class URI::MailTo
|
|||||||
def initialize(*arg); end
|
def initialize(*arg); end
|
||||||
end
|
end
|
||||||
|
|
||||||
URI::Parser = URI::RFC2396_Parser
|
|
||||||
|
|
||||||
URI::REGEXP = URI::RFC2396_REGEXP
|
|
||||||
|
|
||||||
class URI::RFC2396_Parser
|
class URI::RFC2396_Parser
|
||||||
def initialize(opts=T.unsafe(nil)); end
|
def initialize(opts=T.unsafe(nil)); end
|
||||||
end
|
end
|
||||||
|
@ -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/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/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/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/parlour-8.0.0/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/patchelf-1.3.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"
|
$:.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_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-0.21.2/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/simplecov-cobertura-2.1.0/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-static-0.5.10461-universal-darwin-21/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/sorbet-0.5.10175/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.10175/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/thor-1.2.1/lib"
|
||||||
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/spoom-1.1.11/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"
|
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/yard-0.9.28/lib"
|
||||||
|
@ -130,7 +130,7 @@ module T
|
|||||||
def self.cast(value, type, checked: true)
|
def self.cast(value, type, checked: true)
|
||||||
return value unless checked
|
return value unless checked
|
||||||
|
|
||||||
Private::Casts.cast(value, type, cast_method: "T.cast")
|
Private::Casts.cast(value, type, "T.cast")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Tells the typechecker to declare a variable of type `type`. Use
|
# Tells the typechecker to declare a variable of type `type`. Use
|
||||||
@ -145,7 +145,7 @@ module T
|
|||||||
def self.let(value, type, checked: true)
|
def self.let(value, type, checked: true)
|
||||||
return value unless checked
|
return value unless checked
|
||||||
|
|
||||||
Private::Casts.cast(value, type, cast_method: "T.let")
|
Private::Casts.cast(value, type, "T.let")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Tells the type checker to treat `self` in the current block as `type`.
|
# 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)
|
def self.bind(value, type, checked: true)
|
||||||
return value unless checked
|
return value unless checked
|
||||||
|
|
||||||
Private::Casts.cast(value, type, cast_method: "T.bind")
|
Private::Casts.cast(value, type, "T.bind")
|
||||||
end
|
end
|
||||||
|
|
||||||
# Tells the typechecker to ensure that `value` is of type `type` (if not, the typechecker will
|
# 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)
|
def self.assert_type!(value, type, checked: true)
|
||||||
return value unless checked
|
return value unless checked
|
||||||
|
|
||||||
Private::Casts.cast(value, type, cast_method: "T.assert_type!")
|
Private::Casts.cast(value, type, "T.assert_type!")
|
||||||
end
|
end
|
||||||
|
|
||||||
# For the static type checker, strips all type information from a value
|
# For the static type checker, strips all type information from a value
|
@ -11,6 +11,13 @@ module T::Helpers
|
|||||||
### Class/Module Helpers ###
|
### Class/Module Helpers ###
|
||||||
|
|
||||||
def abstract!
|
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)
|
Private::Abstract::Declare.declare_abstract(self, type: :abstract)
|
||||||
end
|
end
|
||||||
|
|
@ -71,6 +71,10 @@ class T::InterfaceWrapper
|
|||||||
target_obj.send(method_name, *args, &blk)
|
target_obj.send(method_name, *args, &blk)
|
||||||
end
|
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)
|
if target_obj.singleton_class.public_method_defined?(method_name)
|
||||||
# no-op, it's already public
|
# no-op, it's already public
|
||||||
elsif target_obj.singleton_class.protected_method_defined?(method_name)
|
elsif target_obj.singleton_class.protected_method_defined?(method_name)
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
module T::Private
|
module T::Private
|
||||||
module Casts
|
module Casts
|
||||||
def self.cast(value, type, cast_method:)
|
def self.cast(value, type, cast_method)
|
||||||
begin
|
begin
|
||||||
error = T::Utils.coerce(type).error_message_for_obj(value)
|
error = T::Utils.coerce(type).error_message_for_obj(value)
|
||||||
return value unless error
|
return value unless error
|
||||||
@ -22,7 +22,7 @@ module T::Private
|
|||||||
# there's a lot of shared logic with the above one, but factoring
|
# 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
|
# it out like this makes it easier to hopefully one day delete
|
||||||
# this one
|
# this one
|
||||||
def self.cast_recursive(value, type, cast_method:)
|
def self.cast_recursive(value, type, cast_method)
|
||||||
begin
|
begin
|
||||||
error = T::Utils.coerce(type).error_message_for_obj_recursive(value)
|
error = T::Utils.coerce(type).error_message_for_obj_recursive(value)
|
||||||
return value unless error
|
return value unless error
|
@ -69,6 +69,27 @@ module T::Private::ClassUtils
|
|||||||
end
|
end
|
||||||
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
|
# 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
|
# 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
|
# 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
|
overwritten = original_owner == mod
|
||||||
T::Configuration.without_ruby_warnings do
|
T::Configuration.without_ruby_warnings do
|
||||||
T::Private::DeclState.current.without_on_method_added do
|
T::Private::DeclState.current.without_on_method_added do
|
||||||
mod.send(:define_method, name, &blk)
|
def_with_visibility(mod, name, original_visibility, &blk)
|
||||||
if blk.arity < 0 && mod.respond_to?(:ruby2_keywords, true)
|
|
||||||
mod.send(:ruby2_keywords, name)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
mod.send(original_visibility, name)
|
|
||||||
new_method = mod.instance_method(name)
|
new_method = mod.instance_method(name)
|
||||||
|
|
||||||
ReplacedMethod.new(mod, original_method, new_method, overwritten, original_visibility)
|
ReplacedMethod.new(mod, original_method, new_method, overwritten, original_visibility)
|
@ -40,9 +40,8 @@ module T::Private::Methods::CallValidation
|
|||||||
T::Configuration.without_ruby_warnings do
|
T::Configuration.without_ruby_warnings do
|
||||||
# get all the shims out of the way and put back the original method
|
# get all the shims out of the way and put back the original method
|
||||||
T::Private::DeclState.current.without_on_method_added do
|
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
|
end
|
||||||
mod.send(original_visibility, method_sig.method_name)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Return the newly created method (or the original one if we didn't replace it)
|
# 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::Configuration.without_ruby_warnings do
|
||||||
T::Private::DeclState.current.without_on_method_added do
|
T::Private::DeclState.current.without_on_method_added do
|
||||||
if simple_method
|
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
|
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)
|
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
|
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
|
else
|
||||||
create_validator_slow(mod, original_method, method_sig)
|
create_validator_slow(mod, original_method, method_sig, original_visibility)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
mod.send(original_visibility, method_sig.method_name)
|
||||||
end
|
end
|
||||||
mod.send(original_visibility, method_sig.method_name)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_slow(mod, original_method, method_sig)
|
def self.create_validator_slow(mod, original_method, method_sig, original_visibility)
|
||||||
mod.send(:define_method, method_sig.method_name) do |*args, &blk|
|
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)
|
CallValidation.validate_call(self, original_method, method_sig, args, blk)
|
||||||
end
|
end
|
||||||
if mod.respond_to?(:ruby2_keywords, true)
|
|
||||||
mod.send(:ruby2_keywords, method_sig.method_name)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.validate_call(instance, original_method, method_sig, args, blk)
|
def self.validate_call(instance, original_method, method_sig, args, blk)
|
@ -6,27 +6,27 @@
|
|||||||
# bazel test //gems/sorbet-runtime:update_call_validation
|
# bazel test //gems/sorbet-runtime:update_call_validation
|
||||||
|
|
||||||
module T::Private::Methods::CallValidation
|
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)
|
if method_sig.return_type.is_a?(T::Private::Types::Void)
|
||||||
raise 'Should have used create_validator_procedure_fast'
|
raise 'Should have used create_validator_procedure_fast'
|
||||||
end
|
end
|
||||||
# trampoline to reduce stack frame size
|
# trampoline to reduce stack frame size
|
||||||
if method_sig.arg_types.empty?
|
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
|
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)
|
method_sig.arg_types[0][1].raw_type)
|
||||||
elsif method_sig.arg_types.length == 2
|
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[0][1].raw_type,
|
||||||
method_sig.arg_types[1][1].raw_type)
|
method_sig.arg_types[1][1].raw_type)
|
||||||
elsif method_sig.arg_types.length == 3
|
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[0][1].raw_type,
|
||||||
method_sig.arg_types[1][1].raw_type,
|
method_sig.arg_types[1][1].raw_type,
|
||||||
method_sig.arg_types[2][1].raw_type)
|
method_sig.arg_types[2][1].raw_type)
|
||||||
elsif method_sig.arg_types.length == 4
|
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[0][1].raw_type,
|
||||||
method_sig.arg_types[1][1].raw_type,
|
method_sig.arg_types[1][1].raw_type,
|
||||||
method_sig.arg_types[2][1].raw_type,
|
method_sig.arg_types[2][1].raw_type,
|
||||||
@ -36,8 +36,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_fast0(mod, original_method, method_sig, return_type)
|
def self.create_validator_method_fast0(mod, original_method, method_sig, original_visibility, return_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |&blk|
|
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`
|
# 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
|
# The following line breaks are intentional to show nice pry message
|
||||||
|
|
||||||
@ -73,8 +73,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_fast1(mod, original_method, method_sig, return_type, arg0_type)
|
def self.create_validator_method_fast1(mod, original_method, method_sig, original_visibility, return_type, arg0_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -122,8 +122,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_fast2(mod, original_method, method_sig, return_type, arg0_type, arg1_type)
|
def self.create_validator_method_fast2(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -183,8 +183,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_fast3(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type)
|
def self.create_validator_method_fast3(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -256,8 +256,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_fast4(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
|
def self.create_validator_method_fast4(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -341,24 +341,24 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
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
|
# trampoline to reduce stack frame size
|
||||||
if method_sig.arg_types.empty?
|
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
|
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)
|
method_sig.arg_types[0][1].raw_type)
|
||||||
elsif method_sig.arg_types.length == 2
|
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[0][1].raw_type,
|
||||||
method_sig.arg_types[1][1].raw_type)
|
method_sig.arg_types[1][1].raw_type)
|
||||||
elsif method_sig.arg_types.length == 3
|
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[0][1].raw_type,
|
||||||
method_sig.arg_types[1][1].raw_type,
|
method_sig.arg_types[1][1].raw_type,
|
||||||
method_sig.arg_types[2][1].raw_type)
|
method_sig.arg_types[2][1].raw_type)
|
||||||
elsif method_sig.arg_types.length == 4
|
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[0][1].raw_type,
|
||||||
method_sig.arg_types[1][1].raw_type,
|
method_sig.arg_types[1][1].raw_type,
|
||||||
method_sig.arg_types[2][1].raw_type,
|
method_sig.arg_types[2][1].raw_type,
|
||||||
@ -368,8 +368,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_fast0(mod, original_method, method_sig)
|
def self.create_validator_procedure_fast0(mod, original_method, method_sig, original_visibility)
|
||||||
mod.send(:define_method, method_sig.method_name) do |&blk|
|
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`
|
# 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
|
# The following line breaks are intentional to show nice pry message
|
||||||
|
|
||||||
@ -391,8 +391,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_fast1(mod, original_method, method_sig, arg0_type)
|
def self.create_validator_procedure_fast1(mod, original_method, method_sig, original_visibility, arg0_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -426,8 +426,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_fast2(mod, original_method, method_sig, arg0_type, arg1_type)
|
def self.create_validator_procedure_fast2(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -473,8 +473,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_fast3(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type)
|
def self.create_validator_procedure_fast3(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -532,8 +532,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_fast4(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type, arg3_type)
|
def self.create_validator_procedure_fast4(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type, arg3_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -603,27 +603,27 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
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)
|
if method_sig.return_type.is_a?(T::Private::Types::Void)
|
||||||
raise 'Should have used create_validator_procedure_medium'
|
raise 'Should have used create_validator_procedure_medium'
|
||||||
end
|
end
|
||||||
# trampoline to reduce stack frame size
|
# trampoline to reduce stack frame size
|
||||||
if method_sig.arg_types.empty?
|
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
|
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])
|
method_sig.arg_types[0][1])
|
||||||
elsif method_sig.arg_types.length == 2
|
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[0][1],
|
||||||
method_sig.arg_types[1][1])
|
method_sig.arg_types[1][1])
|
||||||
elsif method_sig.arg_types.length == 3
|
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[0][1],
|
||||||
method_sig.arg_types[1][1],
|
method_sig.arg_types[1][1],
|
||||||
method_sig.arg_types[2][1])
|
method_sig.arg_types[2][1])
|
||||||
elsif method_sig.arg_types.length == 4
|
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[0][1],
|
||||||
method_sig.arg_types[1][1],
|
method_sig.arg_types[1][1],
|
||||||
method_sig.arg_types[2][1],
|
method_sig.arg_types[2][1],
|
||||||
@ -633,8 +633,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_medium0(mod, original_method, method_sig, return_type)
|
def self.create_validator_method_medium0(mod, original_method, method_sig, original_visibility, return_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |&blk|
|
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`
|
# 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
|
# The following line breaks are intentional to show nice pry message
|
||||||
|
|
||||||
@ -670,8 +670,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_medium1(mod, original_method, method_sig, return_type, arg0_type)
|
def self.create_validator_method_medium1(mod, original_method, method_sig, original_visibility, return_type, arg0_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -719,8 +719,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_medium2(mod, original_method, method_sig, return_type, arg0_type, arg1_type)
|
def self.create_validator_method_medium2(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -780,8 +780,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_medium3(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type)
|
def self.create_validator_method_medium3(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -853,8 +853,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_medium4(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
|
def self.create_validator_method_medium4(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -938,24 +938,24 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
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
|
# trampoline to reduce stack frame size
|
||||||
if method_sig.arg_types.empty?
|
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
|
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])
|
method_sig.arg_types[0][1])
|
||||||
elsif method_sig.arg_types.length == 2
|
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[0][1],
|
||||||
method_sig.arg_types[1][1])
|
method_sig.arg_types[1][1])
|
||||||
elsif method_sig.arg_types.length == 3
|
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[0][1],
|
||||||
method_sig.arg_types[1][1],
|
method_sig.arg_types[1][1],
|
||||||
method_sig.arg_types[2][1])
|
method_sig.arg_types[2][1])
|
||||||
elsif method_sig.arg_types.length == 4
|
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[0][1],
|
||||||
method_sig.arg_types[1][1],
|
method_sig.arg_types[1][1],
|
||||||
method_sig.arg_types[2][1],
|
method_sig.arg_types[2][1],
|
||||||
@ -965,8 +965,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_medium0(mod, original_method, method_sig)
|
def self.create_validator_procedure_medium0(mod, original_method, method_sig, original_visibility)
|
||||||
mod.send(:define_method, method_sig.method_name) do |&blk|
|
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`
|
# 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
|
# The following line breaks are intentional to show nice pry message
|
||||||
|
|
||||||
@ -988,8 +988,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_medium1(mod, original_method, method_sig, arg0_type)
|
def self.create_validator_procedure_medium1(mod, original_method, method_sig, original_visibility, arg0_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -1023,8 +1023,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_medium2(mod, original_method, method_sig, arg0_type, arg1_type)
|
def self.create_validator_procedure_medium2(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -1070,8 +1070,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_medium3(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type)
|
def self.create_validator_procedure_medium3(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -1129,8 +1129,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_medium4(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type, arg3_type)
|
def self.create_validator_procedure_medium4(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type, arg3_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
@ -6,27 +6,27 @@
|
|||||||
# bazel test //gems/sorbet-runtime:update_call_validation
|
# bazel test //gems/sorbet-runtime:update_call_validation
|
||||||
|
|
||||||
module T::Private::Methods::CallValidation
|
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)
|
if method_sig.return_type.is_a?(T::Private::Types::Void)
|
||||||
raise 'Should have used create_validator_procedure_fast'
|
raise 'Should have used create_validator_procedure_fast'
|
||||||
end
|
end
|
||||||
# trampoline to reduce stack frame size
|
# trampoline to reduce stack frame size
|
||||||
if method_sig.arg_types.empty?
|
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
|
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)
|
method_sig.arg_types[0][1].raw_type)
|
||||||
elsif method_sig.arg_types.length == 2
|
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[0][1].raw_type,
|
||||||
method_sig.arg_types[1][1].raw_type)
|
method_sig.arg_types[1][1].raw_type)
|
||||||
elsif method_sig.arg_types.length == 3
|
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[0][1].raw_type,
|
||||||
method_sig.arg_types[1][1].raw_type,
|
method_sig.arg_types[1][1].raw_type,
|
||||||
method_sig.arg_types[2][1].raw_type)
|
method_sig.arg_types[2][1].raw_type)
|
||||||
elsif method_sig.arg_types.length == 4
|
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[0][1].raw_type,
|
||||||
method_sig.arg_types[1][1].raw_type,
|
method_sig.arg_types[1][1].raw_type,
|
||||||
method_sig.arg_types[2][1].raw_type,
|
method_sig.arg_types[2][1].raw_type,
|
||||||
@ -36,8 +36,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_fast0(mod, original_method, method_sig, return_type)
|
def self.create_validator_method_fast0(mod, original_method, method_sig, original_visibility, return_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |&blk|
|
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`
|
# 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
|
# The following line breaks are intentional to show nice pry message
|
||||||
|
|
||||||
@ -73,8 +73,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_fast1(mod, original_method, method_sig, return_type, arg0_type)
|
def self.create_validator_method_fast1(mod, original_method, method_sig, original_visibility, return_type, arg0_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -122,8 +122,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_fast2(mod, original_method, method_sig, return_type, arg0_type, arg1_type)
|
def self.create_validator_method_fast2(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -183,8 +183,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_fast3(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type)
|
def self.create_validator_method_fast3(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -256,8 +256,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_fast4(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
|
def self.create_validator_method_fast4(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -341,24 +341,24 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
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
|
# trampoline to reduce stack frame size
|
||||||
if method_sig.arg_types.empty?
|
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
|
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)
|
method_sig.arg_types[0][1].raw_type)
|
||||||
elsif method_sig.arg_types.length == 2
|
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[0][1].raw_type,
|
||||||
method_sig.arg_types[1][1].raw_type)
|
method_sig.arg_types[1][1].raw_type)
|
||||||
elsif method_sig.arg_types.length == 3
|
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[0][1].raw_type,
|
||||||
method_sig.arg_types[1][1].raw_type,
|
method_sig.arg_types[1][1].raw_type,
|
||||||
method_sig.arg_types[2][1].raw_type)
|
method_sig.arg_types[2][1].raw_type)
|
||||||
elsif method_sig.arg_types.length == 4
|
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[0][1].raw_type,
|
||||||
method_sig.arg_types[1][1].raw_type,
|
method_sig.arg_types[1][1].raw_type,
|
||||||
method_sig.arg_types[2][1].raw_type,
|
method_sig.arg_types[2][1].raw_type,
|
||||||
@ -368,8 +368,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_fast0(mod, original_method, method_sig)
|
def self.create_validator_procedure_fast0(mod, original_method, method_sig, original_visibility)
|
||||||
mod.send(:define_method, method_sig.method_name) do |&blk|
|
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`
|
# 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
|
# The following line breaks are intentional to show nice pry message
|
||||||
|
|
||||||
@ -391,8 +391,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_fast1(mod, original_method, method_sig, arg0_type)
|
def self.create_validator_procedure_fast1(mod, original_method, method_sig, original_visibility, arg0_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -426,8 +426,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_fast2(mod, original_method, method_sig, arg0_type, arg1_type)
|
def self.create_validator_procedure_fast2(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -473,8 +473,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_fast3(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type)
|
def self.create_validator_procedure_fast3(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -532,8 +532,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_fast4(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type, arg3_type)
|
def self.create_validator_procedure_fast4(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type, arg3_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0.is_a?(arg0_type)
|
unless arg0.is_a?(arg0_type)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -603,27 +603,27 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
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)
|
if method_sig.return_type.is_a?(T::Private::Types::Void)
|
||||||
raise 'Should have used create_validator_procedure_medium'
|
raise 'Should have used create_validator_procedure_medium'
|
||||||
end
|
end
|
||||||
# trampoline to reduce stack frame size
|
# trampoline to reduce stack frame size
|
||||||
if method_sig.arg_types.empty?
|
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
|
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])
|
method_sig.arg_types[0][1])
|
||||||
elsif method_sig.arg_types.length == 2
|
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[0][1],
|
||||||
method_sig.arg_types[1][1])
|
method_sig.arg_types[1][1])
|
||||||
elsif method_sig.arg_types.length == 3
|
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[0][1],
|
||||||
method_sig.arg_types[1][1],
|
method_sig.arg_types[1][1],
|
||||||
method_sig.arg_types[2][1])
|
method_sig.arg_types[2][1])
|
||||||
elsif method_sig.arg_types.length == 4
|
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[0][1],
|
||||||
method_sig.arg_types[1][1],
|
method_sig.arg_types[1][1],
|
||||||
method_sig.arg_types[2][1],
|
method_sig.arg_types[2][1],
|
||||||
@ -633,8 +633,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_medium0(mod, original_method, method_sig, return_type)
|
def self.create_validator_method_medium0(mod, original_method, method_sig, original_visibility, return_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |&blk|
|
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`
|
# 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
|
# The following line breaks are intentional to show nice pry message
|
||||||
|
|
||||||
@ -670,8 +670,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_medium1(mod, original_method, method_sig, return_type, arg0_type)
|
def self.create_validator_method_medium1(mod, original_method, method_sig, original_visibility, return_type, arg0_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -719,8 +719,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_medium2(mod, original_method, method_sig, return_type, arg0_type, arg1_type)
|
def self.create_validator_method_medium2(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -780,8 +780,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_medium3(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type)
|
def self.create_validator_method_medium3(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -853,8 +853,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_method_medium4(mod, original_method, method_sig, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
|
def self.create_validator_method_medium4(mod, original_method, method_sig, original_visibility, return_type, arg0_type, arg1_type, arg2_type, arg3_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -938,24 +938,24 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
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
|
# trampoline to reduce stack frame size
|
||||||
if method_sig.arg_types.empty?
|
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
|
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])
|
method_sig.arg_types[0][1])
|
||||||
elsif method_sig.arg_types.length == 2
|
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[0][1],
|
||||||
method_sig.arg_types[1][1])
|
method_sig.arg_types[1][1])
|
||||||
elsif method_sig.arg_types.length == 3
|
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[0][1],
|
||||||
method_sig.arg_types[1][1],
|
method_sig.arg_types[1][1],
|
||||||
method_sig.arg_types[2][1])
|
method_sig.arg_types[2][1])
|
||||||
elsif method_sig.arg_types.length == 4
|
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[0][1],
|
||||||
method_sig.arg_types[1][1],
|
method_sig.arg_types[1][1],
|
||||||
method_sig.arg_types[2][1],
|
method_sig.arg_types[2][1],
|
||||||
@ -965,8 +965,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_medium0(mod, original_method, method_sig)
|
def self.create_validator_procedure_medium0(mod, original_method, method_sig, original_visibility)
|
||||||
mod.send(:define_method, method_sig.method_name) do |&blk|
|
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`
|
# 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
|
# The following line breaks are intentional to show nice pry message
|
||||||
|
|
||||||
@ -988,8 +988,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_medium1(mod, original_method, method_sig, arg0_type)
|
def self.create_validator_procedure_medium1(mod, original_method, method_sig, original_visibility, arg0_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -1023,8 +1023,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_medium2(mod, original_method, method_sig, arg0_type, arg1_type)
|
def self.create_validator_procedure_medium2(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -1070,8 +1070,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_medium3(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type)
|
def self.create_validator_procedure_medium3(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
||||||
@ -1129,8 +1129,8 @@ module T::Private::Methods::CallValidation
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create_validator_procedure_medium4(mod, original_method, method_sig, arg0_type, arg1_type, arg2_type, arg3_type)
|
def self.create_validator_procedure_medium4(mod, original_method, method_sig, original_visibility, arg0_type, arg1_type, arg2_type, arg3_type)
|
||||||
mod.send(:define_method, method_sig.method_name) do |arg0, arg1, arg2, arg3, &blk|
|
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`
|
# This method is a manually sped-up version of more general code in `validate_call`
|
||||||
unless arg0_type.valid?(arg0)
|
unless arg0_type.valid?(arg0)
|
||||||
CallValidation.report_error(
|
CallValidation.report_error(
|
@ -300,7 +300,9 @@ class T::Props::Decorator
|
|||||||
.checked(:never)
|
.checked(:never)
|
||||||
end
|
end
|
||||||
private def prop_nilable?(cls, rules)
|
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
|
end
|
||||||
|
|
||||||
# checked(:never) - Rules hash is expensive to check
|
# checked(:never) - Rules hash is expensive to check
|
@ -20,7 +20,7 @@ module T::Types
|
|||||||
|
|
||||||
# overrides Base
|
# overrides Base
|
||||||
def name
|
def name
|
||||||
"T.all(#{@types.map(&:name).sort.join(', ')})"
|
"T.all(#{@types.map(&:name).compact.sort.join(', ')})"
|
||||||
end
|
end
|
||||||
|
|
||||||
# overrides Base
|
# overrides Base
|
@ -32,7 +32,7 @@ module T::Utils
|
|||||||
# in some cases this runtime check can be very expensive, especially
|
# in some cases this runtime check can be very expensive, especially
|
||||||
# with large collections of objects.
|
# with large collections of objects.
|
||||||
def self.check_type_recursive!(value, type)
|
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
|
end
|
||||||
|
|
||||||
# Returns the set of all methods (public, protected, private) defined on a module or its
|
# Returns the set of all methods (public, protected, private) defined on a module or its
|
@ -68,12 +68,12 @@ class Version
|
|||||||
NULL_TOKEN
|
NULL_TOKEN
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { override.returns(Version) }
|
sig { override.returns(T.self_type) }
|
||||||
def major_minor
|
def major_minor
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { override.returns(Version) }
|
sig { override.returns(T.self_type) }
|
||||||
def major_minor_patch
|
def major_minor_patch
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user