sorbet-runtime 0.6.12652 → 0.6.12665
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/types/configuration.rb +1 -8
- data/lib/types/private/methods/_methods.rb +4 -18
- data/lib/types/private/methods/call_validation.rb +10 -14
- data/lib/types/props/decorator.rb +5 -5
- data/lib/types/types/typed_enumerable.rb +6 -12
- metadata +4 -5
- data/lib/types/private/methods/call_validation_2_6.rb +0 -1729
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c32c6e3cd41e22ceb63eddc357e3aedda1fe714f84fbbacb95796c92d66b8874
|
|
4
|
+
data.tar.gz: cc616252f078d0d1cc1cda758f93ad8e89ba11d20b930efc1b75a0114707a37c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e49fcc765f48d581d0cbcd9fb00fc6d935882175581f90bf1f9fa9c51cc9efd53bfdfc5520d8f276d981258ab079121257225962415721ee90f803a51c31e1c1
|
|
7
|
+
data.tar.gz: 63e90c49b3fb5655444fc1d6e7559b9cbce4c8eb053f5e6e43030de47b1d3a9b62b8b9d06d1583edeeba061294326275b9f3747522e1bafe2bebb3f39742e082
|
data/lib/types/configuration.rb
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
module T::Configuration
|
|
5
|
-
# Cache this comparisonn to avoid two allocations all over the place.
|
|
6
|
-
AT_LEAST_RUBY_2_7 = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7')
|
|
7
|
-
|
|
8
5
|
# Announces to Sorbet that we are currently in a test environment, so it
|
|
9
6
|
# should treat any sigs which are marked `.checked(:tests)` as if they were
|
|
10
7
|
# just a normal sig.
|
|
@@ -448,11 +445,7 @@ module T::Configuration
|
|
|
448
445
|
MODULE_NAME = Module.instance_method(:name)
|
|
449
446
|
private_constant :MODULE_NAME
|
|
450
447
|
|
|
451
|
-
@default_module_name_mangler =
|
|
452
|
-
->(type) { MODULE_NAME.bind_call(type) }
|
|
453
|
-
else
|
|
454
|
-
->(type) { MODULE_NAME.bind(type).call } # rubocop:disable Performance/BindCall
|
|
455
|
-
end
|
|
448
|
+
@default_module_name_mangler = ->(type) { MODULE_NAME.bind_call(type) }
|
|
456
449
|
|
|
457
450
|
@module_name_mangler = nil
|
|
458
451
|
|
|
@@ -257,10 +257,8 @@ module T::Private::Methods
|
|
|
257
257
|
# make sure to keep changes in sync.
|
|
258
258
|
elsif method_sig.check_level == :always || (method_sig.check_level == :tests && T::Private::RuntimeLevels.check_tests?)
|
|
259
259
|
CallValidation.validate_call(self, original_method, method_sig, args, blk)
|
|
260
|
-
elsif T::Configuration::AT_LEAST_RUBY_2_7
|
|
261
|
-
original_method.bind_call(self, *args, &blk)
|
|
262
260
|
else
|
|
263
|
-
original_method.
|
|
261
|
+
original_method.bind_call(self, *args, &blk)
|
|
264
262
|
end
|
|
265
263
|
end
|
|
266
264
|
end
|
|
@@ -530,27 +528,15 @@ module T::Private::Methods
|
|
|
530
528
|
@old_hooks = nil
|
|
531
529
|
else
|
|
532
530
|
old_included = T::Private::ClassUtils.replace_method(Module, :included, true) do |arg|
|
|
533
|
-
|
|
534
|
-
old_included.bind_call(self, arg)
|
|
535
|
-
else
|
|
536
|
-
old_included.bind(self).call(arg) # rubocop:disable Performance/BindCall
|
|
537
|
-
end
|
|
531
|
+
old_included.bind_call(self, arg)
|
|
538
532
|
::T::Private::Methods._hook_impl(arg, false, self)
|
|
539
533
|
end
|
|
540
534
|
old_extended = T::Private::ClassUtils.replace_method(Module, :extended, true) do |arg|
|
|
541
|
-
|
|
542
|
-
old_extended.bind_call(self, arg)
|
|
543
|
-
else
|
|
544
|
-
old_extended.bind(self).call(arg) # rubocop:disable Performance/BindCall
|
|
545
|
-
end
|
|
535
|
+
old_extended.bind_call(self, arg)
|
|
546
536
|
::T::Private::Methods._hook_impl(arg, true, self)
|
|
547
537
|
end
|
|
548
538
|
old_inherited = T::Private::ClassUtils.replace_method(Class, :inherited, true) do |arg|
|
|
549
|
-
|
|
550
|
-
old_inherited.bind_call(self, arg)
|
|
551
|
-
else
|
|
552
|
-
old_inherited.bind(self).call(arg) # rubocop:disable Performance/BindCall
|
|
553
|
-
end
|
|
539
|
+
old_inherited.bind_call(self, arg)
|
|
554
540
|
::T::Private::Methods._hook_impl(arg, false, self)
|
|
555
541
|
end
|
|
556
542
|
@old_hooks = [old_included, old_extended, old_inherited]
|
|
@@ -79,13 +79,13 @@ module T::Private::Methods::CallValidation
|
|
|
79
79
|
|
|
80
80
|
# All the types for which valid? unconditionally returns `true`
|
|
81
81
|
return_is_ignorable =
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
method_sig.return_type.equal?(T::Types::Untyped::Private::INSTANCE) ||
|
|
83
|
+
method_sig.return_type.equal?(T::Types::Anything::Private::INSTANCE) ||
|
|
84
|
+
method_sig.return_type.equal?(T::Types::AttachedClassType::Private::INSTANCE) ||
|
|
85
|
+
method_sig.return_type.equal?(T::Types::SelfType::Private::INSTANCE) ||
|
|
86
|
+
method_sig.return_type.is_a?(T::Types::TypeParameter) ||
|
|
87
|
+
method_sig.return_type.is_a?(T::Types::TypeVariable) ||
|
|
88
|
+
(method_sig.return_type.is_a?(T::Types::Simple) && method_sig.return_type.raw_type.equal?(BasicObject))
|
|
89
89
|
|
|
90
90
|
returns_anything_method = all_args_are_simple && return_is_ignorable
|
|
91
91
|
|
|
@@ -176,7 +176,7 @@ module T::Private::Methods::CallValidation
|
|
|
176
176
|
# this code is sig validation code.
|
|
177
177
|
# Please issue `finish` to step out of it
|
|
178
178
|
|
|
179
|
-
return_value =
|
|
179
|
+
return_value = original_method.bind_call(instance, *args, &blk)
|
|
180
180
|
|
|
181
181
|
# The only type that is allowed to change the return value is `.void`.
|
|
182
182
|
# It ignores what you returned and changes it to be a private singleton.
|
|
@@ -279,7 +279,7 @@ module T::Private::Methods::CallValidation
|
|
|
279
279
|
# this code is sig validation code.
|
|
280
280
|
# Please issue `finish` to step out of it
|
|
281
281
|
|
|
282
|
-
return_value =
|
|
282
|
+
return_value = original_method.bind_call(instance, *args, &blk)
|
|
283
283
|
|
|
284
284
|
# The only type that is allowed to change the return value is `.void`.
|
|
285
285
|
# It ignores what you returned and changes it to be a private singleton.
|
|
@@ -332,8 +332,4 @@ module T::Private::Methods::CallValidation
|
|
|
332
332
|
end
|
|
333
333
|
end
|
|
334
334
|
|
|
335
|
-
|
|
336
|
-
require_relative './call_validation_2_7'
|
|
337
|
-
else
|
|
338
|
-
require_relative './call_validation_2_6'
|
|
339
|
-
end
|
|
335
|
+
require_relative './call_validation_2_7'
|
|
@@ -264,9 +264,9 @@ class T::Props::Decorator
|
|
|
264
264
|
nil
|
|
265
265
|
end
|
|
266
266
|
|
|
267
|
-
SAFE_NAME = T.let(/\A[A-Za-z_][A-Za-z0-9_-]*\z
|
|
267
|
+
SAFE_NAME = T.let(/\A[A-Za-z_][A-Za-z0-9_-]*\z/, Regexp, checked: false)
|
|
268
268
|
# Should be exactly the same as `SAFE_NAME`, but with a leading `@`.
|
|
269
|
-
SAFE_ACCESSOR_KEY_NAME = T.let(/\A@[A-Za-z_][A-Za-z0-9_-]*\z
|
|
269
|
+
SAFE_ACCESSOR_KEY_NAME = T.let(/\A@[A-Za-z_][A-Za-z0-9_-]*\z/, Regexp, checked: false)
|
|
270
270
|
|
|
271
271
|
# Used to validate both prop names and serialized forms
|
|
272
272
|
sig { params(name: T.any(Symbol, String)).void.checked(:never) }
|
|
@@ -327,9 +327,9 @@ class T::Props::Decorator
|
|
|
327
327
|
sig(:final) { params(name: Symbol).returns(T::Boolean).checked(:never) }
|
|
328
328
|
private def method_defined_on_ancestor?(name)
|
|
329
329
|
(@class.method_defined?(name) || @class.private_method_defined?(name)) &&
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
330
|
+
# Unfortunately, older versions of ruby don't allow the second parameter on
|
|
331
|
+
# `private_method_defined?`.
|
|
332
|
+
!@class.method_defined?(name, false) && !@class.private_method_defined?(name, false)
|
|
333
333
|
end
|
|
334
334
|
|
|
335
335
|
sig(:final) { params(name: Symbol, rules: Rules).void.checked(:never) }
|
|
@@ -38,14 +38,12 @@ module T::Types
|
|
|
38
38
|
return false unless obj.is_a?(Enumerable)
|
|
39
39
|
case obj
|
|
40
40
|
when Array
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
it += 1
|
|
46
|
-
end
|
|
47
|
-
true
|
|
41
|
+
it = 0
|
|
42
|
+
while it < obj.count
|
|
43
|
+
return false unless type.recursively_valid?(obj[it])
|
|
44
|
+
it += 1
|
|
48
45
|
end
|
|
46
|
+
true
|
|
49
47
|
when Hash
|
|
50
48
|
type_ = self.type
|
|
51
49
|
return false unless type_.is_a?(FixedArray)
|
|
@@ -168,11 +166,7 @@ module T::Types
|
|
|
168
166
|
obj.class
|
|
169
167
|
else
|
|
170
168
|
# This is a specialized enumerable type, just return the class.
|
|
171
|
-
|
|
172
|
-
Object.instance_method(:class).bind_call(obj)
|
|
173
|
-
else
|
|
174
|
-
Object.instance_method(:class).bind(obj).call # rubocop:disable Performance/BindCall
|
|
175
|
-
end
|
|
169
|
+
Object.instance_method(:class).bind_call(obj)
|
|
176
170
|
end
|
|
177
171
|
end
|
|
178
172
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sorbet-runtime
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.12665
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stripe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-10-
|
|
11
|
+
date: 2025-10-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|
|
@@ -58,14 +58,14 @@ dependencies:
|
|
|
58
58
|
requirements:
|
|
59
59
|
- - '='
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 1.
|
|
61
|
+
version: 1.81.6
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - '='
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 1.
|
|
68
|
+
version: 1.81.6
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: rubocop-performance
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -177,7 +177,6 @@ files:
|
|
|
177
177
|
- lib/types/private/final.rb
|
|
178
178
|
- lib/types/private/methods/_methods.rb
|
|
179
179
|
- lib/types/private/methods/call_validation.rb
|
|
180
|
-
- lib/types/private/methods/call_validation_2_6.rb
|
|
181
180
|
- lib/types/private/methods/call_validation_2_7.rb
|
|
182
181
|
- lib/types/private/methods/decl_builder.rb
|
|
183
182
|
- lib/types/private/methods/modes.rb
|