sorbet-runtime 0.5.11262 → 0.5.11266
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/sorbet-runtime.rb +1 -0
- data/lib/types/private/caller_utils.rb +21 -0
- data/lib/types/private/methods/_methods.rb +1 -1
- data/lib/types/private/sealed.rb +6 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62a1d832c6ab11c77c2604ee4f41e90ce19504ceb77e26a2ac1a1946316c5850
|
4
|
+
data.tar.gz: ef76ff59edbc69784d52817720f36fc38d3705849b4eea653f40b52bf7c4b1dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e666a6f08ec47051bcd8a7b92320089d1841544c526be65c3cdb17d0a0cea3fd4e2e921e7b389ea52b836c2a076e18346215d2c484b7efbda372cd6dd232dc58
|
7
|
+
data.tar.gz: e44d0e46981e86bd7c5f124ea1a1592d64a44955f9f405e0dcb6a61f02fb03ac4021d13bb9e01f1ac6599d94c9f7521d3164cd98f0b7efe3cc687fcb799fa6cf
|
data/lib/sorbet-runtime.rb
CHANGED
@@ -19,6 +19,7 @@ module T::Private::Types; end
|
|
19
19
|
require_relative 'types/configuration'
|
20
20
|
require_relative 'types/_types'
|
21
21
|
require_relative 'types/private/decl_state'
|
22
|
+
require_relative 'types/private/caller_utils'
|
22
23
|
require_relative 'types/private/class_utils'
|
23
24
|
require_relative 'types/private/runtime_levels'
|
24
25
|
require_relative 'types/private/methods/_methods'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# typed: false
|
3
|
+
|
4
|
+
module T::Private::CallerUtils
|
5
|
+
if Thread.respond_to?(:each_caller_location) # RUBY_VERSION >= "3.2"
|
6
|
+
def self.find_caller
|
7
|
+
Thread.each_caller_location do |loc|
|
8
|
+
next if loc.path&.start_with?("<internal:")
|
9
|
+
|
10
|
+
return loc if yield(loc)
|
11
|
+
end
|
12
|
+
nil
|
13
|
+
end
|
14
|
+
else
|
15
|
+
def self.find_caller
|
16
|
+
caller_locations(2).find do |loc|
|
17
|
+
!loc.path&.start_with?("<internal:") && yield(loc)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -168,7 +168,7 @@ module T::Private::Methods
|
|
168
168
|
|
169
169
|
definition_file, definition_line = T::Private::Methods.signature_for_method(ancestor.instance_method(method_name)).method.source_location
|
170
170
|
is_redefined = target == ancestor
|
171
|
-
caller_loc =
|
171
|
+
caller_loc = T::Private::CallerUtils.find_caller {|loc| !loc.path.to_s.start_with?(SORBET_RUNTIME_LIB_PATH)}
|
172
172
|
extra_info = "\n"
|
173
173
|
if caller_loc
|
174
174
|
extra_info = (is_redefined ? "Redefined" : "Overridden") + " here: #{caller_loc.path}:#{caller_loc.lineno}\n"
|
data/lib/types/private/sealed.rb
CHANGED
@@ -5,8 +5,8 @@ module T::Private::Sealed
|
|
5
5
|
module NoInherit
|
6
6
|
def inherited(child)
|
7
7
|
super
|
8
|
-
|
9
|
-
T::Private::Sealed.validate_inheritance(
|
8
|
+
caller_loc = T::Private::CallerUtils.find_caller {|loc| !loc.to_s.match(/in `inherited'$/)}
|
9
|
+
T::Private::Sealed.validate_inheritance(caller_loc&.to_s, self, child, 'inherited')
|
10
10
|
@sorbet_sealed_module_all_subclasses << child
|
11
11
|
end
|
12
12
|
|
@@ -22,15 +22,15 @@ module T::Private::Sealed
|
|
22
22
|
module NoIncludeExtend
|
23
23
|
def included(child)
|
24
24
|
super
|
25
|
-
|
26
|
-
T::Private::Sealed.validate_inheritance(
|
25
|
+
caller_loc = T::Private::CallerUtils.find_caller {|loc| !loc.to_s.match(/in `included'$/)}
|
26
|
+
T::Private::Sealed.validate_inheritance(caller_loc&.to_s, self, child, 'included')
|
27
27
|
@sorbet_sealed_module_all_subclasses << child
|
28
28
|
end
|
29
29
|
|
30
30
|
def extended(child)
|
31
31
|
super
|
32
|
-
|
33
|
-
T::Private::Sealed.validate_inheritance(
|
32
|
+
caller_loc = T::Private::CallerUtils.find_caller {|loc| !loc.to_s.match(/in `extended'$/)}
|
33
|
+
T::Private::Sealed.validate_inheritance(caller_loc&.to_s, self, child, 'extended')
|
34
34
|
@sorbet_sealed_module_all_subclasses << child
|
35
35
|
end
|
36
36
|
|
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.11266
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- lib/types/private/abstract/declare.rb
|
157
157
|
- lib/types/private/abstract/hooks.rb
|
158
158
|
- lib/types/private/abstract/validate.rb
|
159
|
+
- lib/types/private/caller_utils.rb
|
159
160
|
- lib/types/private/casts.rb
|
160
161
|
- lib/types/private/class_utils.rb
|
161
162
|
- lib/types/private/compiler.rb
|