sorbet-runtime 0.6.13309 → 0.6.13310
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/runtime_levels.rb +6 -3
- data/lib/types/private/types/type_alias.rb +26 -2
- 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: 6685b4e667333300a4f54ac14c7b71aef7a090467c7fd162b6ec05d5dc997ff2
|
|
4
|
+
data.tar.gz: f0f442035ebfe055d5360f17282353d8736e815b4d4f807b97e4c2c1ccba071e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7b230c0ed580f8c1f2e0e50c62dbdd37b4ac3458cbf2bac86be7e9e3f2684106188841109da2c884d702f7409cb8f9e7b4b36e1e2e2e56fc6452e1f341395774
|
|
7
|
+
data.tar.gz: 60514599101bb1cc5e6290d7f6f93a4c47d24cb651b26e3ab4b77aea28727ae8a1cd7f4d1569a5127aad0ba016cbb647da2630cd3332c769944c06b3f84a680e
|
|
@@ -33,9 +33,12 @@ module T::Private::RuntimeLevels
|
|
|
33
33
|
if !@check_tests && @wrapped_tests_with_validation
|
|
34
34
|
all_checked_tests_sigs = T::Private::Methods.all_checked_tests_sigs
|
|
35
35
|
locations = all_checked_tests_sigs.map { |sig| sig.method.source_location&.join(':') }.join("\n- ")
|
|
36
|
-
|
|
37
|
-
"There are already some methods wrapped with
|
|
38
|
-
|
|
36
|
+
msg = "Toggle `:tests`-level runtime type checking earlier. " \
|
|
37
|
+
"There are already some methods or type aliases wrapped with `.checked(:tests)`"
|
|
38
|
+
if !locations.empty?
|
|
39
|
+
msg += ":\n- #{locations}"
|
|
40
|
+
end
|
|
41
|
+
raise msg
|
|
39
42
|
end
|
|
40
43
|
|
|
41
44
|
_toggle_checking_tests(true)
|
|
@@ -7,6 +7,18 @@ module T::Private::Types
|
|
|
7
7
|
|
|
8
8
|
def initialize(callable)
|
|
9
9
|
@callable = callable
|
|
10
|
+
@checked_level = nil
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def checked(level)
|
|
14
|
+
if !@checked_level.nil?
|
|
15
|
+
raise "You can't call .checked multiple times on a type alias."
|
|
16
|
+
end
|
|
17
|
+
if !T::Private::RuntimeLevels::LEVELS.include?(level)
|
|
18
|
+
raise ArgumentError.new("Invalid `checked` level '#{level}'. Use one of: #{T::Private::RuntimeLevels::LEVELS}.")
|
|
19
|
+
end
|
|
20
|
+
@checked_level = level
|
|
21
|
+
self
|
|
10
22
|
end
|
|
11
23
|
|
|
12
24
|
def build_type
|
|
@@ -17,6 +29,18 @@ module T::Private::Types
|
|
|
17
29
|
@aliased_type ||= T::Utils.coerce(@callable.call)
|
|
18
30
|
end
|
|
19
31
|
|
|
32
|
+
def effective_aliased_type
|
|
33
|
+
@effective_aliased_type ||= begin
|
|
34
|
+
real_type = aliased_type
|
|
35
|
+
level = @checked_level.nil? ? T::Private::RuntimeLevels.default_checked_level : @checked_level
|
|
36
|
+
if level == :always || (level == :tests && T::Private::RuntimeLevels.check_tests?)
|
|
37
|
+
real_type
|
|
38
|
+
else
|
|
39
|
+
T::Types::Anything::Private::INSTANCE
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
20
44
|
# overrides Base
|
|
21
45
|
def name
|
|
22
46
|
aliased_type.name
|
|
@@ -24,12 +48,12 @@ module T::Private::Types
|
|
|
24
48
|
|
|
25
49
|
# overrides Base
|
|
26
50
|
def recursively_valid?(obj)
|
|
27
|
-
|
|
51
|
+
effective_aliased_type.recursively_valid?(obj)
|
|
28
52
|
end
|
|
29
53
|
|
|
30
54
|
# overrides Base
|
|
31
55
|
def valid?(obj)
|
|
32
|
-
|
|
56
|
+
effective_aliased_type.valid?(obj)
|
|
33
57
|
end
|
|
34
58
|
end
|
|
35
59
|
end
|
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.13310
|
|
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-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: benchmark
|