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 +4 -4
- data/lib/types/private/methods/signature.rb +7 -6
- data/lib/types/types/simple.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c454cb15e39b7993b14f0351e090110a0f49b19f2fb851179699e1e70f87f9d2
|
4
|
+
data.tar.gz: 37f92c032bd9af70232c7400549287cf9a026fb4137eeb7b1af23d95289e3286
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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]] * (
|
160
|
+
arg_types += [[@rest_name, @rest_type]] * (args_length - @arg_types.length)
|
160
161
|
|
161
|
-
elsif (
|
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 #{
|
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 <
|
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
|
data/lib/types/types/simple.rb
CHANGED
@@ -12,7 +12,11 @@ module T::Types
|
|
12
12
|
|
13
13
|
# @override Base
|
14
14
|
def name
|
15
|
-
|
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.
|
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-
|
11
|
+
date: 2020-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|