sorbet-runtime 0.5.9539 → 0.5.9573

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: f6b0d83e0a2061513478ead3ef36128b6d5a0d8a8d917ec1434cb0430bd7c1b1
4
- data.tar.gz: 743a3a2f712cab3adc9ba1a8baae443f101949eee51ddf49d80ade238a1457dc
3
+ metadata.gz: 9f90bf73eaa519fd345846647d2142ffd71ae86a0b72b2af1d80ba135ec43ebc
4
+ data.tar.gz: 225de9e9ab7b46661841d1ecfbf22beb83679dfb2a4c0fbb3e4fc41536c330f2
5
5
  SHA512:
6
- metadata.gz: 04df9feeefc84e0aaede7324618b39e79950f1cb4cd175fadea596c2ae17cc686e503832305a1c517886fd573846ec874badc1142842628b2e1663fe44ab0150
7
- data.tar.gz: 973c65b70e563151cd5568c584d7c8d03b4e0d82498b749725be222e0dc51920045529b0354e1af4b959b55e94356e1c6bb5015431810a809f17fc66c0ca507e
6
+ metadata.gz: 9e5682f45ae90654d2399704d350aed5d7b852bd8a3c2c478e5679efb958eaaa0cc6ea46161fd6fc2172bb65dd422db92afd59becc9a11210d14eb2444fffda8
7
+ data.tar.gz: 99b3038fa8d41cd13a5c6544ec85a8a5cdb8c2cfcd853eee9b79d34c7e8e2a413542b0ba667d36a3a191f2954400751cb98559e62031a279e3afbd3d5d022a4a
@@ -277,6 +277,24 @@ class T::Props::Decorator
277
277
  end
278
278
  end
279
279
 
280
+ # Returns `true` when the type of the prop is nilable, or the field is typed
281
+ # as `T.untyped`, a `:default` is present in the rules hash, and its value is
282
+ # `nil`. The latter case is a workaround for explicitly not supporting the use
283
+ # of `T.nilable(T.untyped)`.
284
+ #
285
+ # checked(:never) - Rules hash is expensive to check
286
+ sig do
287
+ params(
288
+ cls: PropTypeOrClass,
289
+ rules: Rules,
290
+ )
291
+ .void
292
+ .checked(:never)
293
+ end
294
+ private def prop_nilable?(cls, rules)
295
+ T::Utils::Nilable.is_union_with_nilclass(cls) || (cls == T.untyped && rules.key?(:default) && rules[:default].nil?)
296
+ end
297
+
280
298
  # checked(:never) - Rules hash is expensive to check
281
299
  sig do
282
300
  params(
@@ -290,7 +308,7 @@ class T::Props::Decorator
290
308
  def prop_defined(name, cls, rules={})
291
309
  cls = T::Utils.resolve_alias(cls)
292
310
 
293
- if T::Utils::Nilable.is_union_with_nilclass(cls)
311
+ if prop_nilable?(cls, rules)
294
312
  # :_tnilable is introduced internally for performance purpose so that clients do not need to call
295
313
  # T::Utils::Nilable.is_tnilable(cls) again.
296
314
  # It is strictly internal: clients should always use T::Props::Utils.required_prop?() or
@@ -25,6 +25,8 @@ module T::Types
25
25
  case other
26
26
  when ClassOf
27
27
  @type <= other.type
28
+ when Simple
29
+ @type.is_a?(other.raw_type)
28
30
  else
29
31
  false
30
32
  end
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.9539
4
+ version: 0.5.9573
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-21 00:00:00.000000000 Z
11
+ date: 2022-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest