sorbet-runtime 0.5.9293 → 0.5.9303
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 +12 -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: 626e90f89004840a204df1556fe761795ecff636928bb58b67062728f94bacbc
|
4
|
+
data.tar.gz: ee019780da14b37e6f4bb011a298974ac926206016d46b5555948a0079d65ecb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aa7b65d30f76f923f355b9ebd009ea50fe55d4c5fd2eee0fbbc7e3b3547932c289ad12777505ecf2d4f11ef27be1b2ff238869ba7167c3937013df72da4bb49
|
7
|
+
data.tar.gz: d5bf96d9fe43fb2518313403f2bac770e65cbbaeb610b4b3c1e8d2ac7434052b3cfe7a5777cd3b19b022316b03fbe96e763f8433b8ae8abbbb36a315ba514343
|
@@ -9,7 +9,7 @@ module T::Private::Methods
|
|
9
9
|
# stores method names that were declared final without regard for where.
|
10
10
|
# enables early rejection of names that we know can't induce final method violations.
|
11
11
|
@was_ever_final_names = {}
|
12
|
-
# maps from
|
12
|
+
# maps from a module's object_id to the set of final methods declared in that module.
|
13
13
|
# we also overload entries slightly: if the value is nil, that means that the
|
14
14
|
# module has final methods somewhere along its ancestor chain, but does not itself
|
15
15
|
# have any final methods.
|
@@ -127,7 +127,7 @@ module T::Private::Methods
|
|
127
127
|
source_ancestors = nil
|
128
128
|
# use reverse_each to check farther-up ancestors first, for better error messages.
|
129
129
|
target_ancestors.reverse_each do |ancestor|
|
130
|
-
final_methods = @modules_with_final.fetch(ancestor, nil)
|
130
|
+
final_methods = @modules_with_final.fetch(ancestor.object_id, nil)
|
131
131
|
# In this case, either ancestor didn't have any final methods anywhere in its
|
132
132
|
# ancestor chain, or ancestor did have final methods somewhere in its ancestor
|
133
133
|
# chain, but no final methods defined in ancestor itself. Either way, there
|
@@ -145,13 +145,13 @@ module T::Private::Methods
|
|
145
145
|
# filter out things without actual final methods just to make sure that
|
146
146
|
# the below checks (which should be uncommon) go as quickly as possible.
|
147
147
|
source_ancestors.select! do |a|
|
148
|
-
@modules_with_final.fetch(a, nil)
|
148
|
+
@modules_with_final.fetch(a.object_id, nil)
|
149
149
|
end
|
150
150
|
end
|
151
151
|
# final-ness means that there should be no more than one index for which
|
152
152
|
# the below block returns true.
|
153
153
|
defining_ancestor_idx = source_ancestors.index do |a|
|
154
|
-
@modules_with_final.fetch(a).include?(method_name)
|
154
|
+
@modules_with_final.fetch(a.object_id).include?(method_name)
|
155
155
|
end
|
156
156
|
next if defining_ancestor_idx && source_ancestors[defining_ancestor_idx] == ancestor
|
157
157
|
end
|
@@ -188,10 +188,11 @@ module T::Private::Methods
|
|
188
188
|
|
189
189
|
def self.add_module_with_final_method(mod, method_name, is_singleton_method)
|
190
190
|
m = is_singleton_method ? mod.singleton_class : mod
|
191
|
-
|
191
|
+
mid = m.object_id
|
192
|
+
methods = @modules_with_final[mid]
|
192
193
|
if methods.nil?
|
193
194
|
methods = {}
|
194
|
-
@modules_with_final[
|
195
|
+
@modules_with_final[mid] = methods
|
195
196
|
end
|
196
197
|
methods[method_name] = true
|
197
198
|
nil
|
@@ -199,8 +200,8 @@ module T::Private::Methods
|
|
199
200
|
|
200
201
|
def self.note_module_deals_with_final(mod)
|
201
202
|
# Side-effectfully initialize the value if it's not already there
|
202
|
-
@modules_with_final[mod]
|
203
|
-
@modules_with_final[mod.singleton_class]
|
203
|
+
@modules_with_final[mod.object_id]
|
204
|
+
@modules_with_final[mod.singleton_class.object_id]
|
204
205
|
end
|
205
206
|
|
206
207
|
# Only public because it needs to get called below inside the replace_method blocks below.
|
@@ -216,7 +217,7 @@ module T::Private::Methods
|
|
216
217
|
raise "#{mod} was declared as final but its method `#{method_name}` was not declared as final"
|
217
218
|
end
|
218
219
|
# Don't compute mod.ancestors if we don't need to bother checking final-ness.
|
219
|
-
if @was_ever_final_names.include?(method_name) && @modules_with_final.include?(mod)
|
220
|
+
if @was_ever_final_names.include?(method_name) && @modules_with_final.include?(mod.object_id)
|
220
221
|
_check_final_ancestors(mod, mod.ancestors, [method_name], nil)
|
221
222
|
# We need to fetch the active declaration again, as _check_final_ancestors
|
222
223
|
# may have reset it (see the comment in that method for details).
|
@@ -466,8 +467,8 @@ module T::Private::Methods
|
|
466
467
|
def self._hook_impl(target, singleton_class, source)
|
467
468
|
# we do not need to call add_was_ever_final here, because we have already marked
|
468
469
|
# any such methods when source was originally defined.
|
469
|
-
if !@modules_with_final.include?(target)
|
470
|
-
if !@modules_with_final.include?(source)
|
470
|
+
if !@modules_with_final.include?(target.object_id)
|
471
|
+
if !@modules_with_final.include?(source.object_id)
|
471
472
|
return
|
472
473
|
end
|
473
474
|
note_module_deals_with_final(target)
|
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.9303
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|