sorbet-runtime 0.6.13504 → 0.6.13505

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: bb41c9b1a98ad53fc722f0c32f7c3060897225af5a8efd492d25de02499091c8
4
- data.tar.gz: 4e4b61fb7eaa377e199ea9e7a5ddad379d3ab726524e0cb80435340025be07ee
3
+ metadata.gz: 7354f0c24eff4374dc9d58e355072cd46ae7e169c96e507512a63a930341ca73
4
+ data.tar.gz: 53ca5629b45b53e98813c110b88d1d6cdfe3b9d473255b578dcc21587238c0ca
5
5
  SHA512:
6
- metadata.gz: 8e109717a217c0a0e71089947e1bdfdb61c10809a6b147523b7d49d07a416507f4c28c3ff1798e247bd7da45cfc5ee38b7540b031a01d735b5e12261a4c2bc20
7
- data.tar.gz: 3ece0183ad2f123ad624786910d2dd7ecefe147342dc8b4337149651e1628f08bd7e4eb11a34e020d7c8ad6918b0bc4afa21b5f9c55f6cb5f63569ff4af0dd90
6
+ metadata.gz: d5fb3ea73db940452b211bd2f6e76b249ab30958e7f7c9475b274f5d29c79bee67227c2d6d29377e0e2d6d61d8a2bf28a3bfb2c465ccdaf802205038d8ad3e0d
7
+ data.tar.gz: 39767ebbde0d36695dfaf1eeb57a8bfecca41243a5b3292f1c2c6472aedd836db5c020890f5350dd0cbab68ff62160889526dff5d9a2dc90001e00cf404e2f3a
@@ -7,7 +7,8 @@ module T::Private::Methods::CallValidation
7
7
 
8
8
  KERNEL_TO_S = Kernel.instance_method(:to_s)
9
9
  MODULE_TO_S = Module.instance_method(:to_s)
10
- private_constant(:KERNEL_TO_S, :MODULE_TO_S)
10
+ METHOD_NAME_FOR_EVAL = /\A[A-Za-z_][A-Za-z0-9_]*[!?]?\z/
11
+ private_constant(:KERNEL_TO_S, :MODULE_TO_S, :METHOD_NAME_FOR_EVAL)
11
12
 
12
13
  # Wraps a method with a layer of validation for the given type signature.
13
14
  # This wrapper is meant to be fast, and is applied by a previous wrapper,
@@ -52,21 +53,35 @@ module T::Private::Methods::CallValidation
52
53
  def self.create_abstract_wrapper(mod, method_name, original_visibility)
53
54
  T::Configuration.without_ruby_warnings do
54
55
  T::Private::DeclState.current.without_on_method_added do
55
- mod.module_eval(<<~METHOD, __FILE__, __LINE__ + 1)
56
- #{original_visibility}
57
-
58
- def #{method_name}(...)
56
+ if METHOD_NAME_FOR_EVAL.match?(method_name)
57
+ mod.module_eval(<<~METHOD, __FILE__, __LINE__ + 1)
58
+ #{original_visibility}
59
+
60
+ def #{method_name}(...)
61
+ # We allow abstract methods to be implemented by things further down the ancestor chain.
62
+ # So, if a super method exists, call it.
63
+ if defined?(super)
64
+ super
65
+ else
66
+ raise NotImplementedError.new(
67
+ "The method `#{method_name}` on #{mod} is declared as `abstract`. It does not have an implementation."
68
+ )
69
+ end
70
+ end
71
+ METHOD
72
+ else
73
+ T::Private::ClassUtils.def_with_visibility(mod, method_name, original_visibility) do |*args, &blk|
59
74
  # We allow abstract methods to be implemented by things further down the ancestor chain.
60
75
  # So, if a super method exists, call it.
61
76
  if defined?(super)
62
- super
77
+ super(*args, &blk)
63
78
  else
64
79
  raise NotImplementedError.new(
65
80
  "The method `#{method_name}` on #{mod} is declared as `abstract`. It does not have an implementation."
66
81
  )
67
82
  end
68
83
  end
69
- METHOD
84
+ end
70
85
  end
71
86
  end
72
87
  end
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.13504
4
+ version: 0.6.13505
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe