sorbet-runtime 0.5.5742 → 0.5.5767
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/decorator.rb +1 -1
- data/lib/types/types/typed_enumerable.rb +12 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d621194ff7ce32491fc0ea7268abf3a4685d7406dedf775b3c8ecfe3e28d95c7
|
4
|
+
data.tar.gz: e6e1419051f9159d4f3de20fe2f359aae614d233a54b70cb1a355c94de1e2d60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f20b45d4b46b83b2c7ce97ff5b4c2931e767f8f80f1ce606ab8854ba061dba0d870b5aa4274f085fbe8806da7c41c001e3012f6afc9b07699e5c89eda3958582
|
7
|
+
data.tar.gz: 85e638786cb74ba22744bc07977ca31e17e2a9a7c95c2d39b2c49cd4d5d6d971aac5a9e3d47f3ae2e297f792c508d03798aff7bc3dc77904bdc6fafad4c95e4f
|
@@ -188,7 +188,7 @@ class T::Props::Decorator
|
|
188
188
|
.returns(T.untyped)
|
189
189
|
.checked(:never)
|
190
190
|
end
|
191
|
-
def foreign_prop_get(instance, prop, foreign_class, rules=
|
191
|
+
def foreign_prop_get(instance, prop, foreign_class, rules=prop_rules(prop), opts={})
|
192
192
|
return if !(value = prop_get(instance, prop, rules))
|
193
193
|
T.unsafe(foreign_class).load(value, {}, opts)
|
194
194
|
end
|
@@ -50,7 +50,11 @@ module T::Types
|
|
50
50
|
# Enumerators can be unbounded: see `[:foo, :bar].cycle`
|
51
51
|
return true
|
52
52
|
when Range
|
53
|
-
|
53
|
+
# A nil beginning or a nil end does not provide any type information. That is, nil in a range represents
|
54
|
+
# boundlessness, it does not express a type. For example `(nil...nil)` is not a T::Range[NilClass], its a range
|
55
|
+
# of unknown types (T::Range[T.untyped]).
|
56
|
+
# Similarly, `(nil...1)` is not a `T::Range[T.nilable(Integer)]`, it's a boundless range of Integer.
|
57
|
+
(obj.begin.nil? || @type.valid?(obj.begin)) && (obj.end.nil? || @type.valid?(obj.end))
|
54
58
|
when Set
|
55
59
|
obj.each do |item|
|
56
60
|
return false unless @type.valid?(item)
|
@@ -124,7 +128,13 @@ module T::Types
|
|
124
128
|
inferred_val = type_from_instances(obj.values)
|
125
129
|
T::Hash[inferred_key, inferred_val]
|
126
130
|
when Range
|
127
|
-
|
131
|
+
# We can't get any information from `NilClass` in ranges (since nil is used to represent boundlessness).
|
132
|
+
typeable_objects = [obj.begin, obj.end].compact
|
133
|
+
if typeable_objects.empty?
|
134
|
+
T::Range[T.untyped]
|
135
|
+
else
|
136
|
+
T::Range[type_from_instances(typeable_objects)]
|
137
|
+
end
|
128
138
|
when Enumerator
|
129
139
|
T::Enumerator[type_from_instances(obj)]
|
130
140
|
when Set
|
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.
|
4
|
+
version: 0.5.5767
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|