sorbet-runtime 0.5.10894 → 0.5.10899
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4189f1b073aaaa5035d1b6c65a15f3c8214983d8a294b59b4d1f98018c37afe7
|
4
|
+
data.tar.gz: fd63b13edc47b19b09e41f5f032971a9ad021ab00d089f4ae8ee88768ed40eba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63e72252e279285503cd09906187a649c3991205e7f916bbe9749c69786a6c8f989f1f9ee633260355c03b648285823dbf1162be8b1061f90658426f2d629c93
|
7
|
+
data.tar.gz: b9b49cbaff53c3086e3c9e42c26dce62b5a06d468cfef6adaf13cbe52e7410de97a92e5a6b0db5c751e1d92e1e564b02b7a7549d36182bdfe49ed19256f6c626
|
@@ -39,8 +39,6 @@ class T::Private::Methods::Signature
|
|
39
39
|
def initialize(method:, method_name:, raw_arg_types:, raw_return_type:, bind:, mode:, check_level:, on_failure:, parameters: method.parameters, override_allow_incompatible: false, defined_raw: false)
|
40
40
|
@method = method
|
41
41
|
@method_name = method_name
|
42
|
-
@arg_types = []
|
43
|
-
@kwarg_types = {}
|
44
42
|
@block_type = nil
|
45
43
|
@block_name = nil
|
46
44
|
@rest_type = nil
|
@@ -51,8 +49,6 @@ class T::Private::Methods::Signature
|
|
51
49
|
@bind = bind ? T::Utils.coerce(bind) : bind
|
52
50
|
@mode = mode
|
53
51
|
@check_level = check_level
|
54
|
-
@req_arg_count = 0
|
55
|
-
@req_kwarg_names = []
|
56
52
|
@has_rest = false
|
57
53
|
@has_keyrest = false
|
58
54
|
@parameters = parameters
|
@@ -60,6 +56,12 @@ class T::Private::Methods::Signature
|
|
60
56
|
@override_allow_incompatible = override_allow_incompatible
|
61
57
|
@defined_raw = defined_raw
|
62
58
|
|
59
|
+
# Use T.untyped in lieu of T.nilable to try to avoid unnecessary allocations.
|
60
|
+
arg_types = T.let(nil, T.untyped)
|
61
|
+
kwarg_types = T.let(nil, T.untyped)
|
62
|
+
req_arg_count = 0
|
63
|
+
req_kwarg_names = T.let(nil, T.untyped)
|
64
|
+
|
63
65
|
# If sig params are declared but there is a single parameter with a missing name
|
64
66
|
# **and** the method ends with a "=", assume it is a writer method generated
|
65
67
|
# by attr_writer or attr_accessor
|
@@ -109,7 +111,7 @@ class T::Private::Methods::Signature
|
|
109
111
|
|
110
112
|
case param_kind
|
111
113
|
when :req
|
112
|
-
if
|
114
|
+
if (arg_types ? arg_types.length : 0) > req_arg_count
|
113
115
|
# Note that this is actually is supported by Ruby, but it would add complexity to
|
114
116
|
# support it here, and I'm happy to discourage its use anyway.
|
115
117
|
#
|
@@ -120,14 +122,14 @@ class T::Private::Methods::Signature
|
|
120
122
|
# see this error. The simplest resolution is to rename your method.
|
121
123
|
raise "Required params after optional params are not supported in method declarations. Method: #{method_desc}"
|
122
124
|
end
|
123
|
-
|
124
|
-
|
125
|
+
(arg_types ||= []) << [param_name, type]
|
126
|
+
req_arg_count += 1
|
125
127
|
when :opt
|
126
|
-
|
128
|
+
(arg_types ||= []) << [param_name, type]
|
127
129
|
when :key, :keyreq
|
128
|
-
|
130
|
+
(kwarg_types ||= {})[param_name] = type
|
129
131
|
if param_kind == :keyreq
|
130
|
-
|
132
|
+
(req_kwarg_names ||= []) << param_name
|
131
133
|
end
|
132
134
|
when :block
|
133
135
|
@block_name = param_name
|
@@ -146,6 +148,11 @@ class T::Private::Methods::Signature
|
|
146
148
|
|
147
149
|
i += 1
|
148
150
|
end
|
151
|
+
|
152
|
+
@arg_types = arg_types || EMPTY_LIST
|
153
|
+
@kwarg_types = kwarg_types || EMPTY_HASH
|
154
|
+
@req_arg_count = req_arg_count
|
155
|
+
@req_kwarg_names = req_kwarg_names || EMPTY_LIST
|
149
156
|
end
|
150
157
|
|
151
158
|
attr_writer :method_name
|
@@ -238,5 +245,6 @@ class T::Private::Methods::Signature
|
|
238
245
|
"#{@method} at #{loc}"
|
239
246
|
end
|
240
247
|
|
248
|
+
EMPTY_LIST = [].freeze
|
241
249
|
EMPTY_HASH = {}.freeze
|
242
250
|
end
|
@@ -117,7 +117,7 @@ module T::Props
|
|
117
117
|
def eagerly_define_lazy_methods!
|
118
118
|
return if lazily_defined_methods.empty?
|
119
119
|
|
120
|
-
source = lazily_defined_methods.values.map(&:call).map(&:to_s).join("\n\n")
|
120
|
+
source = "# frozen_string_literal: true\n" + lazily_defined_methods.values.map(&:call).map(&:to_s).join("\n\n")
|
121
121
|
|
122
122
|
cls = decorated_class
|
123
123
|
cls.class_eval(source)
|
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.10899
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|