sorbet-runtime 0.6.13286 → 0.6.13291
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 -13
- 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: 638a6b73e828c48ae511c5c9d2672b02f93b639a888ab9923078f527b6e6c26b
|
|
4
|
+
data.tar.gz: 7a4f590dfff39dc7bdb87222fa532c8839857306cc3f019137c6862c572512e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eed2fb342c8327e84ca50de6bfcadd056298c948d103f5daae987eb491dc985d1c555b8f60f55d65fb203a2d2b4de30c48d738292b9cda012b51255ae212e1b5
|
|
7
|
+
data.tar.gz: fc83794c27cd1d2189b07a7423fae7ef7d63b2b939ff9646427d288114d8da4b167dbcddc40fff1312aa0ec99d1aed01c562b8bfe0b60e577ba2e6f63d939b5e
|
|
@@ -105,12 +105,17 @@ module T::Private::Methods
|
|
|
105
105
|
#
|
|
106
106
|
# we assume that source_method_names has already been filtered to only include method
|
|
107
107
|
# names that were declared final at one point.
|
|
108
|
+
#
|
|
109
|
+
# Returns a boolean indicating whether it's okay to define any of `source_method_names` in `target`
|
|
110
|
+
# (e.g. true if no final method violations)
|
|
108
111
|
def self._check_final_ancestors(target, source_method_names, source)
|
|
109
112
|
source_ancestors = nil
|
|
110
113
|
if T::Private::IS_TYPECHECKING
|
|
111
114
|
# Need to avoid a pinning error, but don't want to use runtime types in _methods.rb
|
|
112
115
|
source_ancestors = T.let(nil, T.nilable(T::Array[T::Module[T.anything]]))
|
|
116
|
+
found_error = T.let(false, T::Boolean)
|
|
113
117
|
end
|
|
118
|
+
found_error = false
|
|
114
119
|
# use reverse_each to check farther-up ancestors first, for better error messages.
|
|
115
120
|
target.ancestors.reverse_each do |ancestor|
|
|
116
121
|
final_methods = @modules_with_final.fetch(ancestor, nil)
|
|
@@ -142,6 +147,8 @@ module T::Private::Methods
|
|
|
142
147
|
next if defining_ancestor_idx && source_ancestors[defining_ancestor_idx] == ancestor
|
|
143
148
|
end
|
|
144
149
|
|
|
150
|
+
found_error = true
|
|
151
|
+
|
|
145
152
|
final_sig = T::Private::Methods.signature_for_method(ancestor.instance_method(method_name))
|
|
146
153
|
definition_file, definition_line = final_sig&.method&.source_location
|
|
147
154
|
is_redefined = target == ancestor
|
|
@@ -158,19 +165,14 @@ module T::Private::Methods
|
|
|
158
165
|
"#{extra_info}"
|
|
159
166
|
|
|
160
167
|
begin
|
|
168
|
+
# raise + rescue to populate the backtrace
|
|
161
169
|
raise pretty_message
|
|
162
170
|
rescue => e
|
|
163
|
-
# sig_validation_error_handler raises by default; on the off chance that
|
|
164
|
-
# it doesn't raise, we need to ensure that the rest of signature building
|
|
165
|
-
# sees a consistent state. This sig failed to validate, so we should get
|
|
166
|
-
# rid of it. If we don't do this, errors of the form "You called sig
|
|
167
|
-
# twice without declaring a method in between" will non-deterministically
|
|
168
|
-
# crop up in tests.
|
|
169
|
-
T::Private::DeclState.current.reset!
|
|
170
171
|
T::Configuration.sig_validation_error_handler(e, {})
|
|
171
172
|
end
|
|
172
173
|
end
|
|
173
174
|
end
|
|
175
|
+
!found_error
|
|
174
176
|
end
|
|
175
177
|
|
|
176
178
|
def self.add_module_with_final_method(mod, method_name)
|
|
@@ -193,22 +195,22 @@ module T::Private::Methods
|
|
|
193
195
|
end
|
|
194
196
|
|
|
195
197
|
current_declaration = T::Private::DeclState.current.active_declaration
|
|
198
|
+
T::Private::DeclState.current.reset!
|
|
196
199
|
|
|
197
200
|
if T::Private::Final.final_module?(mod) && (current_declaration.nil? || !current_declaration.final)
|
|
198
201
|
raise "#{mod} was declared as final but its method `#{method_name}` was not declared as final"
|
|
199
202
|
end
|
|
200
203
|
# Don't compute mod.ancestors if we don't need to bother checking final-ness.
|
|
201
|
-
if @was_ever_final_names.include?(method_name) && @modules_with_final.include?(mod)
|
|
202
|
-
|
|
203
|
-
# We
|
|
204
|
-
#
|
|
205
|
-
|
|
204
|
+
if @was_ever_final_names.include?(method_name) && @modules_with_final.include?(mod) &&
|
|
205
|
+
!_check_final_ancestors(mod, [method_name], nil)
|
|
206
|
+
# We want to pretend like the method did not have a sig, so return.
|
|
207
|
+
# (This code is not dead, because some `sig_validation_error_handler`'s do not raise.)
|
|
208
|
+
return
|
|
206
209
|
end
|
|
207
210
|
|
|
208
211
|
if current_declaration.nil?
|
|
209
212
|
return
|
|
210
213
|
end
|
|
211
|
-
T::Private::DeclState.current.reset!
|
|
212
214
|
|
|
213
215
|
if method_name == :method_added || method_name == :singleton_method_added
|
|
214
216
|
raise(
|
|
@@ -507,6 +509,7 @@ module T::Private::Methods
|
|
|
507
509
|
end
|
|
508
510
|
|
|
509
511
|
_check_final_ancestors(target, methods, source)
|
|
512
|
+
nil
|
|
510
513
|
end
|
|
511
514
|
|
|
512
515
|
def self.set_final_checks_on_hooks(enable)
|
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.6.
|
|
4
|
+
version: 0.6.13291
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stripe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: benchmark
|