sorbet-runtime 0.6.13471 → 0.6.13475
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/types/props/serializable.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1bb74effe5d0148f920247854d9a3375be1e6a30a57eabef95762827acb553f4
|
|
4
|
+
data.tar.gz: c6cfd10ad207b675ec21f2b4a3fe29f46db264d86d445297f8967dbf7c7c373e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a13bc4385fc0abe8e6d1c1b0beb982cea461922ec2104d76bfbef6f2fcb06435deb9cec4c8c4764b3e5e985759b883a55da7509ad60c498a4424b72468499ee8
|
|
7
|
+
data.tar.gz: cad696e8b07fcae9a295320c657b2cad2821dd1093b68761df4f4b847f3b8f7ae188953ff5a39218c70e047e1d3398509eb712da5f2d1c3c38790e0834e1aedc
|
|
@@ -289,6 +289,18 @@ module T::Props::Serializable::DecoratorMethods
|
|
|
289
289
|
raise ArgumentError.new("The value of `raise_on_nil_write` if specified must be `true` (given: #{rules[:raise_on_nil_write]}).")
|
|
290
290
|
end
|
|
291
291
|
|
|
292
|
+
if rules[:raise_on_nil_write] && !rules[:_tnilable]
|
|
293
|
+
is_nilclass_parent = type.is_a?(T::Types::Simple) &&
|
|
294
|
+
(type.raw_type.equal?(Object) || type.raw_type.equal?(BasicObject))
|
|
295
|
+
# Use `instance_of?` because modules can be mixed into NilClass, but classes cannot.
|
|
296
|
+
is_module = type.is_a?(T::Types::Simple) && type.raw_type.instance_of?(Module)
|
|
297
|
+
underspecified_type = type.equal?(T.untyped) || is_nilclass_parent || is_module
|
|
298
|
+
|
|
299
|
+
unless underspecified_type
|
|
300
|
+
raise ArgumentError.new("`raise_on_nil_write` requires that the type of `#{name}` be `T.nilable(...)` (given: #{type})")
|
|
301
|
+
end
|
|
302
|
+
end
|
|
303
|
+
|
|
292
304
|
result
|
|
293
305
|
end
|
|
294
306
|
|