sorbet-runtime 0.6.13629 → 0.6.13634
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a38f300b9a61a2b06288ce274ba02ee8bcf13fac84309b5d2224c86180e6f5a6
|
|
4
|
+
data.tar.gz: b514881d392619bba66dd8c93653dd245d3ce191246e750d9ffe3f75469bd86e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8eb9be0434a67481c2bb7efb97d75bf6908afeffb098a94547e7a54eceaefa8dcf1866eefa1c1cec4a8a9d6a5972997705e0d5bac0d7b4a51cfe4ec91bbd2d9c
|
|
7
|
+
data.tar.gz: d54c56982e15c1f40d0aa3fe0c64d37b447894329d8016cf901cfe8980a7422ef97cf9d3b0d74fb66e039ab9dd37e4567ff162600e58ca390fb2fa7e61f854ea
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
class T::Private::Methods::Signature
|
|
8
8
|
attr_reader :method, :method_name, :arg_types, :kwarg_types, :block_type,
|
|
9
9
|
:rest_type, :keyrest_type, :bind, :effective_return_type,
|
|
10
|
-
:return_type, :req_arg_count, :req_kwarg_names, :
|
|
10
|
+
:return_type, :req_arg_count, :req_kwarg_names, :on_failure
|
|
11
11
|
|
|
12
12
|
# @flags packs, from the low bits up: mode (3 bits), check_level (2 bits),
|
|
13
13
|
# override_allow_incompatible (2 bits), and defined_raw (1 bit).
|
|
@@ -58,7 +58,7 @@ class T::Private::Methods::Signature
|
|
|
58
58
|
)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
def initialize(method:, method_name:, raw_arg_types:, raw_return_type:, bind:, mode:, check_level:, on_failure:, parameters:
|
|
61
|
+
def initialize(method:, method_name:, raw_arg_types:, raw_return_type:, bind:, mode:, check_level:, on_failure:, parameters: nil, override_allow_incompatible: false, defined_raw: false)
|
|
62
62
|
check_level = check_level.nil? ? T::Private::RuntimeLevels.default_checked_level : check_level
|
|
63
63
|
@method = method
|
|
64
64
|
@method_name = method_name
|
|
@@ -73,6 +73,7 @@ class T::Private::Methods::Signature
|
|
|
73
73
|
end
|
|
74
74
|
@bind = NilClass.===(bind) ? bind : T::Utils.coerce(bind)
|
|
75
75
|
@parameters = parameters
|
|
76
|
+
parameters ||= method.parameters
|
|
76
77
|
@on_failure = on_failure
|
|
77
78
|
@flags = flag_index(FLAG_MODES, mode, 'mode') |
|
|
78
79
|
(flag_index(FLAG_CHECK_LEVELS, check_level, 'check_level') << CHECK_LEVEL_SHIFT) |
|
|
@@ -172,6 +173,7 @@ class T::Private::Methods::Signature
|
|
|
172
173
|
i += 1
|
|
173
174
|
end
|
|
174
175
|
|
|
176
|
+
@parameters ||= parameters unless @rest_type.nil?
|
|
175
177
|
@arg_types = arg_types || EMPTY_LIST
|
|
176
178
|
@kwarg_types = kwarg_types || EMPTY_HASH
|
|
177
179
|
@req_arg_count = req_arg_count
|
|
@@ -188,6 +190,10 @@ class T::Private::Methods::Signature
|
|
|
188
190
|
end
|
|
189
191
|
|
|
190
192
|
# Names are derived rather than stored so that Signature fits in a smaller GC slot.
|
|
193
|
+
def parameters
|
|
194
|
+
@parameters || @method.parameters
|
|
195
|
+
end
|
|
196
|
+
|
|
191
197
|
def block_name
|
|
192
198
|
parameter_name(:block)
|
|
193
199
|
end
|
|
@@ -312,12 +318,12 @@ class T::Private::Methods::Signature
|
|
|
312
318
|
|
|
313
319
|
# The rest param directly follows the positional params unless required params come after it.
|
|
314
320
|
private def fast_rest_name
|
|
315
|
-
param_kind, param_name =
|
|
321
|
+
param_kind, param_name = parameters[@arg_types.length]
|
|
316
322
|
param_kind == :rest ? param_name : parameter_name(:rest)
|
|
317
323
|
end
|
|
318
324
|
|
|
319
325
|
private def parameter_name(kind)
|
|
320
|
-
|
|
326
|
+
parameters.assoc(kind)&.[](1)
|
|
321
327
|
end
|
|
322
328
|
|
|
323
329
|
private def flag_index(values, value, field)
|
|
@@ -232,7 +232,9 @@ module T::Private::Methods::SignatureValidation
|
|
|
232
232
|
end
|
|
233
233
|
end
|
|
234
234
|
|
|
235
|
-
|
|
235
|
+
# block_type is set exactly when the method declares a block param, and
|
|
236
|
+
# unlike block_name, reading it doesn't rebuild `method.parameters`.
|
|
237
|
+
if !super_signature.block_type.nil? && signature.block_type.nil?
|
|
236
238
|
raise "Your definition of `#{method_name}` must accept a block parameter to be compatible " \
|
|
237
239
|
"with the method it #{mode_verb}: " \
|
|
238
240
|
"#{base_override_loc_str(signature, super_signature)}"
|