sorbet-runtime 0.5.11577 → 0.5.11805
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 +23 -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: 7946b62c297a982d76d43ba4fcd504263068bd17c8419243dd8c69208693631c
|
4
|
+
data.tar.gz: 455bfe3014753f40060dcab802576b32c86506ff74f2f0cdd8a7dab2a181cb45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 134389660683dcc474e3930f68d9ab62b47d06bae9655457559b2d019d408cbc47b8147b55e4193032f1b5df782f3b357496422886de87e52e1c31217c2b4ef0
|
7
|
+
data.tar.gz: da1e076a457e2becaa16be9f6ee09999b13852de65f4d91f808acb96973b6afb86223d7e1bbbbb891675defdfa2b1be0dd46782b870db3cc106b7e6d47f9ceba
|
@@ -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,28 @@ 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
|
+
T::Configuration.without_ruby_warnings do
|
50
|
+
T::Private::DeclState.current.without_on_method_added do
|
51
|
+
mod.module_eval(<<~METHOD, __FILE__, __LINE__ + 1)
|
52
|
+
#{original_visibility}
|
53
|
+
|
54
|
+
def #{method_sig.method_name}(...)
|
55
|
+
# We allow abstract methods to be implemented by things further down the ancestor chain.
|
56
|
+
# So, if a super method exists, call it.
|
57
|
+
if defined?(super)
|
58
|
+
super
|
59
|
+
else
|
60
|
+
raise NotImplementedError.new(
|
61
|
+
"The method `#{method_sig.method_name}` on #{mod} is declared as `abstract`. It does not have an implementation."
|
62
|
+
)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
METHOD
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
58
70
|
def self.create_validator_method(mod, original_method, method_sig, original_visibility)
|
59
71
|
has_fixed_arity = method_sig.kwarg_types.empty? && !method_sig.has_rest && !method_sig.has_keyrest &&
|
60
72
|
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.11805
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|