sorbet-runtime 0.5.5848 → 0.5.5851

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e36df8a78c0d43e49da28e22b8b3a8db6094d50227f3be131ba05133b09cfd7
4
- data.tar.gz: 1bfe28320c26f5749aff854bfbf9616d540a5f4d458dd35bc0e1add778a7e653
3
+ metadata.gz: c454cb15e39b7993b14f0351e090110a0f49b19f2fb851179699e1e70f87f9d2
4
+ data.tar.gz: 37f92c032bd9af70232c7400549287cf9a026fb4137eeb7b1af23d95289e3286
5
5
  SHA512:
6
- metadata.gz: a8d0946d74e2a13eb6ffad4eb44633161da79d42b1a0e39a099a126f081e3346e6b7eecba85c50dfd333b890530a6d75bc85e7676a889fe9a1d0043198e502f6
7
- data.tar.gz: 8e44416ca05dd56362fc4a36457885713dc02ac4b9367cddabfefd33f80c0ec087befd957cc2c5dd4a66361313c82a87dc4e86157415c50e1ede2851fceb2d91
6
+ metadata.gz: 52989449f24b265c5612ed9916b107d0b81fb1565d6e70399f9f5d5b4bcf92c03b6cd6ecdbe9986cf8a4cead03b75a886ac133dcb076011e164cca15ebc464a9
7
+ data.tar.gz: a4dc951f7c3572c7557870b57fdf5ef409c61858f909f4603b6c92999c2040ea29841a120b916d5a678c11c6d83468a357d5fe3ce15f60b9b9cdc5f3118f5732
@@ -146,9 +146,10 @@ class T::Private::Methods::Signature
146
146
  # can't) match the definition of the method we're validating. In addition, Ruby has a bug that
147
147
  # causes forwarding **kwargs to do the wrong thing: see https://bugs.ruby-lang.org/issues/10708
148
148
  # and https://bugs.ruby-lang.org/issues/11860.
149
- if (args.length > @req_arg_count) && (!@kwarg_types.empty? || @has_keyrest) && args[-1].is_a?(Hash)
149
+ args_length = args.length
150
+ if (args_length > @req_arg_count) && (!@kwarg_types.empty? || @has_keyrest) && args[-1].is_a?(Hash)
150
151
  kwargs = args[-1]
151
- args = args[0...-1]
152
+ args_length -= 1
152
153
  else
153
154
  kwargs = EMPTY_HASH
154
155
  end
@@ -156,19 +157,19 @@ class T::Private::Methods::Signature
156
157
  arg_types = @arg_types
157
158
 
158
159
  if @has_rest
159
- arg_types += [[@rest_name, @rest_type]] * (args.length - @arg_types.length)
160
+ arg_types += [[@rest_name, @rest_type]] * (args_length - @arg_types.length)
160
161
 
161
- elsif (args.length < @req_arg_count) || (args.length > @arg_types.length)
162
+ elsif (args_length < @req_arg_count) || (args_length > @arg_types.length)
162
163
  expected_str = @req_arg_count.to_s
163
164
  if @arg_types.length != @req_arg_count
164
165
  expected_str += "..#{@arg_types.length}"
165
166
  end
166
- raise ArgumentError.new("wrong number of arguments (given #{args.length}, expected #{expected_str})")
167
+ raise ArgumentError.new("wrong number of arguments (given #{args_length}, expected #{expected_str})")
167
168
  end
168
169
 
169
170
  begin
170
171
  it = 0
171
- while it < args.length
172
+ while it < args_length
172
173
  yield arg_types[it][0], args[it], arg_types[it][1]
173
174
  it += 1
174
175
  end
@@ -12,7 +12,11 @@ module T::Types
12
12
 
13
13
  # @override Base
14
14
  def name
15
- @raw_type.name
15
+ # Memoize to mitigate pathological performance with anonymous modules (https://bugs.ruby-lang.org/issues/11119)
16
+ #
17
+ # `name` isn't normally a hot path for types, but it is used in initializing a T::Types::Union,
18
+ # and so in `T.nilable`, and so in runtime constructions like `x = T.let(nil, T.nilable(Integer))`.
19
+ @name ||= @raw_type.name.freeze
16
20
  end
17
21
 
18
22
  # @override Base
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.5848
4
+ version: 0.5.5851
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-28 00:00:00.000000000 Z
11
+ date: 2020-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest