sorbet-runtime 0.5.5898 → 0.5.5913

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a88a5e997f46fc330ea7f9f5d88d98ce7fb1cc614bca1a6d8bb91800533ae5cd
4
- data.tar.gz: 563be0299801f06d993077a23fcbd1b32cb507312ed48e599740f3f140f40ee5
3
+ metadata.gz: 5d4afb0a408f26a4f0ce753fa69d9d120ed98da8efa73c229b55e112c7f5a24d
4
+ data.tar.gz: 172efaccb0dec9648fddbd4b82cb9dfce7206f35601cefad59a06c094545540d
5
5
  SHA512:
6
- metadata.gz: 18f16d1daf156ab4a3766857817f5aabe3c62e95e1167837e972705759593a5b657a673e405befe851a2d4977dddcaab12a44bc7fc577f3e2228ed97dfc77024
7
- data.tar.gz: c0e2b2df56f873a8569c3367da251c7bd44a6ad5bce8663cfcdcc10480f5fc743c89164d41a4c2eee4013ecba3d6ec84c4356e575f907667084834a75f358808
6
+ metadata.gz: 419440730fce821a11a16e20d46d884e03a2a8b61463c005522415827b3363df867a25353c77f0d2d82c749a5cfcead54d4a6a65280b70cdf0315f13b32271b9
7
+ data.tar.gz: 18c7f4dff12289724c1aa8a39b5e5d2764160ad4a28d0c65e1b9967a2fb71767bbe159111b6825e0cc96a329a1cdb25999f65ac38af6186fa735621ca41e8b8a
@@ -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
@@ -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}" # rubocop:disable PrisonGuard/NoBarePuts
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}" # rubocop:disable PrisonGuard/NoBarePuts
285
+ puts "#{str}, extra: #{extra}"
286
286
  end
287
287
 
288
288
  def self.soft_assert_handler(str, extra)
@@ -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) # rubocop:disable PrisonGuard/UseOpusTypesShortcut
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) # rubocop:disable PrisonGuard/UseOpusTypesShortcut
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) # rubocop:disable PrisonGuard/BanBuiltinMethodOverride
86
+ def kind_of?(other)
87
87
  is_a?(other)
88
88
  end
89
89
 
90
- def is_a?(other) # rubocop:disable PrisonGuard/BanBuiltinMethodOverride
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}") # rubocop:disable PrisonGuard/NoLurkyInstanceVariableAccess
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) # rubocop:disable PrisonGuard/NoLurkyInstanceVariableAccess
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) # rubocop:disable PrisonGuard/UsePublicSend
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) # rubocop:disable PrisonGuard/UsePublicSend
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) # rubocop:disable PrisonGuard/UsePublicSend
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) # rubocop:disable PrisonGuard/UsePublicSend
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) # rubocop:disable PrisonGuard/UsePublicSend
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) # rubocop:disable PrisonGuard/UseOpusTypesShortcut
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) # rubocop:disable PrisonGuard/NoDynamicConstAccess
484
+ obj = ObjectSpace._id2ref(id.to_i)
485
485
  obj.instance_method(name)
486
486
  end
487
487
  end
@@ -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(':').first
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 prop_name =~ /\bsecret\b/
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
@@ -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) # rubocop:disable PrisonGuard/NoDynamicConstAccess
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) # rubocop:disable PrisonGuard/NoDynamicConstAccess
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) # rubocop:disable PrisonGuard/NoLurkyInstanceVariableAccess
125
- new_extra = new_val.instance_variable_get(:@_extra_props) # rubocop:disable PrisonGuard/NoLurkyInstanceVariableAccess
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
@@ -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 # rubocop:disable PrisonGuard/BanBuiltinMethodOverride
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 PrisonGuard/BanBuiltinMethodOverride, Lint/DuplicateMethods
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) # rubocop:disable PrisonGuard/BanBuiltinMethodOverride
27
+ def sig(arg0=nil, &blk)
28
28
  T::Private::Methods.declare_sig(self, arg0, &blk)
29
29
  end
30
30
  end
@@ -22,7 +22,7 @@ module T::Types
22
22
  obj.is_a?(Array)
23
23
  end
24
24
 
25
- def new(*args) # rubocop:disable PrisonGuard/BanBuiltinMethodOverride
25
+ def new(*args)
26
26
  Array.new(*T.unsafe(args))
27
27
  end
28
28
 
@@ -24,7 +24,7 @@ module T::Types
24
24
  obj.is_a?(Enumerator)
25
25
  end
26
26
 
27
- def new(*args, &blk) # rubocop:disable PrisonGuard/BanBuiltinMethodOverride
27
+ def new(*args, &blk)
28
28
  T.unsafe(Enumerator).new(*args, &blk)
29
29
  end
30
30
 
@@ -31,8 +31,8 @@ module T::Types
31
31
  obj.is_a?(Hash)
32
32
  end
33
33
 
34
- def new(*args, &blk) # rubocop:disable PrisonGuard/BanBuiltinMethodOverride
35
- Hash.new(*T.unsafe(args), &blk) # rubocop:disable PrisonGuard/RestrictHashDefaults
34
+ def new(*args, &blk)
35
+ Hash.new(*T.unsafe(args), &blk)
36
36
  end
37
37
 
38
38
  class Untyped < TypedHash
@@ -24,7 +24,7 @@ module T::Types
24
24
  obj.is_a?(Range)
25
25
  end
26
26
 
27
- def new(*args) # rubocop:disable PrisonGuard/BanBuiltinMethodOverride
27
+ def new(*args)
28
28
  T.unsafe(Range).new(*args)
29
29
  end
30
30
  end
@@ -24,7 +24,7 @@ module T::Types
24
24
  obj.is_a?(Set)
25
25
  end
26
26
 
27
- def new(*args) # rubocop:disable PrisonGuard/BanBuiltinMethodOverride
27
+ def new(*args)
28
28
  Set.new(*T.unsafe(args))
29
29
  end
30
30
 
@@ -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) # rubocop:disable PrisonGuard/UseOpusTypesShortcut
26
+ T::Types::FixedArray.new(val)
27
27
  elsif val.is_a?(::Hash)
28
- T::Types::FixedHash.new(val) # rubocop:disable PrisonGuard/UseOpusTypesShortcut
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) # rubocop:disable PrisonGuard/UseOpusTypesShortcut
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 # rubocop:disable PrisonGuard/NoArity
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 # rubocop:disable PrisonGuard/NoArity
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.5898
4
+ version: 0.5.5913
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-10 00:00:00.000000000 Z
11
+ date: 2020-09-18 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: '2.7'
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: '2.7'
138
+ version: 2.7.1
111
139
  description: Sorbet's runtime type checking component
112
140
  email:
113
141
  executables: []