sorbet-runtime 0.4.4983 → 0.4.4987
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sorbet-runtime.rb +1 -1
- data/lib/types/props/decorator.rb +1 -7
- data/lib/types/props/utils.rb +3 -9
- data/lib/types/types/{opus_enum.rb → t_enum.rb} +3 -3
- data/lib/types/utils.rb +2 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60ac5c014681d908de660077eadc28a8d2538ee4dd6ec36e2ffcd836987ce9d6
|
4
|
+
data.tar.gz: 513e1cb263af3a537df5facaaf9022a43ba623b3c5c0fd5592cf19bde027d1e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db66ca968a8ab32fbd58c90025aaaf1b7512c8af44d316ed2d038f65fa5b6d766da59caf43d8b06cd6066dee808f73ef539203c8c54a006508702931b3a6f28b
|
7
|
+
data.tar.gz: 4118676082589924b4b22dc25a6897cc527cba5bcb7da6a2c39ce09481d2fbfc1464336f1b9f751565e7165a11ceabbf56d5e27ab0dbe7fddc6f40cd3f484f68
|
data/lib/sorbet-runtime.rb
CHANGED
@@ -45,7 +45,7 @@ require_relative 'types/types/proc'
|
|
45
45
|
require_relative 'types/types/attached_class'
|
46
46
|
require_relative 'types/types/self_type'
|
47
47
|
require_relative 'types/types/simple'
|
48
|
-
require_relative 'types/types/
|
48
|
+
require_relative 'types/types/t_enum'
|
49
49
|
require_relative 'types/types/type_parameter'
|
50
50
|
require_relative 'types/types/typed_array'
|
51
51
|
require_relative 'types/types/typed_enumerator'
|
@@ -552,7 +552,7 @@ class T::Props::Decorator
|
|
552
552
|
nil
|
553
553
|
end
|
554
554
|
|
555
|
-
# returns the type of the hash key, or nil. Any CustomType could be a key, but we only expect
|
555
|
+
# returns the type of the hash key, or nil. Any CustomType could be a key, but we only expect T::Enum right now.
|
556
556
|
sig do
|
557
557
|
params(type: PropType)
|
558
558
|
.returns(T.nilable(Module))
|
@@ -571,12 +571,6 @@ class T::Props::Decorator
|
|
571
571
|
|
572
572
|
# From T::Props::Utils.deep_clone_object, plus String
|
573
573
|
TYPES_NOT_NEEDING_CLONE = [TrueClass, FalseClass, NilClass, Symbol, String, Numeric]
|
574
|
-
if defined?(Opus) && defined?(Opus::Enum)
|
575
|
-
TYPES_NOT_NEEDING_CLONE << Opus::Enum
|
576
|
-
end
|
577
|
-
if defined?(T::Enum)
|
578
|
-
TYPES_NOT_NEEDING_CLONE << T::Enum
|
579
|
-
end
|
580
574
|
|
581
575
|
sig {params(type: PropType).returns(T::Boolean)}
|
582
576
|
private def shallow_clone_ok(type)
|
data/lib/types/props/utils.rb
CHANGED
@@ -23,16 +23,10 @@ module T::Props::Utils
|
|
23
23
|
h
|
24
24
|
when Regexp
|
25
25
|
what.dup
|
26
|
+
when T::Enum
|
27
|
+
what
|
26
28
|
else
|
27
|
-
|
28
|
-
# being defined.
|
29
|
-
if defined?(Opus) && defined?(Opus::Enum) && what.class == Opus::Enum
|
30
|
-
what
|
31
|
-
elsif defined?(T::Enum) && what.class == T::Enum
|
32
|
-
what
|
33
|
-
else
|
34
|
-
what.clone
|
35
|
-
end
|
29
|
+
what.clone
|
36
30
|
end
|
37
31
|
freeze ? result.freeze : result
|
38
32
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
# typed: true
|
3
3
|
|
4
4
|
module T::Types
|
5
|
-
# Validates that an object is equal to another
|
6
|
-
class
|
5
|
+
# Validates that an object is equal to another T::Enum singleton value.
|
6
|
+
class TEnum < Base
|
7
7
|
attr_reader :val
|
8
8
|
|
9
9
|
def initialize(val)
|
@@ -23,7 +23,7 @@ module T::Types
|
|
23
23
|
# @override Base
|
24
24
|
private def subtype_of_single?(other)
|
25
25
|
case other
|
26
|
-
when
|
26
|
+
when TEnum
|
27
27
|
@val == other.val
|
28
28
|
else
|
29
29
|
false
|
data/lib/types/utils.rb
CHANGED
@@ -28,10 +28,8 @@ module T::Utils
|
|
28
28
|
T::Types::FixedHash.new(val) # rubocop:disable PrisonGuard/UseOpusTypesShortcut
|
29
29
|
elsif val.is_a?(T::Private::Methods::DeclBuilder)
|
30
30
|
T::Private::Methods.finalize_proc(val.decl)
|
31
|
-
elsif
|
32
|
-
T::Types::
|
33
|
-
elsif defined?(::T::Enum) && val.is_a?(::T::Enum)
|
34
|
-
T::Types::OpusEnum.new(val) # rubocop:disable PrisonGuard/UseOpusTypesShortcut
|
31
|
+
elsif val.is_a?(::T::Enum)
|
32
|
+
T::Types::TEnum.new(val) # rubocop:disable PrisonGuard/UseOpusTypesShortcut
|
35
33
|
elsif val.is_a?(::String)
|
36
34
|
raise "Invalid String literal for type constraint. Must be an #{T::Types::Base}, a " \
|
37
35
|
"class/module, or an array. Got a String with value `#{val}`."
|
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.4.
|
4
|
+
version: 0.4.4987
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -127,10 +127,10 @@ files:
|
|
127
127
|
- lib/types/types/fixed_hash.rb
|
128
128
|
- lib/types/types/intersection.rb
|
129
129
|
- lib/types/types/noreturn.rb
|
130
|
-
- lib/types/types/opus_enum.rb
|
131
130
|
- lib/types/types/proc.rb
|
132
131
|
- lib/types/types/self_type.rb
|
133
132
|
- lib/types/types/simple.rb
|
133
|
+
- lib/types/types/t_enum.rb
|
134
134
|
- lib/types/types/type_member.rb
|
135
135
|
- lib/types/types/type_parameter.rb
|
136
136
|
- lib/types/types/type_template.rb
|