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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f78eb2d24250f5eb1bc4a801420e2da6c6b74b19fda4e224f9fb8d9cdf42519
4
- data.tar.gz: b87974528c14420bea219e5f49354b479aa7316e4ed5612b35ecd43aa1c6410c
3
+ metadata.gz: d8929d65a65510ee18a4511677a681442fdd75b36836495df3d06b8028809b54
4
+ data.tar.gz: c81dc953cd465737255d80b8a9d9d0a1f40bd454ded6d718a96dcf5e75092c32
5
5
  SHA512:
6
- metadata.gz: 5c0b1f68146d4fe7c9eb3bea296f9c485b9646453cde5ede3cda15cfebd0e260b25623422aa4d613c705221f57b17429925632831643054e6a5112a81d71ad1e
7
- data.tar.gz: 19d9ea0ade0208562dd8e23180c1ff601844014f8613b1cc6e8396f0435157c4b2de1dd96d92b81658437247b50734488c1766c4e27eb8533aa40908f0527e35
6
+ metadata.gz: 714ed517a90246c445f08569dfc7300b882839ae25c7ef81fd4a321263827049a12f817fc584c92ccdd97b9f7bc07930de93b7c3838fbfb248fe55490e25aaeb
7
+ data.tar.gz: f479276f55ee3c26e423ecde331e608291e1aafd2b2b2f1ff1cfb3c2a3515a25d8f07a24d7214e3b32b5ac5da91fb9cd343289d4ebd1e59eae105f456148a5b2
@@ -12,8 +12,6 @@ module T::Private; end
12
12
  module T::Private::Abstract; end
13
13
  module T::Private::Types; end
14
14
 
15
- require 'set'
16
-
17
15
  # Each section is a group that I believe need a fixed ordering. There is also
18
16
  # an ordering between groups.
19
17
 
@@ -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 = Set.new(values).freeze
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 = Set.new(%w[
423
- NilClass
424
- TrueClass
425
- FalseClass
426
- Integer
427
- Float
428
- String
429
- Symbol
430
- Time
431
- T::Enum
432
- ]).freeze
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 = Set.new
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 = Set.new
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 = Set.new
193
+ methods = {}
194
194
  @modules_with_final[m] = methods
195
195
  end
196
- methods.add(method_name)
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.add(method_name)
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 << mod
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
@@ -11,7 +11,11 @@ module T::Private::Sealed
11
11
  end
12
12
 
13
13
  def sealed_subclasses
14
- @sorbet_sealed_module_all_subclasses
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
- @sorbet_sealed_module_all_subclasses.freeze
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, Set.new)
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.to_set.freeze, T::Set[Symbol])
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
@@ -8,8 +8,6 @@ module T::Types
8
8
 
9
9
  attr_reader :values
10
10
 
11
- # TODO Ideally Hash would not be accepted but there are a lot of uses with prop enum.
12
- sig {params(values: T.any(Array, Set, Hash, T::Range[T.untyped])).void}
13
11
  def initialize(values)
14
12
  @values = values
15
13
  end
@@ -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.9242
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-16 00:00:00.000000000 Z
11
+ date: 2021-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest