sorbet-runtime 0.6.12521 → 0.6.12526
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d815b2b7e2352415abe2127044152e8d28b6f87baa3bf11003358eb8d6af3e1
|
4
|
+
data.tar.gz: 62600ed18e370788099c7f29a33e487746ff244e851ace845b969b9c0400c733
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbf9db51889d9a3b40f06fa28f1b2e1f2627d087eb8247d2f684f597dfdcd6b50c49134a004d0adba1a672ec48069fa45a32692abf1bcd18afc5187a0235500f
|
7
|
+
data.tar.gz: d86e55d7329a9553dc3c01e167cea82ea1f33fbcf915d18b609234b193dcd6b3755e157141d898dfc705107b148e2e4be4885458b7bbe4db65eaf19858950e12
|
@@ -277,6 +277,9 @@ module T::Private::Methods::SignatureValidation
|
|
277
277
|
end
|
278
278
|
end
|
279
279
|
|
280
|
+
ALLOW_INCOMPATIBLE_VISIBILITY = [:visibility, true]
|
281
|
+
private_constant :ALLOW_INCOMPATIBLE_VISIBILITY
|
282
|
+
|
280
283
|
def self.validate_override_visibility(signature, super_signature)
|
281
284
|
return if super_signature.mode == Modes.untyped
|
282
285
|
# This departs from the behavior of other `validate_override_whatever` functions in that it
|
@@ -284,8 +287,8 @@ module T::Private::Methods::SignatureValidation
|
|
284
287
|
# done because the primary method for silencing these errors (`allow_incompatible: :visibility`)
|
285
288
|
# requires an `override` node to attach to. Once we have static override checking for implicitly
|
286
289
|
# overridden methods, we can remove this.
|
287
|
-
return unless
|
288
|
-
return if
|
290
|
+
return unless Modes::OVERRIDE_MODES.include?(signature.mode)
|
291
|
+
return if ALLOW_INCOMPATIBLE_VISIBILITY.include?(signature.override_allow_incompatible)
|
289
292
|
method = signature.method
|
290
293
|
super_method = super_signature.method
|
291
294
|
mode_noun = super_signature.mode == Modes.abstract ? 'implementation' : 'override'
|
@@ -305,8 +308,11 @@ module T::Private::Methods::SignatureValidation
|
|
305
308
|
end
|
306
309
|
|
307
310
|
# Higher = more restrictive.
|
311
|
+
METHOD_VISIBILITIES = %i[public protected private]
|
312
|
+
private_constant :METHOD_VISIBILITIES
|
313
|
+
|
308
314
|
private_class_method def self.visibility_strength(vis)
|
309
|
-
|
315
|
+
METHOD_VISIBILITIES.find_index(vis)
|
310
316
|
end
|
311
317
|
|
312
318
|
private_class_method def self.base_override_loc_str(signature, super_signature)
|
@@ -261,6 +261,8 @@ class T::Props::Decorator
|
|
261
261
|
end
|
262
262
|
|
263
263
|
SAFE_NAME = T.let(/\A[A-Za-z_][A-Za-z0-9_-]*\z/.freeze, Regexp, checked: false)
|
264
|
+
# Should be exactly the same as `SAFE_NAME`, but with a leading `@`.
|
265
|
+
SAFE_ACCESSOR_KEY_NAME = T.let(/\A@[A-Za-z_][A-Za-z0-9_-]*\z/.freeze, Regexp, checked: false)
|
264
266
|
|
265
267
|
# Used to validate both prop names and serialized forms
|
266
268
|
sig { params(name: T.any(Symbol, String)).void.checked(:never) }
|
@@ -16,6 +16,8 @@ module T::Props
|
|
16
16
|
module DeserializerGenerator
|
17
17
|
extend T::Sig
|
18
18
|
|
19
|
+
CAN_USE_SYMBOL_NAME = T.let(RUBY_VERSION >= "3.3.0", T::Boolean)
|
20
|
+
|
19
21
|
# Generate a method that takes a T::Hash[String, T.untyped] representing
|
20
22
|
# serialized props, sets instance variables for each prop found in the
|
21
23
|
# input, and returns the count of we props set (which we can use to check
|
@@ -29,19 +31,21 @@ module T::Props
|
|
29
31
|
.checked(:never)
|
30
32
|
end
|
31
33
|
def self.generate(props, defaults)
|
32
|
-
|
33
|
-
|
34
|
+
parts = props.filter_map do |prop, rules|
|
35
|
+
next if rules[:dont_store]
|
36
|
+
|
34
37
|
# All of these strings should already be validated (directly or
|
35
38
|
# indirectly) in `validate_prop_name`, so we don't bother with a nice
|
36
39
|
# error message, but we double check here to prevent a refactoring
|
37
40
|
# from introducing a security vulnerability.
|
38
|
-
raise unless T::Props::Decorator::SAFE_NAME.match?(prop.to_s)
|
41
|
+
raise unless T::Props::Decorator::SAFE_NAME.match?(CAN_USE_SYMBOL_NAME ? prop.name : prop.to_s)
|
39
42
|
|
40
43
|
hash_key = rules.fetch(:serialized_form)
|
41
44
|
raise unless T::Props::Decorator::SAFE_NAME.match?(hash_key)
|
42
45
|
|
43
|
-
|
44
|
-
|
46
|
+
key = rules.fetch(:accessor_key)
|
47
|
+
ivar_name = CAN_USE_SYMBOL_NAME ? key.name : key.to_s
|
48
|
+
raise unless ivar_name.start_with?('@') && T::Props::Decorator::SAFE_ACCESSOR_KEY_NAME.match?(ivar_name)
|
45
49
|
|
46
50
|
transformation = SerdeTransform.generate(
|
47
51
|
T::Utils::Nilable.get_underlying_type_object(rules.fetch(:type_object)),
|
@@ -90,7 +94,7 @@ module T::Props
|
|
90
94
|
|
91
95
|
<<~RUBY
|
92
96
|
def __t_props_generated_deserialize(hash)
|
93
|
-
found = #{
|
97
|
+
found = #{parts.size}
|
94
98
|
#{parts.join("\n\n")}
|
95
99
|
found
|
96
100
|
end
|
@@ -16,6 +16,8 @@ module T::Props
|
|
16
16
|
module SerializerGenerator
|
17
17
|
extend T::Sig
|
18
18
|
|
19
|
+
CAN_USE_SYMBOL_NAME = T.let(RUBY_VERSION >= "3.3.0", T::Boolean)
|
20
|
+
|
19
21
|
sig do
|
20
22
|
params(
|
21
23
|
props: T::Hash[Symbol, T::Hash[Symbol, T.untyped]],
|
@@ -24,19 +26,21 @@ module T::Props
|
|
24
26
|
.checked(:never)
|
25
27
|
end
|
26
28
|
def self.generate(props)
|
27
|
-
|
28
|
-
|
29
|
+
parts = props.filter_map do |prop, rules|
|
30
|
+
next if rules[:dont_store]
|
31
|
+
|
29
32
|
# All of these strings should already be validated (directly or
|
30
33
|
# indirectly) in `validate_prop_name`, so we don't bother with a nice
|
31
34
|
# error message, but we double check here to prevent a refactoring
|
32
35
|
# from introducing a security vulnerability.
|
33
|
-
raise unless T::Props::Decorator::SAFE_NAME.match?(prop.to_s)
|
36
|
+
raise unless T::Props::Decorator::SAFE_NAME.match?(CAN_USE_SYMBOL_NAME ? prop.name : prop.to_s)
|
34
37
|
|
35
38
|
hash_key = rules.fetch(:serialized_form)
|
36
39
|
raise unless T::Props::Decorator::SAFE_NAME.match?(hash_key)
|
37
40
|
|
38
|
-
|
39
|
-
|
41
|
+
key = rules.fetch(:accessor_key)
|
42
|
+
ivar_name = CAN_USE_SYMBOL_NAME ? key.name : key.to_s
|
43
|
+
raise unless ivar_name.start_with?('@') && T::Props::Decorator::SAFE_ACCESSOR_KEY_NAME.match?(ivar_name)
|
40
44
|
|
41
45
|
transformed_val = SerdeTransform.generate(
|
42
46
|
T::Utils::Nilable.get_underlying_type_object(rules.fetch(:type_object)),
|
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.12526
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-09-
|
11
|
+
date: 2025-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|