sorbet-runtime 0.6.13367 → 0.6.13371
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 +18 -13
- 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: df752ebf8f7f9c90748d9df8dbc6e8fd1ccd2235734f027e3d8a884534291bc2
|
|
4
|
+
data.tar.gz: 6f9f13b4aca3e5a8d6be8ce41b50515a1102d3bf4010c89b2768faede6bdfaaa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1b6d151be49e851cd4afb83665c681c524fe5204722194952852faa8d21da74e8fc296d1131c662eec5c43f7ceb8fcf0b46af47716d11977e8aee687e3dde0ff
|
|
7
|
+
data.tar.gz: cf4bfd7b7f6f8e5552bff3b5eb9bc99eccfaa8afb728b73ab2f62f21991c86628def1ba20efe6b09126d5bdcdc50456d0f7426fce48a991fd73b711dadf6763c
|
|
@@ -358,11 +358,22 @@ module T::Private::Methods
|
|
|
358
358
|
key = method_owner_and_name_to_key(mod, method_name)
|
|
359
359
|
T::Private::ClassUtils.replace_method(original_method, mod, method_name) do |*args, &blk|
|
|
360
360
|
method_sig = T::Private::Methods.maybe_run_sig_block_for_key(key)
|
|
361
|
-
method_sig
|
|
362
|
-
|
|
363
|
-
original_method
|
|
364
|
-
|
|
365
|
-
|
|
361
|
+
if !method_sig
|
|
362
|
+
callee = __callee__ || raise("Unknown __callee__ for method without a signature")
|
|
363
|
+
method_sig = T::Private::Methods.signature_for_method(original_method)
|
|
364
|
+
if !method_sig
|
|
365
|
+
raise "`sig` not present for method `#{callee}` on #{self.inspect} but you're trying to run it anyways. " \
|
|
366
|
+
"This should only be executed if you used `alias_method` to grab a handle to a method after `sig`ing it, but that clearly isn't what you are doing. " \
|
|
367
|
+
"Maybe look to see if an exception was thrown in your `sig` lambda or somehow else your `sig` wasn't actually applied to the method."
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
method_sig = T::Private::Methods._unwrap_alias(
|
|
371
|
+
method_sig,
|
|
372
|
+
self,
|
|
373
|
+
original_method,
|
|
374
|
+
callee,
|
|
375
|
+
)
|
|
376
|
+
end
|
|
366
377
|
|
|
367
378
|
# Should be the same logic as CallValidation.wrap_method_if_needed but we
|
|
368
379
|
# don't want that extra layer of indirection in the callstack
|
|
@@ -388,14 +399,8 @@ module T::Private::Methods
|
|
|
388
399
|
end
|
|
389
400
|
end
|
|
390
401
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
if !method_sig
|
|
394
|
-
raise "`sig` not present for method `#{callee}` on #{receiver.inspect} but you're trying to run it anyways. " \
|
|
395
|
-
"This should only be executed if you used `alias_method` to grab a handle to a method after `sig`ing it, but that clearly isn't what you are doing. " \
|
|
396
|
-
"Maybe look to see if an exception was thrown in your `sig` lambda or somehow else your `sig` wasn't actually applied to the method."
|
|
397
|
-
end
|
|
398
|
-
|
|
402
|
+
# Only public so that it can be accessed in the closure for _on_method_added
|
|
403
|
+
def self._unwrap_alias(method_sig, receiver, original_method, callee)
|
|
399
404
|
if receiver.class <= original_method.owner
|
|
400
405
|
receiving_class = receiver.class
|
|
401
406
|
elsif receiver.singleton_class <= original_method.owner
|