sorbet-runtime 0.5.5846 → 0.5.5848
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/_methods.rb +27 -16
- 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: 4e36df8a78c0d43e49da28e22b8b3a8db6094d50227f3be131ba05133b09cfd7
|
4
|
+
data.tar.gz: 1bfe28320c26f5749aff854bfbf9616d540a5f4d458dd35bc0e1add778a7e653
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8d0946d74e2a13eb6ffad4eb44633161da79d42b1a0e39a099a126f081e3346e6b7eecba85c50dfd333b890530a6d75bc85e7676a889fe9a1d0043198e502f6
|
7
|
+
data.tar.gz: 8e44416ca05dd56362fc4a36457885713dc02ac4b9367cddabfefd33f80c0ec087befd957cc2c5dd4a66361313c82a87dc4e86157415c50e1ede2851fceb2d91
|
@@ -206,22 +206,8 @@ module T::Private::Methods
|
|
206
206
|
# (or unwrap back to the original method).
|
207
207
|
new_method = nil
|
208
208
|
T::Private::ClassUtils.replace_method(mod, method_name) do |*args, &blk|
|
209
|
-
|
210
|
-
|
211
|
-
# to the original pre-unwound `sig` method. I guess we'll just proxy the
|
212
|
-
# call forever since we don't know who is holding onto this handle to
|
213
|
-
# replace it.
|
214
|
-
new_new_method = mod.instance_method(method_name)
|
215
|
-
if new_method == new_new_method
|
216
|
-
raise "`sig` not present for method `#{method_name}` but you're trying to run it anyways. " \
|
217
|
-
"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. " \
|
218
|
-
"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. " \
|
219
|
-
"Contact #dev-productivity if you're really stuck."
|
220
|
-
end
|
221
|
-
return new_new_method.bind(self).call(*args, &blk)
|
222
|
-
end
|
223
|
-
|
224
|
-
method_sig = T::Private::Methods.run_sig_block_for_method(new_method)
|
209
|
+
method_sig = T::Private::Methods.maybe_run_sig_block_for_method(new_method)
|
210
|
+
method_sig ||= T::Private::Methods._handle_missing_method_signature(mod, original_method, __callee__)
|
225
211
|
|
226
212
|
# Should be the same logic as CallValidation.wrap_method_if_needed but we
|
227
213
|
# don't want that extra layer of indirection in the callstack
|
@@ -252,6 +238,31 @@ module T::Private::Methods
|
|
252
238
|
end
|
253
239
|
end
|
254
240
|
|
241
|
+
def self._handle_missing_method_signature(mod, original_method, callee)
|
242
|
+
method_sig = T::Private::Methods.signature_for_method(original_method)
|
243
|
+
aliasing_method = mod.instance_method(callee)
|
244
|
+
|
245
|
+
if method_sig && aliasing_method != original_method && aliasing_method.original_name == original_method.name
|
246
|
+
# We're handling a case where `alias` or `alias_method` was called for a
|
247
|
+
# method which had already had a `sig` applied.
|
248
|
+
#
|
249
|
+
# Note, this logic is duplicated above, make sure to keep changes in sync.
|
250
|
+
if method_sig.check_level == :always || (method_sig.check_level == :tests && T::Private::RuntimeLevels.check_tests?)
|
251
|
+
# Checked, so copy the original signature to the aliased copy.
|
252
|
+
T::Private::Methods.unwrap_method(mod, method_sig, aliasing_method)
|
253
|
+
else
|
254
|
+
# Unchecked, so just make `alias_method` behave as if it had been called pre-sig.
|
255
|
+
mod.send(:alias_method, callee, original_method.name)
|
256
|
+
end
|
257
|
+
else
|
258
|
+
raise "`sig` not present for method `#{aliasing_method.name}` but you're trying to run it anyways. " \
|
259
|
+
"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. " \
|
260
|
+
"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."
|
261
|
+
end
|
262
|
+
|
263
|
+
method_sig
|
264
|
+
end
|
265
|
+
|
255
266
|
# Executes the `sig` block, and converts the resulting Declaration
|
256
267
|
# to a Signature.
|
257
268
|
def self.run_sig(hook_mod, method_name, original_method, declaration_block)
|
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.5848
|
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-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|