sorbet-runtime 0.5.5956 → 0.5.5994
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/types/non_forcing_constants.rb +20 -16
- data/lib/types/private/methods/signature.rb +4 -0
- data/lib/types/private/sealed.rb +15 -0
- 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: 248d125de87bc9a191dec3584eed814ab99f38f051d03d05039258a07fdb9744
|
4
|
+
data.tar.gz: d5d96a2490154fc4dbb80ef622019f9a38097b42880c08202263a81b06421353
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a635f4ddd6392a94a6300952647e10d39b307a0b6ffb5fd7135fd917550cbdbfc733d81a65011a79b38b2e9c04035f2ac15621ca766f73e33d2917f29139027
|
7
|
+
data.tar.gz: 52b99913aba59150c7037788a7065502f3c95d58c7f2e602a86ffc0ff76694c950532b0fdf9eddbc2abfd9412f7ad5d2575e6319084856d2c18cdca6465e3f4b
|
@@ -30,25 +30,29 @@ module T::NonForcingConstants
|
|
30
30
|
|
31
31
|
current_klass = Object
|
32
32
|
current_prefix = ''
|
33
|
-
else
|
34
|
-
if current_klass.autoload?(part)
|
35
|
-
# There's an autoload registered for that constant, which means it's not
|
36
|
-
# yet loaded. `value` can't be an instance of something not yet loaded.
|
37
|
-
return false
|
38
|
-
end
|
39
33
|
|
40
|
-
#
|
41
|
-
|
42
|
-
if
|
43
|
-
|
44
|
-
|
34
|
+
# if this had a :: prefix, then there's no more loading to
|
35
|
+
# do---skip to the next one
|
36
|
+
next if part == ""
|
37
|
+
end
|
38
|
+
|
39
|
+
if current_klass.autoload?(part)
|
40
|
+
# There's an autoload registered for that constant, which means it's not
|
41
|
+
# yet loaded. `value` can't be an instance of something not yet loaded.
|
42
|
+
return false
|
43
|
+
end
|
44
|
+
|
45
|
+
# Sorbet guarantees that the string is an absolutely resolved name.
|
46
|
+
search_inheritance_chain = false
|
47
|
+
if !current_klass.const_defined?(part, search_inheritance_chain)
|
48
|
+
return false
|
49
|
+
end
|
45
50
|
|
46
|
-
|
47
|
-
|
51
|
+
current_klass = current_klass.const_get(part)
|
52
|
+
current_prefix = "#{current_prefix}::#{part}"
|
48
53
|
|
49
|
-
|
50
|
-
|
51
|
-
end
|
54
|
+
if !Module.===(current_klass)
|
55
|
+
raise ArgumentError.new("#{current_prefix} is not a class or module")
|
52
56
|
end
|
53
57
|
end
|
54
58
|
|
@@ -67,6 +67,10 @@ class T::Private::Methods::Signature
|
|
67
67
|
if !extra_names.empty?
|
68
68
|
raise "The declaration for `#{method.name}` has extra parameter(s): #{extra_names.join(', ')}"
|
69
69
|
end
|
70
|
+
|
71
|
+
if parameters.size != raw_arg_types.size
|
72
|
+
raise "The declaration for `#{method.name}` has arguments with duplicate names"
|
73
|
+
end
|
70
74
|
|
71
75
|
parameters.zip(raw_arg_types) do |(param_kind, param_name), (type_name, raw_type)|
|
72
76
|
if type_name != param_name
|
data/lib/types/private/sealed.rb
CHANGED
@@ -7,6 +7,11 @@ module T::Private::Sealed
|
|
7
7
|
super
|
8
8
|
this_line = Kernel.caller.find {|line| !line.match(/in `inherited'$/)}
|
9
9
|
T::Private::Sealed.validate_inheritance(this_line, self, 'inherited')
|
10
|
+
@sorbet_sealed_module_all_subclasses << other
|
11
|
+
end
|
12
|
+
|
13
|
+
def sealed_subclasses
|
14
|
+
@sorbet_sealed_module_all_subclasses
|
10
15
|
end
|
11
16
|
end
|
12
17
|
|
@@ -15,12 +20,21 @@ module T::Private::Sealed
|
|
15
20
|
super
|
16
21
|
this_line = Kernel.caller.find {|line| !line.match(/in `included'$/)}
|
17
22
|
T::Private::Sealed.validate_inheritance(this_line, self, 'included')
|
23
|
+
@sorbet_sealed_module_all_subclasses << other
|
18
24
|
end
|
19
25
|
|
20
26
|
def extended(other)
|
21
27
|
super
|
22
28
|
this_line = Kernel.caller.find {|line| !line.match(/in `extended'$/)}
|
23
29
|
T::Private::Sealed.validate_inheritance(this_line, self, 'extended')
|
30
|
+
@sorbet_sealed_module_all_subclasses << other
|
31
|
+
end
|
32
|
+
|
33
|
+
def sealed_subclasses
|
34
|
+
# this will freeze the set so that you can never get into a
|
35
|
+
# state where you use the subclasses list and then something
|
36
|
+
# else will add to it
|
37
|
+
@sorbet_sealed_module_all_subclasses.freeze
|
24
38
|
end
|
25
39
|
end
|
26
40
|
|
@@ -39,6 +53,7 @@ module T::Private::Sealed
|
|
39
53
|
raise "Couldn't determine declaration file for sealed class."
|
40
54
|
end
|
41
55
|
mod.instance_variable_set(:@sorbet_sealed_module_decl_file, decl_file)
|
56
|
+
mod.instance_variable_set(:@sorbet_sealed_module_all_subclasses, Set.new)
|
42
57
|
end
|
43
58
|
|
44
59
|
def self.sealed_module?(mod)
|
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.5994
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|