sorbet-runtime 0.5.9219 → 0.5.9238

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b124e57cb0d345be63baf4069fa85790584517ec61cf4dca18a2f629e4e9e52f
4
- data.tar.gz: 6c7f57071ceb46107aae1ae75a6d07387f6ede71f42cd954e4709b5f3ea5e859
3
+ metadata.gz: c758e58dbda669b320f13533c119989b5e6f0b1121bcae5edc1122c7968dc36d
4
+ data.tar.gz: dfe127d6b8e3b7cbbdde127577df4efdecac1c85d88df2187cf53d9d4f96802b
5
5
  SHA512:
6
- metadata.gz: a8fd1f048a3361c25808228a65a64c33d12931f38e18d771ca098c284c186d991c0918e74c90ba35ba17429fadd72b9f2e8a9c1f37abb8ef30c1331983fc728a
7
- data.tar.gz: 9415e104416725f1d64a945ffd8914e1d1c93321c8de84956083e1b665d5e8269f8a9550897d5f5dd169db27e4911336f4391ede8997af605e525c6cf06bcdf7
6
+ metadata.gz: c478dd3d32e977526caf29b9f1ad162818f2d5ddd485faafd8b5bb924496ee95fbb2aa88a7b8490e4c8482bd0355e0237fc267332c7ba0c9ba1988521b7ab24e
7
+ data.tar.gz: fa6fc0021051bdfadd879a061780d7c7d547125e28e5cf1adc5547ce25afa531c8966f6201d84b2f008b175a54b20a46b13d9fb6aba8a63e1c1f870bb5c9ca7a
data/lib/types/_types.rb CHANGED
@@ -53,10 +53,18 @@ module T
53
53
  end
54
54
 
55
55
  # Matches any of the listed values
56
+ # @deprecated Use T::Enum instead.
56
57
  def self.enum(values)
57
58
  T::Types::Enum.new(values)
58
59
  end
59
60
 
61
+ # Matches any of the listed values
62
+ # Equivalent to T.enum, but the name will be changed permanently to `T.deprecated_enum`.
63
+ # @deprecated Use T::Enum instead.
64
+ def self.deprecated_enum(values)
65
+ T::Types::Enum.new(values, method_name: "deprecated_enum")
66
+ end
67
+
60
68
  # Creates a proc type
61
69
  def self.proc
62
70
  T::Private::Methods.start_proc
@@ -2,11 +2,6 @@
2
2
  # typed: strict
3
3
 
4
4
  module T::NonForcingConstants
5
- T::Sig::WithoutRuntime.sig {returns(T::Boolean)}
6
- private_class_method def self.stripe_packages_enabled?
7
- const_defined?('StripePackages') && const_get('StripePackages').enabled?
8
- end
9
-
10
5
  # NOTE: This method is documented on the RBI in Sorbet's payload, so that it
11
6
  # shows up in the hover/completion documentation via LSP.
12
7
  T::Sig::WithoutRuntime.sig {params(val: BasicObject, klass: String, package: T.nilable(String)).returns(T::Boolean)}
@@ -16,10 +11,11 @@ module T::NonForcingConstants
16
11
  raise ArgumentError.new("The string given to `#{method_name}` must not be empty")
17
12
  end
18
13
 
19
- # TODO(gdritter): this might not be want we want in a multipackage
20
- # world; revisit this implementation we move on from the monopackage
21
- if stripe_packages_enabled?
22
- klass = "PkgRegistry::#{package}::#{klass}"
14
+ # We don't treat packages differently at runtime, but the static
15
+ # type-checker still needs to have the package and constant
16
+ # separated out. This just re-assembles the string as needed
17
+ if !package.nil?
18
+ klass = "::#{package}::#{klass}"
23
19
  end
24
20
 
25
21
  current_klass = T.let(nil, T.nilable(Module))
@@ -7,11 +7,13 @@ module T::Types
7
7
  extend T::Sig
8
8
 
9
9
  attr_reader :values
10
+ attr_reader :method_name
10
11
 
11
12
  # 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
- def initialize(values)
13
+ sig {params(values: T.any(Array, Set, Hash, T::Range[T.untyped]), method_name: String).void}
14
+ def initialize(values, method_name: "enum")
14
15
  @values = values
16
+ @method_name = method_name
15
17
  end
16
18
 
17
19
  # overrides Base
@@ -31,7 +33,7 @@ module T::Types
31
33
 
32
34
  # overrides Base
33
35
  def name
34
- "T.enum([#{@values.map(&:inspect).join(', ')}])"
36
+ "T.#{@method_name}([#{@values.map(&:inspect).join(', ')}])"
35
37
  end
36
38
 
37
39
  # overrides Base
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.9219
4
+ version: 0.5.9238
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-10 00:00:00.000000000 Z
11
+ date: 2021-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest