sorbet-runtime 0.6.13224 → 0.6.13226

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: ebcfe299fdcacb76c43f265149c1ca489e7c0ae37c1b7df330a11040e6b4687c
4
- data.tar.gz: 764b610e2e34c154fe5f87b020352bd6e6837769f4f68a1076b0f3ffc875600f
3
+ metadata.gz: e907a4879f20cbb646044c37f44b50280d00aec1667f104c47042d78825bc577
4
+ data.tar.gz: 4749bfa922d12839e963d08b99c8fef4637c238728527a9a287f6fdad2688841
5
5
  SHA512:
6
- metadata.gz: 92b49a148142fd0947fdc2162ed0e426bbc14cbe7409cad9fd72ac27d6ff150c43b5dfcce68e66f0c55831794424df4a6ed3819b202a9789c5701f42a3d74eb8
7
- data.tar.gz: 38e6f15d72de0cbff9a6e482989cb1b0bd396307745684d78947e6901d6de0c67ccdc9cf5971c1bb2c67e8c82199f22cc1ff6f06b9ce0bc949453e4662427b44
6
+ metadata.gz: 4870335d1730b9240f4b81b1d8ae948850d5833ed7d341cbbcccd8817a1ba1dd3b3afeb472c440514c7fc0a3019a29ea7b2b07675f12cd7a8f650fa983d61102
7
+ data.tar.gz: bcae385c2a650224bafe810e1295cda429c73d2612ffe5a4c3c3aa75345c6e38c7bcc207989ebf2e667040cf015b31cc28309689640758686cc4d8d52ec79e88
@@ -48,15 +48,9 @@ module T::Private::Methods
48
48
  # (This can matter for circular load-time behavior, where a method is
49
49
  # called while its Signature is being built)
50
50
  # - It's `nil` if we've finished building the sig
51
- DeclarationBlock = Struct.new(:mod, :loc, :blk_or_decl, :final, :raw)
51
+ DeclarationBlock = Struct.new(:mod, :loc, :blk_or_decl, :final)
52
52
 
53
53
  def self.declare_sig(mod, loc, arg, &blk)
54
- T::Private::DeclState.current.active_declaration = _declare_sig_internal(mod, loc, arg, &blk)
55
-
56
- nil
57
- end
58
-
59
- private_class_method def self._declare_sig_internal(mod, loc, arg, raw: false, &blk)
60
54
  install_hooks(mod)
61
55
 
62
56
  if T::Private::DeclState.current.active_declaration
@@ -68,11 +62,13 @@ module T::Private::Methods
68
62
  raise "Invalid argument to `sig`: #{arg}"
69
63
  end
70
64
 
71
- DeclarationBlock.new(mod, loc, blk, arg == :final, raw)
65
+ T::Private::DeclState.current.active_declaration = DeclarationBlock.new(mod, loc, blk, arg == :final)
66
+
67
+ nil
72
68
  end
73
69
 
74
70
  def self.start_proc
75
- DeclBuilder.new(PROC_TYPE, false)
71
+ DeclBuilder.new(PROC_TYPE)
76
72
  end
77
73
 
78
74
  def self.finalize_proc(decl)
@@ -233,31 +229,29 @@ module T::Private::Methods
233
229
  # This wrapper is very slow, so it will subsequently re-wrap with a much faster wrapper
234
230
  # (or unwrap back to the original method).
235
231
  key = method_owner_and_name_to_key(mod, method_name)
236
- unless current_declaration.raw
237
- T::Private::ClassUtils.replace_method(original_method, mod, method_name) do |*args, &blk|
238
- method_sig = T::Private::Methods.maybe_run_sig_block_for_key(key)
239
- method_sig ||= T::Private::Methods._handle_missing_method_signature(
240
- self,
241
- original_method,
242
- __callee__ || raise("Unknown __callee__ for method without a signature"),
243
- )
244
-
245
- # Should be the same logic as CallValidation.wrap_method_if_needed but we
246
- # don't want that extra layer of indirection in the callstack
247
- if method_sig.mode == T::Private::Methods::Modes.abstract
248
- # We're in an interface method, keep going up the chain
249
- if defined?(super)
250
- super(*args, &blk)
251
- else
252
- raise NotImplementedError.new("The method `#{method_sig.method_name}` on #{mod} is declared as `abstract`. It does not have an implementation.")
253
- end
254
- # Note, this logic is duplicated (intentionally, for micro-perf) at `CallValidation.wrap_method_if_needed`,
255
- # make sure to keep changes in sync.
256
- elsif method_sig.check_level == :always || (method_sig.check_level == :tests && T::Private::RuntimeLevels.check_tests?)
257
- CallValidation.validate_call(self, original_method, method_sig, args, blk)
232
+ T::Private::ClassUtils.replace_method(original_method, mod, method_name) do |*args, &blk|
233
+ method_sig = T::Private::Methods.maybe_run_sig_block_for_key(key)
234
+ method_sig ||= T::Private::Methods._handle_missing_method_signature(
235
+ self,
236
+ original_method,
237
+ __callee__ || raise("Unknown __callee__ for method without a signature"),
238
+ )
239
+
240
+ # Should be the same logic as CallValidation.wrap_method_if_needed but we
241
+ # don't want that extra layer of indirection in the callstack
242
+ if method_sig.mode == T::Private::Methods::Modes.abstract
243
+ # We're in an interface method, keep going up the chain
244
+ if defined?(super)
245
+ super(*args, &blk)
258
246
  else
259
- original_method.bind_call(self, *args, &blk)
247
+ raise NotImplementedError.new("The method `#{method_sig.method_name}` on #{mod} is declared as `abstract`. It does not have an implementation.")
260
248
  end
249
+ # Note, this logic is duplicated (intentionally, for micro-perf) at `CallValidation.wrap_method_if_needed`,
250
+ # make sure to keep changes in sync.
251
+ elsif method_sig.check_level == :always || (method_sig.check_level == :tests && T::Private::RuntimeLevels.check_tests?)
252
+ CallValidation.validate_call(self, original_method, method_sig, args, blk)
253
+ else
254
+ original_method.bind_call(self, *args, &blk)
261
255
  end
262
256
  end
263
257
 
@@ -343,7 +337,7 @@ module T::Private::Methods
343
337
  raise "DeclarationBlock for #{declaration_block.mod} at #{declaration_block.loc} should have already been unwrapped"
344
338
  end
345
339
 
346
- builder = DeclBuilder.new(declaration_block.mod, declaration_block.raw)
340
+ builder = DeclBuilder.new(declaration_block.mod)
347
341
  decl = builder.instance_exec(&blk_or_decl).finalize!.decl
348
342
  # Record that we've already run `blk` once and constructed a `Declaration`
349
343
  declaration_block.blk_or_decl = decl
@@ -15,7 +15,7 @@ module T::Private::Methods
15
15
  end
16
16
  end
17
17
 
18
- def initialize(mod, raw)
18
+ def initialize(mod)
19
19
  @decl = Declaration.new(
20
20
  mod,
21
21
  ARG_NOT_PROVIDED, # params
@@ -27,7 +27,6 @@ module T::Private::Methods
27
27
  ARG_NOT_PROVIDED, # on_failure
28
28
  false, # override_allow_incompatible
29
29
  ARG_NOT_PROVIDED, # type_parameters
30
- raw
31
30
  )
32
31
  end
33
32
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorbet-runtime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.13224
4
+ version: 0.6.13226
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe