sorbet-runtime 0.5.5909 → 0.5.5916
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/_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/private/sealed.rb +1 -1
- data/lib/types/props/decorator.rb +1 -1
- data/lib/types/props/generated_code_validation.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: e32f5e90e7b5d2dc264d0b78d6a6b0d3d1400c14d7cddd21469e20ec23281e1d
|
4
|
+
data.tar.gz: e88f1fceec145d3fe10047d218900e3dabc3ebbe7c31b0cb7b8c8a8399ee7518
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35360cf5490203fbaf667cf768576a587567e699c1b6afe0260f870147c42da9773bf5b07e7783d450e88118ad9740da6636ab02e1e4f067e086bf89db56ed9f
|
7
|
+
data.tar.gz: bcc443f23140514d1e509a5c3a62d9468e6a91f37c5c7056f2dad24209404eb5d50f1593e7224c7dc3a7fb342fe98de348429cd5d7b5451bac660d34f5f887c9
|
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/private/sealed.rb
CHANGED
@@ -46,7 +46,7 @@ module T::Private::Sealed
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def self.validate_inheritance(this_line, parent, verb)
|
49
|
-
this_file = this_line&.split(':')
|
49
|
+
this_file = this_line&.split(':')&.first
|
50
50
|
decl_file = parent.instance_variable_get(:@sorbet_sealed_module_decl_file)
|
51
51
|
|
52
52
|
if !this_file || !decl_file
|
@@ -427,7 +427,7 @@ class T::Props::Decorator
|
|
427
427
|
# TODO(PRIVACYENG-982) Ideally we'd also check for 'password' and possibly
|
428
428
|
# other terms, but this interacts badly with ProtoDefinedDocument because
|
429
429
|
# the proto syntax currently can't declare "sensitivity: []"
|
430
|
-
if
|
430
|
+
if /\bsecret\b/.match?(prop_name)
|
431
431
|
T::Configuration.hard_assert_handler(
|
432
432
|
"#{@class}##{prop_name} has the word 'secret' in its name, but no " \
|
433
433
|
"'sensitivity:' annotation. This is probably wrong, because if a " \
|
@@ -170,7 +170,7 @@ module T::Props
|
|
170
170
|
|
171
171
|
private_class_method def self.validate_deserialize_handle_nil(node)
|
172
172
|
case node.type
|
173
|
-
when :hash, :array, :str, :sym, :int, :float, :true, :false, :nil, :const
|
173
|
+
when :hash, :array, :str, :sym, :int, :float, :true, :false, :nil, :const # rubocop:disable Lint/BooleanSymbol
|
174
174
|
# Primitives and constants are safe
|
175
175
|
when :send
|
176
176
|
receiver, method, arg = node.children
|
@@ -209,7 +209,7 @@ module T::Props
|
|
209
209
|
when :const
|
210
210
|
# This is ok, because we'll have validated what method has been called
|
211
211
|
# if applicable
|
212
|
-
when :hash, :array, :str, :sym, :int, :float, :true, :false, :nil, :self
|
212
|
+
when :hash, :array, :str, :sym, :int, :float, :true, :false, :nil, :self # rubocop:disable Lint/BooleanSymbol
|
213
213
|
# Primitives & self are ok
|
214
214
|
when :lvar, :arg, :ivar
|
215
215
|
# Reading local & instance variables & arguments is ok
|
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.5916
|
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-23 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: []
|