sorbet-runtime 0.6.13281 → 0.6.13283

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: aaa4eaf7440ab0887a2d95dec4d0be0d149410e22cae9f348b5a8270bb19796a
4
- data.tar.gz: 8258b1befb96c28b5df177d984b51a75bbc97f005acf81f86b79add2938ad273
3
+ metadata.gz: 8d1fdd48689c79093572fa8d2ddc326182044d6eda688339914ead4c2df3408e
4
+ data.tar.gz: b5a5e63990218d9edf088d4e8fb1aeb21c6db4d46b2be89ee496f9fd3fd77abc
5
5
  SHA512:
6
- metadata.gz: 5bfa0d8826de0338cc2bffc9b11f813fabbb90bde6d1da666b8b870b58ddbc113e3c6ff8e0086ea2f0f91fbacbf2f739edadd0ad1e36bc01418d5161403f68be
7
- data.tar.gz: 06cf53f3de854380be2cd661cc9503e73365918f959af3d85827443d5d7594981a27c65acbea58ee518f59f480aa60e9e2acd8dda8ee53e5e327e594b3425a84
6
+ metadata.gz: b7785710f28477878ed6d0363c75f20249cb38da19da858132815a54a359d8bd2e153a8262c6ca55f54f1ff9e4519d9ba09b4eedfd43cf06dfa6261baf69c5a4
7
+ data.tar.gz: 300a13e92ed07c63bd21156e8bd1e960a8d58053c16a5f711b438dbf316c50386312912813718028265b7f0315f915fca57ab5667525d7c3641ec23b4911965c
@@ -217,9 +217,23 @@ module T::Private::Methods
217
217
  )
218
218
  end
219
219
 
220
+ # We allow `sig` in the current module's context (normal case) and
221
+ if hook_mod != current_declaration.mod &&
222
+ # inside `class << self`, and
223
+ hook_mod.singleton_class != current_declaration.mod &&
224
+ # on `self` at the top level of a file
225
+ current_declaration.mod != TOP_SELF
226
+ raise "A method (#{method_name}) is being added on a different class/module (#{hook_mod}) than the " \
227
+ "last call to `sig` (#{current_declaration.mod}). Make sure each call " \
228
+ "to `sig` is immediately followed by a method definition on the same " \
229
+ "class/module."
230
+ end
231
+ # Overwrite the DeclarationBlock mod with `mod`, which is the Module that owns the method.
232
+ current_declaration.mod = mod
233
+
220
234
  original_method = mod.instance_method(method_name)
221
235
  sig_block = lambda do
222
- T::Private::Methods.run_sig(hook_mod, method_name, original_method, current_declaration)
236
+ T::Private::Methods.run_sig(method_name, original_method, current_declaration)
223
237
  end
224
238
 
225
239
  # Always replace the original method with this wrapper,
@@ -298,7 +312,7 @@ module T::Private::Methods
298
312
 
299
313
  # Executes the `sig` block, and converts the resulting Declaration
300
314
  # to a Signature.
301
- def self.run_sig(hook_mod, method_name, original_method, declaration_block)
315
+ def self.run_sig(method_name, original_method, declaration_block)
302
316
  current_declaration =
303
317
  begin
304
318
  run_builder(declaration_block)
@@ -312,7 +326,7 @@ module T::Private::Methods
312
326
 
313
327
  signature =
314
328
  if current_declaration
315
- build_sig(hook_mod, method_name, original_method, current_declaration)
329
+ build_sig(method_name, original_method, current_declaration)
316
330
  else
317
331
  Signature.new_untyped(method: original_method)
318
332
  end
@@ -342,20 +356,8 @@ module T::Private::Methods
342
356
  decl
343
357
  end
344
358
 
345
- def self.build_sig(hook_mod, method_name, original_method, current_declaration)
359
+ def self.build_sig(method_name, original_method, current_declaration)
346
360
  begin
347
- # We allow `sig` in the current module's context (normal case) and
348
- if hook_mod != current_declaration.mod &&
349
- # inside `class << self`, and
350
- hook_mod.singleton_class != current_declaration.mod &&
351
- # on `self` at the top level of a file
352
- current_declaration.mod != TOP_SELF
353
- raise "A method (#{method_name}) is being added on a different class/module (#{hook_mod}) than the " \
354
- "last call to `sig` (#{current_declaration.mod}). Make sure each call " \
355
- "to `sig` is immediately followed by a method definition on the same " \
356
- "class/module."
357
- end
358
-
359
361
  signature = Signature.new(
360
362
  method: original_method,
361
363
  method_name: method_name,
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.13281
4
+ version: 0.6.13283
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe