sorbet-runtime 0.5.9538 → 0.5.9566

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: 80def8ed986d4af7aae7d526d28e8fe9a05e7ba1e4aa0300cabea51a4b97b470
4
- data.tar.gz: 2bdb2346adb67c902ce286fcb1f1188807e8c3d7d30c4bc103701be4229a8514
3
+ metadata.gz: 1e5023e6be54c34aae9eaa90bd256fc8e9f15b56d54490f21530fb6ebac519fe
4
+ data.tar.gz: 43e21db8ed3660374e82d0017fcbca9768e3b8ce15ffe85997aa854e2338d47c
5
5
  SHA512:
6
- metadata.gz: 833cc39489064191241ecb03aa073cb06f854c09ca1fd41aa693993815f63b51b086eb3bcf0aa803f170804c8db7c143f0266ba65b2dcf36d9869df5b875e3e7
7
- data.tar.gz: 511ea6ab37a8d89dc1ce48132db6cc1035598148dc5f6793fdb243892b4dcedee2fddcf2814dfc2cf8b3d63779596a88d981f90fb366da1092d5300d4ce24d09
6
+ metadata.gz: c2d2348cd0cf77820a3e3b5a5f935cf9bebc481dd2e85c4af01c642601d95215f3fe00f8c3145ccaf98626d4bc8815013e74b8d4c80c9f6b8159ec6f443e739a
7
+ data.tar.gz: ff45d3aa7343c2874d369d422b9690342c91c7a1f650229b108fef3bc9f7a92e68a06ca5fe38391a40aa6163a6839e63bc02dbcded7ea26d635338b359b514c5
@@ -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.9538
4
+ version: 0.5.9566
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-20 00:00:00.000000000 Z
11
+ date: 2022-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest