sorbet-runtime 0.5.5909 → 0.5.5911
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.rb +0 -2
- data/lib/types/configuration.rb +2 -2
- data/lib/types/generic.rb +2 -2
- data/lib/types/interface_wrapper.rb +4 -4
- data/lib/types/private/abstract/data.rb +2 -2
- data/lib/types/private/class_utils.rb +5 -5
- data/lib/types/private/methods/_methods.rb +2 -2
- data/lib/types/props/plugin.rb +2 -2
- data/lib/types/props/serializable.rb +2 -2
- data/lib/types/sig.rb +3 -3
- data/lib/types/types/typed_array.rb +1 -1
- data/lib/types/types/typed_enumerator.rb +1 -1
- data/lib/types/types/typed_hash.rb +2 -2
- data/lib/types/types/typed_range.rb +1 -1
- data/lib/types/types/typed_set.rb +1 -1
- data/lib/types/utils.rb +5 -5
- metadata +32 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90e868433d462c6e63e7389995d85844bc919e2d7c3a0aab238190ee21f288d6
|
4
|
+
data.tar.gz: 074213de190df8797583d210ecde315140ae426376b146a0b4c7f2f76e86c3a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8de4e913366170d4ee1fad8ad09a57626112e9a04aa029d6a514cc4c413cc3cf7f5543e7e71bb0bf30771839d765a2e56d79664a7fe8914623a899a114fbf9d4
|
7
|
+
data.tar.gz: 8242e80ee54e5ab0b5fcf4ed6b2c3e0d8e0e230c9fef1fdf06fdeb076fa86664f0089d8f943efc1069a068e537c8fff4a3a839457c4980af9a707bce03c8208a
|
data/lib/types/_types.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
# typed: true
|
3
3
|
# This is where we define the shortcuts, so we can't use them here
|
4
|
-
# rubocop:disable PrisonGuard/UseOpusTypesShortcut
|
5
4
|
|
6
5
|
# _____
|
7
6
|
# |_ _| _ _ __ ___ ___
|
@@ -285,4 +284,3 @@ module T
|
|
285
284
|
end
|
286
285
|
end
|
287
286
|
end
|
288
|
-
# rubocop:enable PrisonGuard/UseOpusTypesShortcut
|
data/lib/types/configuration.rb
CHANGED
@@ -248,7 +248,7 @@ module T::Configuration
|
|
248
248
|
end
|
249
249
|
|
250
250
|
private_class_method def self.log_info_handler_default(str, extra)
|
251
|
-
puts "#{str}, extra: #{extra}"
|
251
|
+
puts "#{str}, extra: #{extra}"
|
252
252
|
end
|
253
253
|
|
254
254
|
def self.log_info_handler(str, extra)
|
@@ -282,7 +282,7 @@ module T::Configuration
|
|
282
282
|
end
|
283
283
|
|
284
284
|
private_class_method def self.soft_assert_handler_default(str, extra)
|
285
|
-
puts "#{str}, extra: #{extra}"
|
285
|
+
puts "#{str}, extra: #{extra}"
|
286
286
|
end
|
287
287
|
|
288
288
|
def self.soft_assert_handler(str, extra)
|
data/lib/types/generic.rb
CHANGED
@@ -14,10 +14,10 @@ module T::Generic
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def type_member(variance=:invariant, fixed: nil, lower: T.untyped, upper: BasicObject)
|
17
|
-
T::Types::TypeMember.new(variance)
|
17
|
+
T::Types::TypeMember.new(variance)
|
18
18
|
end
|
19
19
|
|
20
20
|
def type_template(variance=:invariant, fixed: nil, lower: T.untyped, upper: BasicObject)
|
21
|
-
T::Types::TypeTemplate.new(variance)
|
21
|
+
T::Types::TypeTemplate.new(variance)
|
22
22
|
end
|
23
23
|
end
|
@@ -83,11 +83,11 @@ class T::InterfaceWrapper
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
def kind_of?(other)
|
86
|
+
def kind_of?(other)
|
87
87
|
is_a?(other)
|
88
88
|
end
|
89
89
|
|
90
|
-
def is_a?(other)
|
90
|
+
def is_a?(other)
|
91
91
|
if !other.is_a?(Module)
|
92
92
|
raise TypeError.new("class or module required")
|
93
93
|
end
|
@@ -99,13 +99,13 @@ class T::InterfaceWrapper
|
|
99
99
|
|
100
100
|
# Prefixed because we're polluting the namespace of the interface we're wrapping, and we don't
|
101
101
|
# want anyone else (besides dynamic_cast) calling it.
|
102
|
-
def __target_obj_DO_NOT_USE
|
102
|
+
def __target_obj_DO_NOT_USE # rubocop:disable Naming/MethodName
|
103
103
|
@target_obj
|
104
104
|
end
|
105
105
|
|
106
106
|
# Prefixed because we're polluting the namespace of the interface we're wrapping, and we don't
|
107
107
|
# want anyone else (besides wrapped_dynamic_cast) calling it.
|
108
|
-
def __interface_mod_DO_NOT_USE
|
108
|
+
def __interface_mod_DO_NOT_USE # rubocop:disable Naming/MethodName
|
109
109
|
@interface_mod
|
110
110
|
end
|
111
111
|
|
@@ -12,11 +12,11 @@
|
|
12
12
|
# modules that override the `hash` method with something completely broken.
|
13
13
|
module T::Private::Abstract::Data
|
14
14
|
def self.get(mod, key)
|
15
|
-
mod.instance_variable_get("@opus_abstract__#{key}")
|
15
|
+
mod.instance_variable_get("@opus_abstract__#{key}")
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.set(mod, key, value)
|
19
|
-
mod.instance_variable_set("@opus_abstract__#{key}", value)
|
19
|
+
mod.instance_variable_set("@opus_abstract__#{key}", value)
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.key?(mod, key)
|
@@ -33,16 +33,16 @@ module T::Private::ClassUtils
|
|
33
33
|
if @overwritten
|
34
34
|
# The original method was overwritten. Overwrite again to restore it.
|
35
35
|
T::Configuration.without_ruby_warnings do
|
36
|
-
@mod.send(:define_method, @old_method.name, @old_method)
|
36
|
+
@mod.send(:define_method, @old_method.name, @old_method)
|
37
37
|
end
|
38
38
|
else
|
39
39
|
# The original method was in an ancestor. Restore it by removing the overriding method.
|
40
|
-
@mod.send(:remove_method, @old_method.name)
|
40
|
+
@mod.send(:remove_method, @old_method.name)
|
41
41
|
end
|
42
42
|
|
43
43
|
# Restore the visibility. Note that we need to do this even when we call remove_method
|
44
44
|
# above, because the module may have set custom visibility for a method it inherited.
|
45
|
-
@mod.send(@visibility, @old_method.name)
|
45
|
+
@mod.send(@visibility, @old_method.name)
|
46
46
|
|
47
47
|
nil
|
48
48
|
end
|
@@ -97,13 +97,13 @@ module T::Private::ClassUtils
|
|
97
97
|
overwritten = original_owner == mod
|
98
98
|
T::Configuration.without_ruby_warnings do
|
99
99
|
T::Private::DeclState.current.without_on_method_added do
|
100
|
-
mod.send(:define_method, name, &blk)
|
100
|
+
mod.send(:define_method, name, &blk)
|
101
101
|
if blk.arity < 0 && mod.respond_to?(:ruby2_keywords, true)
|
102
102
|
mod.send(:ruby2_keywords, name)
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
106
|
-
mod.send(original_visibility, name)
|
106
|
+
mod.send(original_visibility, name)
|
107
107
|
new_method = mod.instance_method(name)
|
108
108
|
|
109
109
|
ReplacedMethod.new(mod, original_method, new_method, overwritten, original_visibility)
|
@@ -72,7 +72,7 @@ module T::Private::Methods
|
|
72
72
|
decl.params = {}
|
73
73
|
end
|
74
74
|
|
75
|
-
T::Types::Proc.new(decl.params, decl.returns)
|
75
|
+
T::Types::Proc.new(decl.params, decl.returns)
|
76
76
|
end
|
77
77
|
|
78
78
|
# See docs at T::Utils.register_forwarder.
|
@@ -481,7 +481,7 @@ module T::Private::Methods
|
|
481
481
|
|
482
482
|
private_class_method def self.key_to_method(key)
|
483
483
|
id, name = key.split("#")
|
484
|
-
obj = ObjectSpace._id2ref(id.to_i)
|
484
|
+
obj = ObjectSpace._id2ref(id.to_i)
|
485
485
|
obj.instance_method(name)
|
486
486
|
end
|
487
487
|
end
|
data/lib/types/props/plugin.rb
CHANGED
@@ -22,7 +22,7 @@ module T::Props::Plugin
|
|
22
22
|
if plugin.const_defined?('ClassMethods')
|
23
23
|
# FIXME: This will break preloading, selective test execution, etc if `mod::ClassMethods`
|
24
24
|
# is ever defined in a separate file from `mod`.
|
25
|
-
target.extend(plugin::ClassMethods)
|
25
|
+
target.extend(plugin::ClassMethods)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -30,7 +30,7 @@ module T::Props::Plugin
|
|
30
30
|
if plugin.const_defined?('DecoratorMethods')
|
31
31
|
# FIXME: This will break preloading, selective test execution, etc if `mod::DecoratorMethods`
|
32
32
|
# is ever defined in a separate file from `mod`.
|
33
|
-
target.extend(plugin::DecoratorMethods)
|
33
|
+
target.extend(plugin::DecoratorMethods)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -121,8 +121,8 @@ module T::Props::Serializable
|
|
121
121
|
private def with_existing_hash(changed_props, existing_hash:)
|
122
122
|
serialized = existing_hash
|
123
123
|
new_val = self.class.from_hash(serialized.merge(recursive_stringify_keys(changed_props)))
|
124
|
-
old_extra = self.instance_variable_get(:@_extra_props)
|
125
|
-
new_extra = new_val.instance_variable_get(:@_extra_props)
|
124
|
+
old_extra = self.instance_variable_get(:@_extra_props)
|
125
|
+
new_extra = new_val.instance_variable_get(:@_extra_props)
|
126
126
|
if old_extra != new_extra
|
127
127
|
difference =
|
128
128
|
if old_extra
|
data/lib/types/sig.rb
CHANGED
@@ -7,7 +7,7 @@ module T::Sig
|
|
7
7
|
module WithoutRuntime
|
8
8
|
# At runtime, does nothing, but statically it is treated exactly the same
|
9
9
|
# as T::Sig#sig. Only use it in cases where you can't use T::Sig#sig.
|
10
|
-
def self.sig(arg0=nil, &blk); end
|
10
|
+
def self.sig(arg0=nil, &blk); end
|
11
11
|
|
12
12
|
original_verbose = $VERBOSE
|
13
13
|
$VERBOSE = false
|
@@ -15,7 +15,7 @@ module T::Sig
|
|
15
15
|
# At runtime, does nothing, but statically it is treated exactly the same
|
16
16
|
# as T::Sig#sig. Only use it in cases where you can't use T::Sig#sig.
|
17
17
|
T::Sig::WithoutRuntime.sig {params(arg0: T.nilable(Symbol), blk: T.proc.bind(T::Private::Methods::DeclBuilder).void).void}
|
18
|
-
def self.sig(arg0=nil, &blk); end # rubocop:disable
|
18
|
+
def self.sig(arg0=nil, &blk); end # rubocop:disable Lint/DuplicateMethods
|
19
19
|
|
20
20
|
$VERBOSE = original_verbose
|
21
21
|
end
|
@@ -24,7 +24,7 @@ module T::Sig
|
|
24
24
|
# abstract/override/... helpers. See the documentation URL on
|
25
25
|
# {T::Helpers}
|
26
26
|
T::Sig::WithoutRuntime.sig {params(arg0: T.nilable(Symbol), blk: T.proc.bind(T::Private::Methods::DeclBuilder).void).void}
|
27
|
-
def sig(arg0=nil, &blk)
|
27
|
+
def sig(arg0=nil, &blk)
|
28
28
|
T::Private::Methods.declare_sig(self, arg0, &blk)
|
29
29
|
end
|
30
30
|
end
|
@@ -31,8 +31,8 @@ module T::Types
|
|
31
31
|
obj.is_a?(Hash)
|
32
32
|
end
|
33
33
|
|
34
|
-
def new(*args, &blk)
|
35
|
-
Hash.new(*T.unsafe(args), &blk)
|
34
|
+
def new(*args, &blk)
|
35
|
+
Hash.new(*T.unsafe(args), &blk)
|
36
36
|
end
|
37
37
|
|
38
38
|
class Untyped < TypedHash
|
data/lib/types/utils.rb
CHANGED
@@ -23,13 +23,13 @@ module T::Utils
|
|
23
23
|
elsif val.is_a?(Module)
|
24
24
|
T::Types::Simple::Private::Pool.type_for_module(val)
|
25
25
|
elsif val.is_a?(::Array)
|
26
|
-
T::Types::FixedArray.new(val)
|
26
|
+
T::Types::FixedArray.new(val)
|
27
27
|
elsif val.is_a?(::Hash)
|
28
|
-
T::Types::FixedHash.new(val)
|
28
|
+
T::Types::FixedHash.new(val)
|
29
29
|
elsif val.is_a?(T::Private::Methods::DeclBuilder)
|
30
30
|
T::Private::Methods.finalize_proc(val.decl)
|
31
31
|
elsif val.is_a?(::T::Enum)
|
32
|
-
T::Types::TEnum.new(val)
|
32
|
+
T::Types::TEnum.new(val)
|
33
33
|
elsif val.is_a?(::String)
|
34
34
|
raise "Invalid String literal for type constraint. Must be an #{T::Types::Base}, a " \
|
35
35
|
"class/module, or an array. Got a String with value `#{val}`."
|
@@ -109,10 +109,10 @@ module T::Utils
|
|
109
109
|
|
110
110
|
# Returns the arity of a method, unwrapping the sig if needed
|
111
111
|
def self.arity(method)
|
112
|
-
arity = method.arity
|
112
|
+
arity = method.arity
|
113
113
|
return arity if arity != -1 || method.is_a?(Proc)
|
114
114
|
sig = T::Private::Methods.signature_for_method(method)
|
115
|
-
sig ? sig.method.arity : arity
|
115
|
+
sig ? sig.method.arity : arity
|
116
116
|
end
|
117
117
|
|
118
118
|
# Elide the middle of a string as needed and replace it with an ellipsis.
|
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.5911
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.90.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.90.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-performance
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.8.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.8.0
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: concurrent-ruby
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +128,14 @@ dependencies:
|
|
100
128
|
requirements:
|
101
129
|
- - "~>"
|
102
130
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
131
|
+
version: 2.7.1
|
104
132
|
type: :development
|
105
133
|
prerelease: false
|
106
134
|
version_requirements: !ruby/object:Gem::Requirement
|
107
135
|
requirements:
|
108
136
|
- - "~>"
|
109
137
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
138
|
+
version: 2.7.1
|
111
139
|
description: Sorbet's runtime type checking component
|
112
140
|
email:
|
113
141
|
executables: []
|