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.
- checksums.yaml +4 -4
- data/lib/types/enum.rb +13 -5
- 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: 7efcefd36fad1216671b366cbda430fd05f98acb93974e2d6103de90aabe0378
|
4
|
+
data.tar.gz: c0c87ee710c2f7ddaca5b38b20eb7cb1aa0d0cf30e1190b5503de69c861e3d43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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: {
|
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
|
-
|
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
|
-
|
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
|
-
|
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.
|
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-
|
11
|
+
date: 2024-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|