sorbet-runtime 0.6.13281 → 0.6.13282
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/_methods.rb +16 -16
- 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: 3a0290df342cc018e940ad2e2a6d0c2cb818f51efecd8a75a52a51f8c0d2e529
|
|
4
|
+
data.tar.gz: 717521fe6f84077e8af3aa2ae9da890b8062dd4c9f2ec926116f39c56d3c8e40
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc57cc0880f55d9d041c2f6890a28ccb391f03bfea556ef9af842ece6ca21ce7e51df88763895c26bd1e1618fd5ae4b31be1d249a62df4c8b3427bfa6cd5f1d7
|
|
7
|
+
data.tar.gz: 7e059978f282db576c909dd1c2a3497f9a1a2fe6618a8d4c9455bf097b8d9d77572fa7a3829e854d9b446658476f7475bcac9048fc1808c82895c02bbbe852b5
|
|
@@ -217,9 +217,21 @@ module T::Private::Methods
|
|
|
217
217
|
)
|
|
218
218
|
end
|
|
219
219
|
|
|
220
|
+
# We allow `sig` in the current module's context (normal case) and
|
|
221
|
+
if hook_mod != current_declaration.mod &&
|
|
222
|
+
# inside `class << self`, and
|
|
223
|
+
hook_mod.singleton_class != current_declaration.mod &&
|
|
224
|
+
# on `self` at the top level of a file
|
|
225
|
+
current_declaration.mod != TOP_SELF
|
|
226
|
+
raise "A method (#{method_name}) is being added on a different class/module (#{hook_mod}) than the " \
|
|
227
|
+
"last call to `sig` (#{current_declaration.mod}). Make sure each call " \
|
|
228
|
+
"to `sig` is immediately followed by a method definition on the same " \
|
|
229
|
+
"class/module."
|
|
230
|
+
end
|
|
231
|
+
|
|
220
232
|
original_method = mod.instance_method(method_name)
|
|
221
233
|
sig_block = lambda do
|
|
222
|
-
T::Private::Methods.run_sig(
|
|
234
|
+
T::Private::Methods.run_sig(method_name, original_method, current_declaration)
|
|
223
235
|
end
|
|
224
236
|
|
|
225
237
|
# Always replace the original method with this wrapper,
|
|
@@ -298,7 +310,7 @@ module T::Private::Methods
|
|
|
298
310
|
|
|
299
311
|
# Executes the `sig` block, and converts the resulting Declaration
|
|
300
312
|
# to a Signature.
|
|
301
|
-
def self.run_sig(
|
|
313
|
+
def self.run_sig(method_name, original_method, declaration_block)
|
|
302
314
|
current_declaration =
|
|
303
315
|
begin
|
|
304
316
|
run_builder(declaration_block)
|
|
@@ -312,7 +324,7 @@ module T::Private::Methods
|
|
|
312
324
|
|
|
313
325
|
signature =
|
|
314
326
|
if current_declaration
|
|
315
|
-
build_sig(
|
|
327
|
+
build_sig(method_name, original_method, current_declaration)
|
|
316
328
|
else
|
|
317
329
|
Signature.new_untyped(method: original_method)
|
|
318
330
|
end
|
|
@@ -342,20 +354,8 @@ module T::Private::Methods
|
|
|
342
354
|
decl
|
|
343
355
|
end
|
|
344
356
|
|
|
345
|
-
def self.build_sig(
|
|
357
|
+
def self.build_sig(method_name, original_method, current_declaration)
|
|
346
358
|
begin
|
|
347
|
-
# We allow `sig` in the current module's context (normal case) and
|
|
348
|
-
if hook_mod != current_declaration.mod &&
|
|
349
|
-
# inside `class << self`, and
|
|
350
|
-
hook_mod.singleton_class != current_declaration.mod &&
|
|
351
|
-
# on `self` at the top level of a file
|
|
352
|
-
current_declaration.mod != TOP_SELF
|
|
353
|
-
raise "A method (#{method_name}) is being added on a different class/module (#{hook_mod}) than the " \
|
|
354
|
-
"last call to `sig` (#{current_declaration.mod}). Make sure each call " \
|
|
355
|
-
"to `sig` is immediately followed by a method definition on the same " \
|
|
356
|
-
"class/module."
|
|
357
|
-
end
|
|
358
|
-
|
|
359
359
|
signature = Signature.new(
|
|
360
360
|
method: original_method,
|
|
361
361
|
method_name: method_name,
|