sorbet-runtime 0.6.13629 → 0.6.13632
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/private/methods/signature.rb +10 -4
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4257e8ca00e1add499a378928571bea2674281fc10b65796b343f1ab934ad360
|
|
4
|
+
data.tar.gz: f3960d20e4b93c67c085b8745f5c29560296c741930f3d7f6207a0bfae394260
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b1e44f1984ffc3e8b309834a19491128133f0956842ce6372acb4caa2b2b669f7e1669f5d8213a8d614f1c900015b0239d5c0d2e9f87e426dad796a1155b9814
|
|
7
|
+
data.tar.gz: f97d4f469a9ef194c4d169c77eb3653c65ce6990c45dfabeb3b1be0b5247e48c942e75c165ba341d97307e1924567bc62bf9099ac76ac4724d94b5c667ecbb5a
|
|
@@ -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)
|