sorbet-runtime 0.5.10810 → 0.5.10813

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: 9ce397971b7d821fb18a9d6e46c976b36f6aff58d41ce9c450b55b556a847038
4
- data.tar.gz: 27e289b6c887fd4e55b3a4614cd8fd24e4eaf0a5597074f638bdc15832294feb
3
+ metadata.gz: d139387630eac4ebd032d807b545028012c477eddbacdce1bc24cca8cbadedf3
4
+ data.tar.gz: 5764af0e42e85f0bb094a83c1c258479ba9f20a4a61da50269a4cae040313bd0
5
5
  SHA512:
6
- metadata.gz: 761d5c3f85446fb6c2f743868ecdf74f625b3d2c31d2e3045ca91ee626093f09f85f6fdcfdba1d1413896f5e451df450659bb619637fd66fa8d1ed95735d8223
7
- data.tar.gz: e6e883faf46cfec00205731384229290d7ef8bbaa1044694d87d2e236d8f37172acf7a477e5a11e2077c6b47f53376ab6f5b7495b14eecd651a23635a7112e50
6
+ metadata.gz: 02dde0ee309fdeb78efaeec183db979fa09892e3c9dd75c661f785d0ea026e9ba5424d59a5d5ad3f2fe9117f639b6d16480c56c00790b49887574b12b6cfe127
7
+ data.tar.gz: 75bf26f1cb4ce0689bfd4a3d4b85f649eff942b48553259ae971000d620f81364875b6150b62c28ff53f07211a6d9b43690b942ab9ef59aa946aabf914b86324
@@ -231,15 +231,17 @@ module T::Private::Methods
231
231
  decl.on_failure = nil
232
232
  end
233
233
  if decl.params.equal?(ARG_NOT_PROVIDED)
234
- decl.params = {}
234
+ decl.params = FROZEN_HASH
235
235
  end
236
236
  if decl.type_parameters.equal?(ARG_NOT_PROVIDED)
237
- decl.type_parameters = {}
237
+ decl.type_parameters = FROZEN_HASH
238
238
  end
239
239
 
240
240
  decl.finalized = true
241
241
 
242
242
  self
243
243
  end
244
+
245
+ FROZEN_HASH = {}.freeze
244
246
  end
245
247
  end
@@ -8,6 +8,9 @@ class T::Private::Methods::Signature
8
8
  :check_level, :parameters, :on_failure, :override_allow_incompatible,
9
9
  :defined_raw
10
10
 
11
+ SIG_EMPTY_DECLARED_PARAMETERS = [nil].freeze
12
+ UNNAMED_REQUIRED_PARAMETERS = [[:req]].freeze
13
+
11
14
  def self.new_untyped(method:, mode: T::Private::Methods::Modes.untyped, parameters: method.parameters)
12
15
  # Using `Untyped` ensures we'll get an error if we ever try validation on these.
13
16
  not_typed = T::Private::Types::NotTyped.new
@@ -16,9 +19,9 @@ class T::Private::Methods::Signature
16
19
  parameters = parameters.each_with_index.map do |(param_kind, param_name), index|
17
20
  [param_kind, param_name || "arg#{index}"]
18
21
  end
19
- raw_arg_types = parameters.map do |_param_kind, param_name|
22
+ raw_arg_types = parameters.to_h do |_param_kind, param_name|
20
23
  [param_name, not_typed]
21
- end.to_h
24
+ end
22
25
 
23
26
  self.new(
24
27
  method: method,
@@ -61,17 +64,19 @@ class T::Private::Methods::Signature
61
64
  # If sig params are declared but there is a single parameter with a missing name
62
65
  # **and** the method ends with a "=", assume it is a writer method generated
63
66
  # by attr_writer or attr_accessor
64
- writer_method = declared_param_names != [nil] && parameters == [[:req]] && method_name[-1] == "="
67
+ writer_method = declared_param_names != SIG_EMPTY_DECLARED_PARAMETERS && parameters == UNNAMED_REQUIRED_PARAMETERS && method_name[-1] == "="
65
68
  # For writer methods, map the single parameter to the method name without the "=" at the end
66
69
  parameters = [[:req, method_name[0...-1].to_sym]] if writer_method
67
70
  param_names = parameters.map {|_, name| name}
68
71
  missing_names = param_names - declared_param_names
69
- extra_names = declared_param_names - param_names
70
72
  if !missing_names.empty?
71
73
  raise "The declaration for `#{method.name}` is missing parameter(s): #{missing_names.join(', ')}"
72
- end
73
- if !extra_names.empty?
74
- raise "The declaration for `#{method.name}` has extra parameter(s): #{extra_names.join(', ')}"
74
+ elsif param_names.length == declared_param_names.length
75
+ else
76
+ extra_names = declared_param_names - param_names
77
+ if !extra_names.empty?
78
+ raise "The declaration for `#{method.name}` has extra parameter(s): #{extra_names.join(', ')}"
79
+ end
75
80
  end
76
81
 
77
82
  if parameters.size != raw_arg_types.size
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.10810
4
+ version: 0.5.10813
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-09 00:00:00.000000000 Z
11
+ date: 2023-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest