sorbet-runtime 0.6.12645 → 0.6.12793
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/sorbet-runtime.rb +1 -1
- data/lib/types/_types.rb +12 -0
- data/lib/types/configuration.rb +2 -9
- data/lib/types/enum.rb +1 -1
- data/lib/types/private/methods/_methods.rb +4 -18
- data/lib/types/private/methods/call_validation.rb +10 -14
- data/lib/types/props/custom_type.rb +1 -1
- data/lib/types/props/decorator.rb +19 -17
- data/lib/types/props/private/apply_default.rb +4 -4
- data/lib/types/props/private/serde_transform.rb +4 -4
- data/lib/types/props/private/setter_factory.rb +9 -9
- data/lib/types/props/type_validation.rb +2 -2
- data/lib/types/types/class_of.rb +1 -1
- data/lib/types/types/simple.rb +4 -4
- data/lib/types/types/typed_class.rb +1 -1
- data/lib/types/types/typed_enumerable.rb +6 -12
- data/lib/types/types/typed_module.rb +102 -0
- data/lib/types/types/typed_set.rb +0 -3
- metadata +5 -6
- data/lib/types/non_forcing_constants.rb +0 -55
- data/lib/types/private/methods/call_validation_2_6.rb +0 -1729
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.12793
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stripe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-11-27 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
|
|
@@ -165,7 +165,6 @@ files:
|
|
|
165
165
|
- lib/types/enum.rb
|
|
166
166
|
- lib/types/generic.rb
|
|
167
167
|
- lib/types/helpers.rb
|
|
168
|
-
- lib/types/non_forcing_constants.rb
|
|
169
168
|
- lib/types/private/abstract/data.rb
|
|
170
169
|
- lib/types/private/abstract/declare.rb
|
|
171
170
|
- lib/types/private/abstract/hooks.rb
|
|
@@ -177,7 +176,6 @@ files:
|
|
|
177
176
|
- lib/types/private/final.rb
|
|
178
177
|
- lib/types/private/methods/_methods.rb
|
|
179
178
|
- lib/types/private/methods/call_validation.rb
|
|
180
|
-
- lib/types/private/methods/call_validation_2_6.rb
|
|
181
179
|
- lib/types/private/methods/call_validation_2_7.rb
|
|
182
180
|
- lib/types/private/methods/decl_builder.rb
|
|
183
181
|
- lib/types/private/methods/modes.rb
|
|
@@ -238,6 +236,7 @@ files:
|
|
|
238
236
|
- lib/types/types/typed_enumerator_chain.rb
|
|
239
237
|
- lib/types/types/typed_enumerator_lazy.rb
|
|
240
238
|
- lib/types/types/typed_hash.rb
|
|
239
|
+
- lib/types/types/typed_module.rb
|
|
241
240
|
- lib/types/types/typed_range.rb
|
|
242
241
|
- lib/types/types/typed_set.rb
|
|
243
242
|
- lib/types/types/union.rb
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
# typed: strict
|
|
3
|
-
|
|
4
|
-
module T::NonForcingConstants
|
|
5
|
-
# NOTE: This method is documented on the RBI in Sorbet's payload, so that it
|
|
6
|
-
# shows up in the hover/completion documentation via LSP.
|
|
7
|
-
T::Sig::WithoutRuntime.sig { params(val: BasicObject, klass: String).returns(T::Boolean) }
|
|
8
|
-
def self.non_forcing_is_a?(val, klass)
|
|
9
|
-
method_name = "T::NonForcingConstants.non_forcing_is_a?"
|
|
10
|
-
if klass.empty?
|
|
11
|
-
raise ArgumentError.new("The string given to `#{method_name}` must not be empty")
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
current_klass = T.let(nil, T.nilable(Module))
|
|
15
|
-
current_prefix = T.let(nil, T.nilable(String))
|
|
16
|
-
|
|
17
|
-
parts = klass.split('::')
|
|
18
|
-
parts.each do |part|
|
|
19
|
-
if current_klass.nil?
|
|
20
|
-
# First iteration
|
|
21
|
-
if part != ""
|
|
22
|
-
raise ArgumentError.new("The string given to `#{method_name}` must be an absolute constant reference that starts with `::`")
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
current_klass = Object
|
|
26
|
-
current_prefix = ''
|
|
27
|
-
|
|
28
|
-
# if this had a :: prefix, then there's no more loading to
|
|
29
|
-
# do---skip to the next one
|
|
30
|
-
next
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
if current_klass.autoload?(part)
|
|
34
|
-
# There's an autoload registered for that constant, which means it's not
|
|
35
|
-
# yet loaded. `value` can't be an instance of something not yet loaded.
|
|
36
|
-
return false
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# Sorbet guarantees that the string is an absolutely resolved name.
|
|
40
|
-
search_inheritance_chain = false
|
|
41
|
-
if !current_klass.const_defined?(part, search_inheritance_chain)
|
|
42
|
-
return false
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
current_klass = current_klass.const_get(part)
|
|
46
|
-
current_prefix = "#{current_prefix}::#{part}"
|
|
47
|
-
|
|
48
|
-
if !Module.===(current_klass)
|
|
49
|
-
raise ArgumentError.new("#{current_prefix} is not a class or module")
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
current_klass.===(val)
|
|
54
|
-
end
|
|
55
|
-
end
|