sorbet-runtime 0.5.11336 → 0.5.11340

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/types/enum.rb +13 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e313b52258345d8fad38718da512bb4d22d8618224fde05b8e723ba8d6d252ec
4
- data.tar.gz: 2f3c09d62c395757651697dcd487990afec060ef6bec32982be6f408de6c92d5
3
+ metadata.gz: 7efcefd36fad1216671b366cbda430fd05f98acb93974e2d6103de90aabe0378
4
+ data.tar.gz: c0c87ee710c2f7ddaca5b38b20eb7cb1aa0d0cf30e1190b5503de69c861e3d43
5
5
  SHA512:
6
- metadata.gz: a7cac782536c5d971ffea922ee1c8bce63376d55b75374e205c42388ad65e3f8cdc02c433f7f9f1e96fa72669c0794e05574fde229e69e153a34be4997ee8a51
7
- data.tar.gz: 3d33b539dd6f9202b71083f8faf870fc1b1ef72d7ee19701d6371eaec3c6a910631bf95aa1832eea2cd97a587d41a6e894ae651832e7d808c99d0e5f7cc14dee
6
+ metadata.gz: db71360161cbb509cfd1552b8edd3be69754f4fd0019707a7d40e9926666155c0d9f44189c4ffbaa94ce19966d3d78b4690445695129b014a86b2d035d2a6739
7
+ data.tar.gz: b5e185e00d19bfe4d51137ae162f0171849a81811ec8f2833b1de0345ffb6aaaac798b8c1c50cc0432052a78d518b7525d5368569f22b77964dfbd25747f20c3
data/lib/types/enum.rb CHANGED
@@ -192,13 +192,16 @@ class T::Enum
192
192
  # responds to the `to_str` method. It does not actually call `to_str` however.
193
193
  #
194
194
  # See https://ruby-doc.org/core-2.4.0/String.html#method-i-3D-3D
195
- sig {returns(String)}
195
+ T::Sig::WithoutRuntime.sig {returns(String)}
196
196
  def to_str
197
197
  msg = 'Implicit conversion of Enum instances to strings is not allowed. Call #serialize instead.'
198
198
  if T::Configuration.legacy_t_enum_migration_mode?
199
199
  T::Configuration.soft_assert_handler(
200
200
  msg,
201
- storytime: {class: self.class.name},
201
+ storytime: {
202
+ class: self.class.name,
203
+ caller_location: caller_locations(1..1)&.[](0)&.then {"#{_1.path}:#{_1.lineno}"},
204
+ },
202
205
  )
203
206
  serialize.to_s
204
207
  else
@@ -206,7 +209,8 @@ class T::Enum
206
209
  end
207
210
  end
208
211
 
209
- sig {params(other: BasicObject).returns(T::Boolean).checked(:never)}
212
+ # WithoutRuntime so that comparison_assertion_failed can assume a constant stack depth
213
+ T::Sig::WithoutRuntime.sig {params(other: BasicObject).returns(T::Boolean)}
210
214
  def ==(other)
211
215
  case other
212
216
  when String
@@ -221,7 +225,8 @@ class T::Enum
221
225
  end
222
226
  end
223
227
 
224
- sig {params(other: BasicObject).returns(T::Boolean).checked(:never)}
228
+ # WithoutRuntime so that comparison_assertion_failed can assume a constant stack depth
229
+ T::Sig::WithoutRuntime.sig {params(other: BasicObject).returns(T::Boolean)}
225
230
  def ===(other)
226
231
  case other
227
232
  when String
@@ -236,7 +241,9 @@ class T::Enum
236
241
  end
237
242
  end
238
243
 
239
- sig {params(method: Symbol, other: T.untyped).void}
244
+ # WithoutRuntime so that caller_locations can assume a constant stack depth
245
+ # (Otherwise, the first call would be the method with the wrapping, which would have a different stack depth.)
246
+ T::Sig::WithoutRuntime.sig {params(method: Symbol, other: T.untyped).void}
240
247
  private def comparison_assertion_failed(method, other)
241
248
  T::Configuration.soft_assert_handler(
242
249
  'Enum to string comparison not allowed. Compare to the Enum instance directly instead. See go/enum-migration',
@@ -246,6 +253,7 @@ class T::Enum
246
253
  other: other,
247
254
  other_class: other.class.name,
248
255
  method: method,
256
+ caller_location: caller_locations(2..2)&.[](0)&.then {"#{_1.path}:#{_1.lineno}"},
249
257
  }
250
258
  )
251
259
  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.11336
4
+ version: 0.5.11340
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-09 00:00:00.000000000 Z
11
+ date: 2024-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest