sorbet-runtime 0.5.9534 → 0.5.9553

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: 7af8aaad2da27152d736cf0520c9e7f8d170ae53d03b5450b56720d960b3a965
4
- data.tar.gz: 8367e228a76f538a1a9cd959c8e83bedc8414a54091fe6f66a2547eff1aab33a
3
+ metadata.gz: c1b6f18726c84faa9de3b53ad9df01ae5d2ae62dd78d93387bc11c262c4d6570
4
+ data.tar.gz: 66f4b1d50ff078127761f03a3f7a8d1e6eeb1c9c5ea5849e1898fe0b72a0037a
5
5
  SHA512:
6
- metadata.gz: 2c58681e970d404e1a05b24b5fb02fd0f9d0e2a652fcc9a79dd396ab61ab044ac8591054c258abd7b7d7d9fd4d591493d26a82d7f5eed9ce4518bb64b3d52813
7
- data.tar.gz: 1ea0ed99483120c383238ddcb9b9514c4c77eb3b1a1dbb5157cff66c241b78a13eefed1cbdf2b1ee43f07297ebaa79ac72fccd2116cf06c000050242fcf0daf0
6
+ metadata.gz: 18e67fbebd61d4f0db1c2337fe6802a55163ebb42f5041de1f7ee1ccc4d841d659b875a1593c32b3674ede6a3f1def09ad3b436c55b2381a1d65856814a04197
7
+ data.tar.gz: e9c66da71668aa973a740bf8af8a5c2bc8ba1e098ecb36e76d460e8c8041cf7b855b5b130609e33c7116e600c1c83d5cf2a0cc4ea5da5416a0fe9fdd0b40de3d
@@ -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.9534
4
+ version: 0.5.9553
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-19 00:00:00.000000000 Z
11
+ date: 2022-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest