sorbet-runtime 0.5.11495 → 0.5.11500

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: 327eda423e826a22d08cc5812904a09e4b6d994dc67da73565f1799e22083471
4
+ data.tar.gz: f20584ed98f8b5ee8bc663d4c9502fba11fea615e29558549ca150b8a89c8b26
5
5
  SHA512:
6
- metadata.gz: 2802e189876a6f560c7b27f260b5cfff141ce7a866244ec0e624515526a7f75e93f858884f99d5f370ed15e617022f5ac6c5113ff1fb95334b6c2dc23dd7d322
7
- data.tar.gz: 7c13ac0ea85aaf0dc59dc86a2a9ea7165073014a3e58996e71cf308b9ecc7391bcf2f3a6712829cfdf5809103214db2ab4f8b69174a683dcae85b636be3b8120
6
+ metadata.gz: efc21d64a989ab90783d9f40bd2875ff307507ef814d06a752729396e75ac2441e81544ab1a4dfe8780e0714a520310e56b1c5d964514941a223edbddfa99118
7
+ data.tar.gz: 04d56e7d0ce14f9226d71400611fa03dff780b33a114f4a0b1581bcbfa82b0b34896175679797c287d8aa3f39e47891dd583e5082badf1402abb1dab56424944
@@ -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.11500
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-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest