sorbet-runtime 0.4.4907 → 0.4.4921
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/types/types/typed_enumerable.rb +1 -6
- data/lib/types/utils.rb +3 -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: 0d40e26cedcbf0dc8b79fea1ca262f08321d206aa7b37f377a9f826435d24865
|
4
|
+
data.tar.gz: 9e109ea63882dfb5324169af7c7fed036980c46299d7b4d7ca4aafc3ee2210ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf08e0eeb6a5c8ec072db55db232853b182d4fa78a4737e11b580407edaf52b9449db837112890c25746d7e643392f7691b9569cc6e4fcca08671edcfdde35d8
|
7
|
+
data.tar.gz: a31ff3766becffc2d1432e61473d264f5b2f60508e8260c99c2da5ba54621234f275067c955a8e3995120842496a47eeca8caa6843d44b5aad47368e3c8a8f3e
|
@@ -46,13 +46,8 @@ module T::Types
|
|
46
46
|
return false if !key_type.valid?(key) || !value_type.valid?(val)
|
47
47
|
end
|
48
48
|
return true
|
49
|
-
when Enumerator::Lazy
|
50
|
-
# Users don't want these walked
|
51
|
-
return true
|
52
49
|
when Enumerator
|
53
|
-
|
54
|
-
return false unless @type.valid?(elem)
|
55
|
-
end
|
50
|
+
# Enumerators can be unbounded: see `[:foo, :bar].cycle`
|
56
51
|
return true
|
57
52
|
when Range
|
58
53
|
@type.valid?(obj.first) && @type.valid?(obj.last)
|
data/lib/types/utils.rb
CHANGED
@@ -32,6 +32,9 @@ module T::Utils
|
|
32
32
|
T::Types::OpusEnum.new(val) # rubocop:disable PrisonGuard/UseOpusTypesShortcut
|
33
33
|
elsif defined?(::T::Enum) && val.is_a?(::T::Enum)
|
34
34
|
T::Types::OpusEnum.new(val) # rubocop:disable PrisonGuard/UseOpusTypesShortcut
|
35
|
+
elsif val.is_a?(::String)
|
36
|
+
raise "Invalid String literal for type constraint. Must be an #{T::Types::Base}, a " \
|
37
|
+
"class/module, or an array. Got a String with value `#{val}`."
|
35
38
|
else
|
36
39
|
raise "Invalid value for type constraint. Must be an #{T::Types::Base}, a " \
|
37
40
|
"class/module, or an array. Got a `#{val.class}`."
|