sorbet-runtime 0.5.11630 → 0.5.11631
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/call_validation.rb +19 -11
- 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: a27b896bd723d6f63b64ba8711ea04f7a23d2165d1d8035d6e01eccc02639199
|
4
|
+
data.tar.gz: 74ae43e39753e0cb83965370ba1acbdf1c8021fb6e58ea7f9804e1013a35e9be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fe5461da25b2e082dfed538db7d740bb20339e5ca8c2dc4b98d2ce2f2347f0bf1a1515af8f403a9964c89c72217e89b32954ff3e66bc7b8af49e6fe0ab32e26
|
7
|
+
data.tar.gz: 0c32571b344b3b686c6a9bb990c6dbd20131794cb4278ac1920484e5ad9f3c5927064f09146c6cae59487faa60d9302e48606610f16dfaf8a281187daebc7701
|
@@ -14,17 +14,7 @@ module T::Private::Methods::CallValidation
|
|
14
14
|
def self.wrap_method_if_needed(mod, method_sig, original_method)
|
15
15
|
original_visibility = visibility_method_name(mod, method_sig.method_name)
|
16
16
|
if method_sig.mode == T::Private::Methods::Modes.abstract
|
17
|
-
|
18
|
-
# We allow abstract methods to be implemented by things further down the ancestor chain.
|
19
|
-
# So, if a super method exists, call it.
|
20
|
-
if defined?(super)
|
21
|
-
super(*args, &blk)
|
22
|
-
else
|
23
|
-
raise NotImplementedError.new(
|
24
|
-
"The method `#{method_sig.method_name}` on #{mod} is declared as `abstract`. It does not have an implementation."
|
25
|
-
)
|
26
|
-
end
|
27
|
-
end
|
17
|
+
create_abstract_wrapper(mod, method_sig, original_method, original_visibility)
|
28
18
|
# Do nothing in this case; this method was not wrapped in _on_method_added.
|
29
19
|
elsif method_sig.defined_raw
|
30
20
|
# Note, this logic is duplicated (intentionally, for micro-perf) at `Methods._on_method_added`,
|
@@ -55,6 +45,24 @@ module T::Private::Methods::CallValidation
|
|
55
45
|
@is_allowed_to_have_fast_path = false
|
56
46
|
end
|
57
47
|
|
48
|
+
def self.create_abstract_wrapper(mod, method_sig, original_method, original_visibility)
|
49
|
+
mod.module_eval(<<~METHOD, __FILE__, __LINE__ + 1)
|
50
|
+
#{original_visibility}
|
51
|
+
|
52
|
+
def #{method_sig.method_name}(...)
|
53
|
+
# We allow abstract methods to be implemented by things further down the ancestor chain.
|
54
|
+
# So, if a super method exists, call it.
|
55
|
+
if defined?(super)
|
56
|
+
super
|
57
|
+
else
|
58
|
+
raise NotImplementedError.new(
|
59
|
+
"The method `#{method_sig.method_name}` on #{mod} is declared as `abstract`. It does not have an implementation."
|
60
|
+
)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
METHOD
|
64
|
+
end
|
65
|
+
|
58
66
|
def self.create_validator_method(mod, original_method, method_sig, original_visibility)
|
59
67
|
has_fixed_arity = method_sig.kwarg_types.empty? && !method_sig.has_rest && !method_sig.has_keyrest &&
|
60
68
|
original_method.parameters.all? {|(kind, _name)| kind == :req || kind == :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.11631
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|