sorbet-runtime 0.4.5065 → 0.4.5072
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c67d9b5812cb30a678699a32ee974f1ea30c1302f0398fedc3256f6e7bddd86d
|
|
4
|
+
data.tar.gz: c49a65e4b1e6cec214029188e1c3fa858975f1735caa28eefa8436e4c73d5dc3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9c336ac9174bb809d8c1083fdd58ef088461580320bd5eb48ebb24616c09eb56ebbaaa8d56684670561717212e2a507bb5af380d7c0032835a4cededaf5ae76a
|
|
7
|
+
data.tar.gz: c3ce313e9f699d7a948e46dabfa5cbdc243e9d93793c201ce28a599e6ec467dcbbefd92f20e67330094b32e9e3e6bd76e7127915512ff2cea4e53419488bd8d9
|
|
@@ -302,7 +302,6 @@ module T::Private::Methods
|
|
|
302
302
|
check_level: current_declaration.checked,
|
|
303
303
|
on_failure: current_declaration.on_failure,
|
|
304
304
|
override_allow_incompatible: current_declaration.override_allow_incompatible,
|
|
305
|
-
generated: current_declaration.generated,
|
|
306
305
|
)
|
|
307
306
|
|
|
308
307
|
SignatureValidation.validate(signature)
|
|
@@ -51,10 +51,6 @@ module T::Private::Methods::CallValidation
|
|
|
51
51
|
# This method is called for every `sig`. It's critical to keep it fast and
|
|
52
52
|
# reduce number of allocations that happen here.
|
|
53
53
|
|
|
54
|
-
if method_sig.ever_failed && method_sig.generated
|
|
55
|
-
return original_method.bind(instance).call(*args, &blk)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
54
|
T::Profile.typecheck_sample_attempts -= 1
|
|
59
55
|
should_sample = T::Profile.typecheck_sample_attempts == 0
|
|
60
56
|
if should_sample
|
|
@@ -252,10 +248,6 @@ module T::Private::Methods::CallValidation
|
|
|
252
248
|
T::Profile.typecheck_duration += (Process.clock_gettime(Process::CLOCK_MONOTONIC) - t1)
|
|
253
249
|
end
|
|
254
250
|
|
|
255
|
-
if method_sig.ever_failed && method_sig.generated
|
|
256
|
-
return original_method.bind(self).call(&blk)
|
|
257
|
-
end
|
|
258
|
-
|
|
259
251
|
# The following line breaks are intentional to show nice pry message
|
|
260
252
|
|
|
261
253
|
|
|
@@ -303,10 +295,6 @@ module T::Private::Methods::CallValidation
|
|
|
303
295
|
# reduce number of allocations that happen here.
|
|
304
296
|
# This method is a manually sped-up version of more general code in `validate_call`
|
|
305
297
|
|
|
306
|
-
if method_sig.ever_failed && method_sig.generated
|
|
307
|
-
return original_method.bind(self).call(arg0, &blk)
|
|
308
|
-
end
|
|
309
|
-
|
|
310
298
|
T::Profile.typecheck_sample_attempts -= 1
|
|
311
299
|
should_sample = T::Profile.typecheck_sample_attempts == 0
|
|
312
300
|
if should_sample
|
|
@@ -392,10 +380,6 @@ module T::Private::Methods::CallValidation
|
|
|
392
380
|
# reduce number of allocations that happen here.
|
|
393
381
|
# This method is a manually sped-up version of more general code in `validate_call`
|
|
394
382
|
|
|
395
|
-
if method_sig.ever_failed && method_sig.generated
|
|
396
|
-
return original_method.bind(self).call(arg0, arg1, &blk)
|
|
397
|
-
end
|
|
398
|
-
|
|
399
383
|
T::Profile.typecheck_sample_attempts -= 1
|
|
400
384
|
should_sample = T::Profile.typecheck_sample_attempts == 0
|
|
401
385
|
if should_sample
|
|
@@ -493,10 +477,6 @@ module T::Private::Methods::CallValidation
|
|
|
493
477
|
# reduce number of allocations that happen here.
|
|
494
478
|
# This method is a manually sped-up version of more general code in `validate_call`
|
|
495
479
|
|
|
496
|
-
if method_sig.ever_failed && method_sig.generated
|
|
497
|
-
return original_method.bind(self).call(arg0, arg1, arg2, &blk)
|
|
498
|
-
end
|
|
499
|
-
|
|
500
480
|
T::Profile.typecheck_sample_attempts -= 1
|
|
501
481
|
should_sample = T::Profile.typecheck_sample_attempts == 0
|
|
502
482
|
if should_sample
|
|
@@ -607,10 +587,6 @@ module T::Private::Methods::CallValidation
|
|
|
607
587
|
# reduce number of allocations that happen here.
|
|
608
588
|
# This method is a manually sped-up version of more general code in `validate_call`
|
|
609
589
|
|
|
610
|
-
if method_sig.ever_failed && method_sig.generated
|
|
611
|
-
return original_method.bind(self).call(arg0, arg1, arg2, arg3, &blk)
|
|
612
|
-
end
|
|
613
|
-
|
|
614
590
|
T::Profile.typecheck_sample_attempts -= 1
|
|
615
591
|
should_sample = T::Profile.typecheck_sample_attempts == 0
|
|
616
592
|
if should_sample
|
|
@@ -760,10 +736,6 @@ module T::Private::Methods::CallValidation
|
|
|
760
736
|
# reduce number of allocations that happen here.
|
|
761
737
|
# This method is a manually sped-up version of more general code in `validate_call`
|
|
762
738
|
|
|
763
|
-
if method_sig.ever_failed && method_sig.generated
|
|
764
|
-
return original_method.bind(self).call(&blk)
|
|
765
|
-
end
|
|
766
|
-
|
|
767
739
|
T::Profile.typecheck_sample_attempts -= 1
|
|
768
740
|
should_sample = T::Profile.typecheck_sample_attempts == 0
|
|
769
741
|
if should_sample
|
|
@@ -817,10 +789,6 @@ module T::Private::Methods::CallValidation
|
|
|
817
789
|
# reduce number of allocations that happen here.
|
|
818
790
|
# This method is a manually sped-up version of more general code in `validate_call`
|
|
819
791
|
|
|
820
|
-
if method_sig.ever_failed && method_sig.generated
|
|
821
|
-
return original_method.bind(self).call(arg0, &blk)
|
|
822
|
-
end
|
|
823
|
-
|
|
824
792
|
T::Profile.typecheck_sample_attempts -= 1
|
|
825
793
|
should_sample = T::Profile.typecheck_sample_attempts == 0
|
|
826
794
|
if should_sample
|
|
@@ -884,10 +852,6 @@ module T::Private::Methods::CallValidation
|
|
|
884
852
|
# reduce number of allocations that happen here.
|
|
885
853
|
# This method is a manually sped-up version of more general code in `validate_call`
|
|
886
854
|
|
|
887
|
-
if method_sig.ever_failed && method_sig.generated
|
|
888
|
-
return original_method.bind(self).call(arg0, arg1, &blk)
|
|
889
|
-
end
|
|
890
|
-
|
|
891
855
|
T::Profile.typecheck_sample_attempts -= 1
|
|
892
856
|
should_sample = T::Profile.typecheck_sample_attempts == 0
|
|
893
857
|
if should_sample
|
|
@@ -964,10 +928,6 @@ module T::Private::Methods::CallValidation
|
|
|
964
928
|
# reduce number of allocations that happen here.
|
|
965
929
|
# This method is a manually sped-up version of more general code in `validate_call`
|
|
966
930
|
|
|
967
|
-
if method_sig.ever_failed && method_sig.generated
|
|
968
|
-
return original_method.bind(self).call(arg0, arg1, arg2, &blk)
|
|
969
|
-
end
|
|
970
|
-
|
|
971
931
|
T::Profile.typecheck_sample_attempts -= 1
|
|
972
932
|
should_sample = T::Profile.typecheck_sample_attempts == 0
|
|
973
933
|
if should_sample
|
|
@@ -1057,10 +1017,6 @@ module T::Private::Methods::CallValidation
|
|
|
1057
1017
|
# reduce number of allocations that happen here.
|
|
1058
1018
|
# This method is a manually sped-up version of more general code in `validate_call`
|
|
1059
1019
|
|
|
1060
|
-
if method_sig.ever_failed && method_sig.generated
|
|
1061
|
-
return original_method.bind(self).call(arg0, arg1, arg2, arg3, &blk)
|
|
1062
|
-
end
|
|
1063
|
-
|
|
1064
1020
|
T::Profile.typecheck_sample_attempts -= 1
|
|
1065
1021
|
should_sample = T::Profile.typecheck_sample_attempts == 0
|
|
1066
1022
|
if should_sample
|
|
@@ -1156,7 +1112,6 @@ module T::Private::Methods::CallValidation
|
|
|
1156
1112
|
end
|
|
1157
1113
|
|
|
1158
1114
|
def self.report_error(method_sig, error_message, kind, name, type, value, caller_offset: 0)
|
|
1159
|
-
method_sig.mark_failed
|
|
1160
1115
|
caller_loc = T.must(caller_locations(3 + caller_offset, 1))[0]
|
|
1161
1116
|
definition_file, definition_line = method_sig.method.source_location
|
|
1162
1117
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# typed: true
|
|
3
3
|
|
|
4
4
|
module T::Private::Methods
|
|
5
|
-
Declaration = Struct.new(:mod, :params, :returns, :bind, :mode, :checked, :finalized, :on_failure, :override_allow_incompatible, :type_parameters
|
|
5
|
+
Declaration = Struct.new(:mod, :params, :returns, :bind, :mode, :checked, :finalized, :on_failure, :override_allow_incompatible, :type_parameters)
|
|
6
6
|
|
|
7
7
|
class DeclBuilder
|
|
8
8
|
attr_reader :decl
|
|
@@ -28,7 +28,6 @@ module T::Private::Methods
|
|
|
28
28
|
ARG_NOT_PROVIDED, # on_failure
|
|
29
29
|
nil, # override_allow_incompatible
|
|
30
30
|
ARG_NOT_PROVIDED, # type_parameters
|
|
31
|
-
ARG_NOT_PROVIDED, # generated
|
|
32
31
|
)
|
|
33
32
|
end
|
|
34
33
|
|
|
@@ -88,9 +87,6 @@ module T::Private::Methods
|
|
|
88
87
|
if level == :never && !decl.on_failure.equal?(ARG_NOT_PROVIDED)
|
|
89
88
|
raise BuilderError.new("You can't use .checked(:never) with .on_failure because .on_failure will have no effect.")
|
|
90
89
|
end
|
|
91
|
-
if !decl.generated.equal?(ARG_NOT_PROVIDED)
|
|
92
|
-
raise BuilderError.new("You can't use .checked with .generated.")
|
|
93
|
-
end
|
|
94
90
|
if !T::Private::RuntimeLevels::LEVELS.include?(level)
|
|
95
91
|
raise BuilderError.new("Invalid `checked` level '#{level}'. Use one of: #{T::Private::RuntimeLevels::LEVELS}.")
|
|
96
92
|
end
|
|
@@ -109,33 +105,12 @@ module T::Private::Methods
|
|
|
109
105
|
if decl.checked == :never
|
|
110
106
|
raise BuilderError.new("You can't use .on_failure with .checked(:never) because .on_failure will have no effect.")
|
|
111
107
|
end
|
|
112
|
-
if !decl.generated.equal?(ARG_NOT_PROVIDED)
|
|
113
|
-
raise BuilderError.new("You can't use .on_failure with .generated.")
|
|
114
|
-
end
|
|
115
108
|
|
|
116
109
|
decl.on_failure = args
|
|
117
110
|
|
|
118
111
|
self
|
|
119
112
|
end
|
|
120
113
|
|
|
121
|
-
def generated
|
|
122
|
-
check_live!
|
|
123
|
-
|
|
124
|
-
if !decl.generated.equal?(ARG_NOT_PROVIDED)
|
|
125
|
-
raise BuilderError.new("You can't call .generated multiple times in a signature.")
|
|
126
|
-
end
|
|
127
|
-
if !decl.checked.equal?(ARG_NOT_PROVIDED)
|
|
128
|
-
raise BuilderError.new("You can't use .generated with .checked.")
|
|
129
|
-
end
|
|
130
|
-
if !decl.on_failure.equal?(ARG_NOT_PROVIDED)
|
|
131
|
-
raise BuilderError.new("You can't use .generated with .on_failure.")
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
decl.generated = true
|
|
135
|
-
|
|
136
|
-
self
|
|
137
|
-
end
|
|
138
|
-
|
|
139
114
|
def abstract
|
|
140
115
|
check_live!
|
|
141
116
|
|
|
@@ -238,9 +213,6 @@ module T::Private::Methods
|
|
|
238
213
|
if decl.on_failure.equal?(ARG_NOT_PROVIDED)
|
|
239
214
|
decl.on_failure = nil
|
|
240
215
|
end
|
|
241
|
-
if decl.generated.equal?(ARG_NOT_PROVIDED)
|
|
242
|
-
decl.generated = false
|
|
243
|
-
end
|
|
244
216
|
if decl.params.equal?(ARG_NOT_PROVIDED)
|
|
245
217
|
decl.params = {}
|
|
246
218
|
end
|
|
@@ -5,7 +5,7 @@ class T::Private::Methods::Signature
|
|
|
5
5
|
attr_reader :method, :method_name, :arg_types, :kwarg_types, :block_type, :block_name,
|
|
6
6
|
:rest_type, :rest_name, :keyrest_type, :keyrest_name, :bind,
|
|
7
7
|
:return_type, :mode, :req_arg_count, :req_kwarg_names, :has_rest, :has_keyrest,
|
|
8
|
-
:check_level, :
|
|
8
|
+
:check_level, :parameters, :on_failure, :override_allow_incompatible
|
|
9
9
|
|
|
10
10
|
def self.new_untyped(method:, mode: T::Private::Methods::Modes.untyped, parameters: method.parameters)
|
|
11
11
|
# Using `Untyped` ensures we'll get an error if we ever try validation on these.
|
|
@@ -28,11 +28,7 @@ class T::Private::Methods::Signature
|
|
|
28
28
|
)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def
|
|
32
|
-
@ever_failed = true
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def initialize(method:, method_name:, raw_arg_types:, raw_return_type:, bind:, mode:, check_level:, parameters: method.parameters, on_failure:, generated: false, override_allow_incompatible: false)
|
|
31
|
+
def initialize(method:, method_name:, raw_arg_types:, raw_return_type:, bind:, mode:, check_level:, parameters: method.parameters, on_failure:, override_allow_incompatible: false)
|
|
36
32
|
@method = method
|
|
37
33
|
@method_name = method_name
|
|
38
34
|
@arg_types = []
|
|
@@ -54,8 +50,6 @@ class T::Private::Methods::Signature
|
|
|
54
50
|
@parameters = parameters
|
|
55
51
|
@on_failure = on_failure
|
|
56
52
|
@override_allow_incompatible = override_allow_incompatible
|
|
57
|
-
@generated = generated
|
|
58
|
-
@ever_failed = false
|
|
59
53
|
|
|
60
54
|
param_names = parameters.map {|_, name| name}
|
|
61
55
|
declared_param_names = raw_arg_types.keys
|
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.4.
|
|
4
|
+
version: 0.4.5072
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stripe
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-11-
|
|
11
|
+
date: 2019-11-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|