sorbet-runtime 0.6.12710 → 0.6.12715
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 +0 -1
- data/lib/types/types/typed_set.rb +0 -3
- metadata +2 -3
- data/lib/types/non_forcing_constants.rb +0 -55
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 68eec311e57f1cd5465b8348d868796388177f6ca6677e8d07ae208565d2e300
|
|
4
|
+
data.tar.gz: a86928759e1bfd4751654e919fcee7aacd1b10e47b799fe76b18d25b9ca9f51e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f8c3928f5f730ea350502bf81c9e9abf3224493b0b3d2777dfc5a22f2190ff6d5dd610ee217b3a87236f35aa21d9b04df459b9d8d72064e637255295cd7a4f06
|
|
7
|
+
data.tar.gz: ff932835d5b021b5a5bec033c897802ccd2be509220ebcb59123482345b516daf687337e9666bfdc0cb75a494e46825a2c5c18cc7ac8b61b2a7ce84bb851dda9
|
data/lib/sorbet-runtime.rb
CHANGED
|
@@ -14,7 +14,6 @@ module T::Types
|
|
|
14
14
|
|
|
15
15
|
# overrides Base
|
|
16
16
|
def recursively_valid?(obj)
|
|
17
|
-
# Re-implements non_forcing_is_a?
|
|
18
17
|
return false if Object.autoload?(:Set) # Set is meant to be autoloaded but not yet loaded, this value can't be a Set
|
|
19
18
|
return false unless Object.const_defined?(:Set) # Set is not loaded yet
|
|
20
19
|
obj.is_a?(Set) && super
|
|
@@ -22,7 +21,6 @@ module T::Types
|
|
|
22
21
|
|
|
23
22
|
# overrides Base
|
|
24
23
|
def valid?(obj)
|
|
25
|
-
# Re-implements non_forcing_is_a?
|
|
26
24
|
return false if Object.autoload?(:Set) # Set is meant to be autoloaded but not yet loaded, this value can't be a Set
|
|
27
25
|
return false unless Object.const_defined?(:Set) # Set is not loaded yet
|
|
28
26
|
obj.is_a?(Set)
|
|
@@ -41,7 +39,6 @@ module T::Types
|
|
|
41
39
|
end
|
|
42
40
|
|
|
43
41
|
def valid?(obj)
|
|
44
|
-
# Re-implements non_forcing_is_a?
|
|
45
42
|
return false if Object.autoload?(:Set) # Set is meant to be autoloaded but not yet loaded, this value can't be a Set
|
|
46
43
|
return false unless Object.const_defined?(:Set) # Set is not loaded yet
|
|
47
44
|
obj.is_a?(Set)
|
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.12715
|
|
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-
|
|
11
|
+
date: 2025-11-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|
|
@@ -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
|
|
@@ -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
|