sorbet-runtime 0.5.11495 → 0.5.11501

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73b341322ceaabc456f4e7b47dd352d56855a21e5d65c41d0419bcc697dd0649
4
- data.tar.gz: 8fc9e017f3b0aec7596181bdd0e89198bfc314fbb0ef9e0464777c359890bdb4
3
+ metadata.gz: 90895a6ea313ec4dd6dbfe7d4f0708c27949e1e2852f34762a21c684030ee4cf
4
+ data.tar.gz: 4fb72a9cbf44eb46354a323a7e7a898f3ef17f0a68b9bff3219def6406796129
5
5
  SHA512:
6
- metadata.gz: 2802e189876a6f560c7b27f260b5cfff141ce7a866244ec0e624515526a7f75e93f858884f99d5f370ed15e617022f5ac6c5113ff1fb95334b6c2dc23dd7d322
7
- data.tar.gz: 7c13ac0ea85aaf0dc59dc86a2a9ea7165073014a3e58996e71cf308b9ecc7391bcf2f3a6712829cfdf5809103214db2ab4f8b69174a683dcae85b636be3b8120
6
+ metadata.gz: 6e700714ba7efa118c7a72cf796e9f8ea317f29cd22ca85e9813bbcdcd1f9ff080d4520b863f7b249bf362dae72f09027fb5f1e22f0630255e8b4754b8b5e336
7
+ data.tar.gz: 5d8ebc9ed5af1304be18d35ff38485da2ef7390ff5f27ca8a83dd598c642eeab6c0264ba420ec8930207fedb1663da165735e34d0d1145944e792de32764430d
@@ -21,7 +21,7 @@ module T::Types
21
21
  valid?(obj)
22
22
  end
23
23
 
24
- def valid?(obj)
24
+ define_method(:valid?) do |_obj|
25
25
  raise NotImplementedError
26
26
  end
27
27
 
@@ -35,12 +35,12 @@ module T::Types
35
35
 
36
36
  # Force any lazy initialization that this type might need to do
37
37
  # It's unusual to call this directly; you probably want to call it indirectly via `T::Utils.run_all_sig_blocks`.
38
- def build_type
38
+ define_method(:build_type) do
39
39
  raise NotImplementedError
40
40
  end
41
41
 
42
42
  # Equality is based on name, so be sure the name reflects all relevant state when implementing.
43
- def name
43
+ define_method(:name) do
44
44
  raise NotImplementedError
45
45
  end
46
46
 
@@ -21,7 +21,7 @@ module T::Types
21
21
 
22
22
  # overrides Base
23
23
  def valid?(obj)
24
- obj.is_a?(Module) && obj <= @type
24
+ obj.is_a?(Module) && (obj <= @type || false)
25
25
  end
26
26
 
27
27
  # overrides Base
@@ -51,7 +51,7 @@ module T::Types
51
51
  return false
52
52
  end
53
53
  arg_types.values.zip(other.arg_types.values).all? do |a, b|
54
- b.subtype_of?(a)
54
+ !b.nil? && b.subtype_of?(a)
55
55
  end && returns.subtype_of?(other.returns)
56
56
  else
57
57
  false
@@ -53,7 +53,7 @@ module T::Types
53
53
 
54
54
  class Untyped < TypedArray
55
55
  def initialize
56
- super(T.untyped)
56
+ super(T::Types::Untyped::Private::INSTANCE)
57
57
  end
58
58
 
59
59
  def valid?(obj)
@@ -71,7 +71,7 @@ module T::Types
71
71
 
72
72
  class Untyped < TypedClass
73
73
  def initialize
74
- super(T.untyped)
74
+ super(T::Types::Untyped::Private::INSTANCE)
75
75
  end
76
76
 
77
77
  def freeze
@@ -47,11 +47,10 @@ module T::Types
47
47
  true
48
48
  end
49
49
  when Hash
50
- return false unless type.is_a?(FixedArray)
51
- types = type.types
52
- return false if types.count != 2
53
- key_type = types[0]
54
- value_type = types[1]
50
+ type_ = self.type
51
+ return false unless type_.is_a?(FixedArray)
52
+ key_type, value_type = type_.types
53
+ return false if key_type.nil? || value_type.nil? || type_.types.size > 2
55
54
  obj.each_pair do |key, val|
56
55
  # Some objects (I'm looking at you Rack::Utils::HeaderHash) don't
57
56
  # iterate over a [key, value] array, so we can't just use the type.recursively_valid?(v)
@@ -179,7 +178,7 @@ module T::Types
179
178
 
180
179
  class Untyped < TypedEnumerable
181
180
  def initialize
182
- super(T.untyped)
181
+ super(T::Types::Untyped::Private::INSTANCE)
183
182
  end
184
183
 
185
184
  def valid?(obj)
@@ -28,7 +28,7 @@ module T::Types
28
28
 
29
29
  class Untyped < TypedEnumerator
30
30
  def initialize
31
- super(T.untyped)
31
+ super(T::Types::Untyped::Private::INSTANCE)
32
32
  end
33
33
 
34
34
  def valid?(obj)
@@ -28,7 +28,7 @@ module T::Types
28
28
 
29
29
  class Untyped < TypedEnumeratorChain
30
30
  def initialize
31
- super(T.untyped)
31
+ super(T::Types::Untyped::Private::INSTANCE)
32
32
  end
33
33
 
34
34
  def valid?(obj)
@@ -28,7 +28,7 @@ module T::Types
28
28
 
29
29
  class Untyped < TypedEnumeratorLazy
30
30
  def initialize
31
- super(T.untyped)
31
+ super(T::Types::Untyped::Private::INSTANCE)
32
32
  end
33
33
 
34
34
  def valid?(obj)
@@ -4,7 +4,7 @@
4
4
  module T::Types
5
5
  class TypedRange < TypedEnumerable
6
6
  def underlying_class
7
- Hash
7
+ Range
8
8
  end
9
9
 
10
10
  # overrides Base
@@ -4,7 +4,7 @@
4
4
  module T::Types
5
5
  class TypedSet < TypedEnumerable
6
6
  def underlying_class
7
- Hash
7
+ Set
8
8
  end
9
9
 
10
10
  # overrides Base
@@ -37,7 +37,7 @@ module T::Types
37
37
 
38
38
  class Untyped < TypedSet
39
39
  def initialize
40
- super(T.untyped)
40
+ super(T::Types::Untyped::Private::INSTANCE)
41
41
  end
42
42
 
43
43
  def valid?(obj)
data/lib/types/utils.rb CHANGED
@@ -155,7 +155,7 @@ module T::Utils
155
155
  raise ArgumentError.new("#{enum.inspect} is not a T.deprecated_enum")
156
156
  end
157
157
 
158
- classes = enum.values.map(&:class).uniq
158
+ classes = T.unsafe(enum.values).map(&:class).uniq
159
159
  if classes.empty?
160
160
  T.untyped
161
161
  elsif classes.length > 1
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.5.11495
4
+ version: 0.5.11501
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-26 00:00:00.000000000 Z
11
+ date: 2024-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest