sorbet-runtime 0.5.9001 → 0.5.9030
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 +4 -0
- data/lib/types/private/runtime_levels.rb +4 -1
- data/lib/types/types/simple.rb +10 -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: dcabd0252adda99a045ea1dc30d52b3c2e1b18d26273d8f52c915a7744cebc3f
|
4
|
+
data.tar.gz: c89462c55b2113cc37520e8cec5f6d4adda069ef179bf6a027f5ccae1c965598
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7bdd7617d7f56ef075dd813c96ecfd6e6961e41b563e49e4cbc39b267175f7d22d05a3857d8b33ddeee3cd05532cfda1c7145cba5764991ff736c371da07694
|
7
|
+
data.tar.gz: 385c661966297c644fd0fd89b1b8e016a497ee8aadfbeaeb0ca2cb1fdf14c3b8824846a0b0f9e4103e2c0e445c6963f4a97e9a49a262809323b0c38545259c62
|
@@ -456,6 +456,10 @@ module T::Private::Methods
|
|
456
456
|
end
|
457
457
|
end
|
458
458
|
|
459
|
+
def self.all_checked_tests_sigs
|
460
|
+
@signatures_by_method.values.select {|sig| sig.check_level == :tests}
|
461
|
+
end
|
462
|
+
|
459
463
|
# the module target is adding the methods from the module source to itself. we need to check that for all instance
|
460
464
|
# methods M on source, M is not defined on any of target's ancestors.
|
461
465
|
def self._hook_impl(target, singleton_class, source)
|
@@ -31,8 +31,11 @@ module T::Private::RuntimeLevels
|
|
31
31
|
|
32
32
|
def self.enable_checking_in_tests
|
33
33
|
if !@check_tests && @wrapped_tests_with_validation
|
34
|
+
all_checked_tests_sigs = T::Private::Methods.all_checked_tests_sigs
|
35
|
+
locations = all_checked_tests_sigs.map {|sig| sig.method.source_location.join(':')}.join("\n- ")
|
34
36
|
raise "Toggle `:tests`-level runtime type checking earlier. " \
|
35
|
-
"There are already some methods wrapped with `sig.checked(:tests)
|
37
|
+
"There are already some methods wrapped with `sig.checked(:tests)`:\n" \
|
38
|
+
"- #{locations}"
|
36
39
|
end
|
37
40
|
|
38
41
|
_toggle_checking_tests(true)
|
data/lib/types/types/simple.rb
CHANGED
@@ -40,8 +40,10 @@ module T::Types
|
|
40
40
|
|
41
41
|
module Private
|
42
42
|
module Pool
|
43
|
+
@cache = ObjectSpace::WeakMap.new
|
44
|
+
|
43
45
|
def self.type_for_module(mod)
|
44
|
-
cached = mod
|
46
|
+
cached = @cache[mod]
|
45
47
|
return cached if cached
|
46
48
|
|
47
49
|
type = if mod == ::Array
|
@@ -60,7 +62,13 @@ module T::Types
|
|
60
62
|
Simple.new(mod)
|
61
63
|
end
|
62
64
|
|
63
|
-
|
65
|
+
# Unfortunately, we still need to check if the module is frozen,
|
66
|
+
# since WeakMap adds a finalizer to the key that is added
|
67
|
+
# to the map, so that it can clear the map entry when the key is
|
68
|
+
# garbage collected.
|
69
|
+
# For a frozen object, though, adding a finalizer is not a valid
|
70
|
+
# operation, so this still raises if `mod` is frozen.
|
71
|
+
@cache[mod] = type unless mod.frozen?
|
64
72
|
type
|
65
73
|
end
|
66
74
|
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.5.
|
4
|
+
version: 0.5.9030
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|