sorbet-runtime 0.5.9242 → 0.5.9248
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sorbet-runtime.rb +0 -2
- data/lib/types/configuration.rb +12 -12
- data/lib/types/private/methods/_methods.rb +7 -6
- data/lib/types/private/sealed.rb +11 -3
- data/lib/types/props/decorator.rb +1 -1
- data/lib/types/types/enum.rb +0 -2
- data/lib/types/types/simple.rb +2 -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: d8929d65a65510ee18a4511677a681442fdd75b36836495df3d06b8028809b54
|
4
|
+
data.tar.gz: c81dc953cd465737255d80b8a9d9d0a1f40bd454ded6d718a96dcf5e75092c32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 714ed517a90246c445f08569dfc7300b882839ae25c7ef81fd4a321263827049a12f817fc584c92ccdd97b9f7bc07930de93b7c3838fbfb248fe55490e25aaeb
|
7
|
+
data.tar.gz: f479276f55ee3c26e423ecde331e608291e1aafd2b2b2f1ff1cfb3c2a3515a25d8f07a24d7214e3b32b5ac5da91fb9cd343289d4ebd1e59eae105f456148a5b2
|
data/lib/sorbet-runtime.rb
CHANGED
data/lib/types/configuration.rb
CHANGED
@@ -415,21 +415,21 @@ module T::Configuration
|
|
415
415
|
raise ArgumentError.new("Provided values must all be class name strings.")
|
416
416
|
end
|
417
417
|
|
418
|
-
@scalar_types =
|
418
|
+
@scalar_types = values.each_with_object({}) {|x, acc| acc[x] = true}.freeze
|
419
419
|
end
|
420
420
|
end
|
421
421
|
|
422
|
-
@default_scalar_types =
|
423
|
-
NilClass
|
424
|
-
TrueClass
|
425
|
-
FalseClass
|
426
|
-
Integer
|
427
|
-
Float
|
428
|
-
String
|
429
|
-
Symbol
|
430
|
-
Time
|
431
|
-
T::Enum
|
432
|
-
|
422
|
+
@default_scalar_types = {
|
423
|
+
"NilClass" => true,
|
424
|
+
"TrueClass" => true,
|
425
|
+
"FalseClass" => true,
|
426
|
+
"Integer" => true,
|
427
|
+
"Float" => true,
|
428
|
+
"String" => true,
|
429
|
+
"Symbol" => true,
|
430
|
+
"Time" => true,
|
431
|
+
"T::Enum" => true,
|
432
|
+
}.freeze
|
433
433
|
|
434
434
|
def self.scalar_types
|
435
435
|
@scalar_types || @default_scalar_types
|
@@ -2,13 +2,13 @@
|
|
2
2
|
# typed: false
|
3
3
|
|
4
4
|
module T::Private::Methods
|
5
|
-
@installed_hooks =
|
5
|
+
@installed_hooks = {}
|
6
6
|
@signatures_by_method = {}
|
7
7
|
@sig_wrappers = {}
|
8
8
|
@sigs_that_raised = {}
|
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
|
-
@was_ever_final_names =
|
11
|
+
@was_ever_final_names = {}
|
12
12
|
# maps from modules 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
|
@@ -190,10 +190,11 @@ module T::Private::Methods
|
|
190
190
|
m = is_singleton_method ? mod.singleton_class : mod
|
191
191
|
methods = @modules_with_final[m]
|
192
192
|
if methods.nil?
|
193
|
-
methods =
|
193
|
+
methods = {}
|
194
194
|
@modules_with_final[m] = methods
|
195
195
|
end
|
196
|
-
methods
|
196
|
+
methods[method_name] = true
|
197
|
+
nil
|
197
198
|
end
|
198
199
|
|
199
200
|
def self.note_module_deals_with_final(mod)
|
@@ -276,7 +277,7 @@ module T::Private::Methods
|
|
276
277
|
|
277
278
|
@sig_wrappers[key] = sig_block
|
278
279
|
if current_declaration.final
|
279
|
-
@was_ever_final_names
|
280
|
+
@was_ever_final_names[method_name] = true
|
280
281
|
# use hook_mod, not mod, because for example, we want class C to be marked as having final if we def C.foo as
|
281
282
|
# final. change this to mod to see some final_method tests fail.
|
282
283
|
note_module_deals_with_final(hook_mod)
|
@@ -527,7 +528,7 @@ module T::Private::Methods
|
|
527
528
|
|
528
529
|
def self.install_hooks(mod)
|
529
530
|
return if @installed_hooks.include?(mod)
|
530
|
-
@installed_hooks
|
531
|
+
@installed_hooks[mod] = true
|
531
532
|
|
532
533
|
if mod == TOP_SELF
|
533
534
|
# self at the top-level of a file is weirdly special in Ruby
|
data/lib/types/private/sealed.rb
CHANGED
@@ -11,7 +11,11 @@ module T::Private::Sealed
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def sealed_subclasses
|
14
|
-
@
|
14
|
+
@sorbet_sealed_module_all_subclasses_set ||= # rubocop:disable Naming/MemoizedInstanceVariableName
|
15
|
+
begin
|
16
|
+
require 'set'
|
17
|
+
Set.new(@sorbet_sealed_module_all_subclasses).freeze
|
18
|
+
end
|
15
19
|
end
|
16
20
|
end
|
17
21
|
|
@@ -34,7 +38,11 @@ module T::Private::Sealed
|
|
34
38
|
# this will freeze the set so that you can never get into a
|
35
39
|
# state where you use the subclasses list and then something
|
36
40
|
# else will add to it
|
37
|
-
@
|
41
|
+
@sorbet_sealed_module_all_subclasses_set ||= # rubocop:disable Naming/MemoizedInstanceVariableName
|
42
|
+
begin
|
43
|
+
require 'set'
|
44
|
+
Set.new(@sorbet_sealed_module_all_subclasses).freeze
|
45
|
+
end
|
38
46
|
end
|
39
47
|
end
|
40
48
|
|
@@ -53,7 +61,7 @@ module T::Private::Sealed
|
|
53
61
|
raise "Couldn't determine declaration file for sealed class."
|
54
62
|
end
|
55
63
|
mod.instance_variable_set(:@sorbet_sealed_module_decl_file, decl_file)
|
56
|
-
mod.instance_variable_set(:@sorbet_sealed_module_all_subclasses,
|
64
|
+
mod.instance_variable_set(:@sorbet_sealed_module_all_subclasses, [])
|
57
65
|
end
|
58
66
|
|
59
67
|
def self.sealed_module?(mod)
|
@@ -198,7 +198,7 @@ class T::Props::Decorator
|
|
198
198
|
end
|
199
199
|
|
200
200
|
# TODO: we should really be checking all the methods on `cls`, not just Object
|
201
|
-
BANNED_METHOD_NAMES = T.let(Object.instance_methods.
|
201
|
+
BANNED_METHOD_NAMES = T.let(Object.instance_methods.each_with_object({}) {|x, acc| acc[x] = true}.freeze, T::Hash[Symbol, TrueClass])
|
202
202
|
|
203
203
|
# checked(:never) - Rules hash is expensive to check
|
204
204
|
sig do
|
data/lib/types/types/enum.rb
CHANGED
data/lib/types/types/simple.rb
CHANGED
@@ -48,8 +48,6 @@ module T::Types
|
|
48
48
|
|
49
49
|
type = if mod == ::Array
|
50
50
|
T::Array[T.untyped]
|
51
|
-
elsif mod == ::Set
|
52
|
-
T::Set[T.untyped]
|
53
51
|
elsif mod == ::Hash
|
54
52
|
T::Hash[T.untyped, T.untyped]
|
55
53
|
elsif mod == ::Enumerable
|
@@ -58,6 +56,8 @@ module T::Types
|
|
58
56
|
T::Enumerator[T.untyped]
|
59
57
|
elsif mod == ::Range
|
60
58
|
T::Range[T.untyped]
|
59
|
+
elsif !Object.autoload?(:Set) && Object.const_defined?(:Set) && mod == ::Set
|
60
|
+
T::Set[T.untyped]
|
61
61
|
else
|
62
62
|
Simple.new(mod)
|
63
63
|
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.9248
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|