sorbet-runtime 0.5.11475 → 0.5.11478

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: b061cece16d9f63767570009f074ff6d935d772fb49f6fc03904b07d7271697c
4
- data.tar.gz: be4c603c282f75e18f4ebf0e7b66f6145b8b1b253759279b734be8aeab033e2c
3
+ metadata.gz: 5f09868302fe61cd70e73861cf24017cc28295c5dc50308f06396ad6aabd01e7
4
+ data.tar.gz: 1c15134b01e4599141c428727412d46352f87b5c7141b88dda68fa974e062841
5
5
  SHA512:
6
- metadata.gz: ab7782f28716acec254699ebd09ed4815ac4da677f2da4f9a5963ff592869f1115f5ebddc02f90fbe0fc14532ae133ceec9921be0bbbf11f320e33d07bd6d9dc
7
- data.tar.gz: 0b73a433fb071493b74a97a3af74b07250f9e318d8339753beeae54ad723ba5c2eccca5590d9ba9e5b24e3c91adc626d962b00557c1514b3fe3f042b9de456c2
6
+ metadata.gz: f5047c6c1f91f8fab3247863fe358e07aa17cb613fef8b1544770df30731ce41600bcbf1420f1e47d2227eec3f90a8177fabf2c22358f77eab3c51f9572cbe49
7
+ data.tar.gz: cb7bb419dcc3dd314c2bdf9539b4699966c3c3eb8e82de0c89bf0394bba7ced13bd6fe63fd165e8c40e85b46b2cce6a57c2e713de3f4e36cf92cb89946c94f42
data/lib/types/enum.rb CHANGED
@@ -273,8 +273,11 @@ class T::Enum
273
273
 
274
274
  ### Private implementation ###
275
275
 
276
+ UNSET = T.let(Module.new.freeze, Module)
277
+ private_constant :UNSET
278
+
276
279
  sig {params(serialized_val: SerializedVal).void}
277
- def initialize(serialized_val=nil)
280
+ def initialize(serialized_val=UNSET)
278
281
  raise 'T::Enum is abstract' if self.class == T::Enum
279
282
  if !self.class.started_initializing?
280
283
  raise "Must instantiate all enum values of #{self.class} inside 'enums do'."
@@ -300,7 +303,7 @@ class T::Enum
300
303
  sig {params(const_name: Symbol).void}
301
304
  def _bind_name(const_name)
302
305
  @const_name = const_name
303
- @serialized_val = const_to_serialized_val(const_name) if @serialized_val.nil?
306
+ @serialized_val = const_to_serialized_val(const_name) if @serialized_val.equal?(UNSET)
304
307
  freeze
305
308
  end
306
309
 
@@ -261,15 +261,30 @@ module T::Props::Serializable::DecoratorMethods
261
261
  end
262
262
 
263
263
  def message_with_generated_source_context(error, generated_method, generate_source_method)
264
- line_label = error.backtrace.find {|l| l.end_with?("in `#{generated_method}'")}
265
- return unless line_label
264
+ generated_method = generated_method.to_s
265
+ if error.backtrace_locations
266
+ line_loc = error.backtrace_locations.find {|l| l.base_label == generated_method}
267
+ return unless line_loc
266
268
 
267
- line_num = if line_label.start_with?("(eval)")
268
- # (eval):13:in `__t_props_generated_serialize'
269
- line_label.split(':')[1]&.to_i
269
+ line_num = line_loc.lineno
270
270
  else
271
- # (eval at /Users/jez/stripe/sorbet/gems/sorbet-runtime/lib/types/props/has_lazily_specialized_methods.rb:65):13:in `__t_props_generated_serialize'
272
- line_label.split(':')[2]&.to_i
271
+ label = if RUBY_VERSION >= "3.4"
272
+ # in 'ClassName#__t_props_generated_serialize'"
273
+ "##{generated_method}'"
274
+ else
275
+ # in `__t_props_generated_serialize'"
276
+ "in `#{generated_method}'"
277
+ end
278
+ line_label = error.backtrace.find {|l| l.end_with?(label)}
279
+ return unless line_label
280
+
281
+ line_num = if line_label.start_with?("(eval)")
282
+ # (eval):13:in ...
283
+ line_label.split(':')[1]&.to_i
284
+ else
285
+ # (eval at /Users/jez/stripe/sorbet/gems/sorbet-runtime/lib/types/props/has_lazily_specialized_methods.rb:65):13:in ...
286
+ line_label.split(':')[2]&.to_i
287
+ end
273
288
  end
274
289
  return unless line_num
275
290
 
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.11475
4
+ version: 0.5.11478
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-09 00:00:00.000000000 Z
11
+ date: 2024-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest