sorbet-runtime 0.5.10810 → 0.5.10813
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/types/private/methods/decl_builder.rb +4 -2
- data/lib/types/private/methods/signature.rb +12 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d139387630eac4ebd032d807b545028012c477eddbacdce1bc24cca8cbadedf3
|
4
|
+
data.tar.gz: 5764af0e42e85f0bb094a83c1c258479ba9f20a4a61da50269a4cae040313bd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
22
|
+
raw_arg_types = parameters.to_h do |_param_kind, param_name|
|
20
23
|
[param_name, not_typed]
|
21
|
-
end
|
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 !=
|
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
|
-
|
73
|
-
|
74
|
-
|
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.
|
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-
|
11
|
+
date: 2023-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|