steep 1.8.2 → 1.9.0.dev.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +0 -12
- data/Steepfile +0 -14
- data/lib/steep/cli.rb +47 -5
- data/lib/steep/diagnostic/ruby.rb +1 -58
- data/lib/steep/drivers/annotations.rb +1 -1
- data/lib/steep/drivers/check.rb +107 -1
- data/lib/steep/drivers/checkfile.rb +10 -8
- data/lib/steep/drivers/print_project.rb +83 -40
- data/lib/steep/drivers/utils/driver_helper.rb +5 -3
- data/lib/steep/drivers/watch.rb +24 -2
- data/lib/steep/index/signature_symbol_provider.rb +8 -8
- data/lib/steep/interface/builder.rb +14 -1
- data/lib/steep/interface/function.rb +2 -2
- data/lib/steep/path_helper.rb +4 -2
- data/lib/steep/project/dsl.rb +176 -151
- data/lib/steep/project/group.rb +31 -0
- data/lib/steep/project/target.rb +32 -6
- data/lib/steep/project.rb +38 -10
- data/lib/steep/server/delay_queue.rb +0 -3
- data/lib/steep/server/interaction_worker.rb +2 -11
- data/lib/steep/server/master.rb +95 -281
- data/lib/steep/server/target_group_files.rb +205 -0
- data/lib/steep/server/type_check_controller.rb +322 -0
- data/lib/steep/server/type_check_worker.rb +60 -86
- data/lib/steep/services/file_loader.rb +23 -0
- data/lib/steep/services/goto_service.rb +40 -31
- data/lib/steep/services/hover_provider/singleton_methods.rb +4 -4
- data/lib/steep/services/path_assignment.rb +23 -4
- data/lib/steep/services/type_check_service.rb +76 -159
- data/lib/steep/signature/validator.rb +4 -4
- data/lib/steep/subtyping/check.rb +2 -2
- data/lib/steep/thread_waiter.rb +24 -16
- data/lib/steep/type_construction.rb +5 -5
- data/lib/steep/type_inference/block_params.rb +1 -2
- data/lib/steep/type_inference/context.rb +1 -1
- data/lib/steep/type_inference/type_env.rb +4 -4
- data/lib/steep/type_inference/type_env_builder.rb +1 -1
- data/lib/steep/version.rb +1 -1
- data/lib/steep.rb +6 -4
- data/sample/Steepfile +6 -0
- data/sample/lib/conference.rb +1 -5
- data/steep.gemspec +7 -1
- metadata +8 -6
- data/lib/steep/drivers/validate.rb +0 -65
@@ -76,52 +76,15 @@ module Steep
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
class TargetRequest
|
80
|
-
attr_reader :target
|
81
|
-
attr_reader :source_paths
|
82
|
-
|
83
|
-
def initialize(target:)
|
84
|
-
@target = target
|
85
|
-
@source_paths = Set[]
|
86
|
-
@signature_updated = false
|
87
|
-
end
|
88
|
-
|
89
|
-
def signature_updated!(value = true)
|
90
|
-
@signature_updated = value
|
91
|
-
self
|
92
|
-
end
|
93
|
-
|
94
|
-
def signature_updated?
|
95
|
-
@signature_updated
|
96
|
-
end
|
97
|
-
|
98
|
-
def empty?
|
99
|
-
!signature_updated? && source_paths.empty?
|
100
|
-
end
|
101
|
-
|
102
|
-
def ==(other)
|
103
|
-
other.is_a?(TargetRequest) &&
|
104
|
-
other.target == target &&
|
105
|
-
other.source_paths == source_paths &&
|
106
|
-
other.signature_updated? == signature_updated?
|
107
|
-
end
|
108
|
-
|
109
|
-
alias eql? ==
|
110
|
-
|
111
|
-
def hash
|
112
|
-
self.class.hash ^ target.hash ^ source_paths.hash ^ @signature_updated.hash
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
79
|
def initialize(project:)
|
117
80
|
@project = project
|
118
81
|
|
119
82
|
@source_files = {}
|
120
|
-
@signature_services = project.targets.each.with_object({}) do |target, hash|
|
83
|
+
@signature_services = project.targets.each.with_object({}) do |target, hash| #$ Hash[Symbol, SignatureService]
|
121
84
|
loader = Project::Target.construct_env_loader(options: target.options, project: project)
|
122
85
|
hash[target.name] = SignatureService.load_from(loader)
|
123
86
|
end
|
124
|
-
@signature_validation_diagnostics = project.targets.each.with_object({}) do |target, hash|
|
87
|
+
@signature_validation_diagnostics = project.targets.each.with_object({}) do |target, hash| #$ Hash[Symbol, Hash[Pathname, Array[Diagnostic::Signature::Base]]]
|
125
88
|
hash[target.name] = {}
|
126
89
|
end
|
127
90
|
end
|
@@ -179,135 +142,91 @@ module Steep
|
|
179
142
|
end
|
180
143
|
|
181
144
|
def update(changes:)
|
182
|
-
requests = project.targets.each_with_object({}.compare_by_identity) do |target, hash|
|
183
|
-
hash[target] = TargetRequest.new(target: target)
|
184
|
-
end
|
185
|
-
|
186
145
|
Steep.measure "#update_signature" do
|
187
|
-
update_signature(changes: changes
|
146
|
+
update_signature(changes: changes)
|
188
147
|
end
|
189
148
|
|
190
149
|
Steep.measure "#update_sources" do
|
191
|
-
update_sources(changes: changes
|
150
|
+
update_sources(changes: changes)
|
192
151
|
end
|
193
|
-
|
194
|
-
requests.transform_keys(&:name).reject {|_, request| request.empty? }
|
195
152
|
end
|
196
153
|
|
197
|
-
def
|
198
|
-
requests = update(changes: changes)
|
199
|
-
|
200
|
-
signatures = requests.each_value.with_object(Set[]) do |request, sigs|
|
201
|
-
if request.signature_updated?
|
202
|
-
service = signature_services[request.target.name]
|
203
|
-
sigs.merge(service.each_rbs_path)
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
signatures.each do |path|
|
208
|
-
if assignment =~ path
|
209
|
-
validate_signature(path: path, &block)
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
requests.each_value do |request|
|
214
|
-
request.source_paths.each do |path|
|
215
|
-
if assignment =~ path
|
216
|
-
typecheck_source(path: path, target: request.target, &block)
|
217
|
-
end
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
def validate_signature(path:, &block)
|
154
|
+
def validate_signature(path:, target:)
|
223
155
|
Steep.logger.tagged "#validate_signature(path=#{path})" do
|
224
156
|
Steep.measure "validation" do
|
225
|
-
|
226
|
-
accumulated_diagnostics = []
|
157
|
+
service = signature_services[target.name]
|
227
158
|
|
228
|
-
|
229
|
-
service = signature_services[target.name]
|
159
|
+
raise "#{path} is not library nor signature of #{target.name}" unless target.possible_signature_file?(path) || service.env_rbs_paths.include?(path)
|
230
160
|
|
231
|
-
|
161
|
+
case service.status
|
162
|
+
when SignatureService::SyntaxErrorStatus
|
163
|
+
diagnostics = service.status.diagnostics.select do |diag|
|
164
|
+
diag.location or raise
|
165
|
+
Pathname(diag.location.buffer.name) == path &&
|
166
|
+
(diag.is_a?(Diagnostic::Signature::SyntaxError) || diag.is_a?(Diagnostic::Signature::UnexpectedError))
|
167
|
+
end
|
232
168
|
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
(diag.is_a?(Diagnostic::Signature::SyntaxError) || diag.is_a?(Diagnostic::Signature::UnexpectedError))
|
239
|
-
end
|
240
|
-
accumulated_diagnostics.push(*diagnostics)
|
241
|
-
unless diagnostics.empty?
|
242
|
-
yield [path, accumulated_diagnostics]
|
243
|
-
end
|
169
|
+
when SignatureService::AncestorErrorStatus
|
170
|
+
diagnostics = service.status.diagnostics.select do |diag|
|
171
|
+
diag.location or raise
|
172
|
+
Pathname(diag.location.buffer.name) == path
|
173
|
+
end
|
244
174
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
sampler.sample(type_name.to_s) do
|
261
|
-
case
|
262
|
-
when type_name.class?
|
263
|
-
validator.validate_one_class(type_name)
|
264
|
-
when type_name.interface?
|
265
|
-
validator.validate_one_interface(type_name)
|
266
|
-
when type_name.alias?
|
267
|
-
validator.validate_one_alias(type_name)
|
268
|
-
end
|
175
|
+
when SignatureService::LoadedStatus
|
176
|
+
validator = Signature::Validator.new(checker: service.current_subtyping || raise)
|
177
|
+
type_names = service.type_names(paths: Set[path], env: service.latest_env).to_set
|
178
|
+
|
179
|
+
unless type_names.empty?
|
180
|
+
Steep.measure2 "Validating #{type_names.size} types" do |sampler|
|
181
|
+
type_names.each do |type_name|
|
182
|
+
sampler.sample(type_name.to_s) do
|
183
|
+
case
|
184
|
+
when type_name.class?
|
185
|
+
validator.validate_one_class(type_name)
|
186
|
+
when type_name.interface?
|
187
|
+
validator.validate_one_interface(type_name)
|
188
|
+
when type_name.alias?
|
189
|
+
validator.validate_one_alias(type_name)
|
269
190
|
end
|
270
191
|
end
|
271
192
|
end
|
272
193
|
end
|
194
|
+
end
|
273
195
|
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
end
|
196
|
+
const_decls = service.const_decls(paths: Set[path], env: service.latest_env)
|
197
|
+
unless const_decls.empty?
|
198
|
+
Steep.measure2 "Validating #{const_decls.size} constants" do |sampler|
|
199
|
+
const_decls.each do |name, entry|
|
200
|
+
sampler.sample(name.to_s) do
|
201
|
+
validator.validate_one_constant(name, entry)
|
281
202
|
end
|
282
203
|
end
|
283
204
|
end
|
205
|
+
end
|
284
206
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
end
|
207
|
+
global_decls = service.global_decls(paths: Set[path])
|
208
|
+
unless global_decls.empty?
|
209
|
+
Steep.measure2 "Validating #{global_decls.size} globals" do |sampler|
|
210
|
+
global_decls.each do |name, entry|
|
211
|
+
sampler.sample(name.to_s) do
|
212
|
+
validator.validate_one_global(name, entry)
|
292
213
|
end
|
293
214
|
end
|
294
215
|
end
|
295
|
-
|
296
|
-
diagnostics = validator.each_error.select do |error|
|
297
|
-
error.location or raise
|
298
|
-
Pathname(error.location.buffer.name) == path
|
299
|
-
end
|
300
|
-
accumulated_diagnostics.push(*diagnostics)
|
301
|
-
yield [path, accumulated_diagnostics]
|
302
216
|
end
|
303
217
|
|
304
|
-
|
218
|
+
diagnostics = validator.each_error.select do |error|
|
219
|
+
error.location or raise
|
220
|
+
Pathname(error.location.buffer.name) == path
|
221
|
+
end
|
305
222
|
end
|
223
|
+
|
224
|
+
signature_validation_diagnostics[target.name][path] = diagnostics
|
306
225
|
end
|
307
226
|
end
|
308
227
|
end
|
309
228
|
|
310
|
-
def typecheck_source(path:, target:
|
229
|
+
def typecheck_source(path:, target:)
|
311
230
|
return unless target
|
312
231
|
|
313
232
|
Steep.logger.tagged "#typecheck_source(path=#{path})" do
|
@@ -318,44 +237,44 @@ module Steep
|
|
318
237
|
if subtyping
|
319
238
|
text = source_files[path].content
|
320
239
|
file = type_check_file(target: target, subtyping: subtyping, path: path, text: text) { signature_service.latest_constant_resolver }
|
321
|
-
yield [file.path, file.diagnostics]
|
322
240
|
source_files[path] = file
|
241
|
+
|
242
|
+
file.diagnostics
|
323
243
|
end
|
324
244
|
end
|
325
245
|
end
|
326
246
|
end
|
327
247
|
|
328
|
-
def update_signature(changes
|
248
|
+
def update_signature(changes:)
|
329
249
|
Steep.logger.tagged "#update_signature" do
|
250
|
+
signature_targets = {} #: Hash[Pathname, Project::Target]
|
251
|
+
changes.each do |path, changes|
|
252
|
+
target = project.targets.find { _1.possible_signature_file?(path) } or next
|
253
|
+
signature_targets[path] = target
|
254
|
+
end
|
255
|
+
|
330
256
|
project.targets.each do |target|
|
331
|
-
|
332
|
-
|
257
|
+
Steep.logger.tagged "#{target.name}" do
|
258
|
+
# Load signatures from all project targets but `#unreferenced` ones
|
259
|
+
target_changes = changes.select do |path, _|
|
260
|
+
signature_target = signature_targets.fetch(path, nil) or next
|
261
|
+
signature_target == target || !signature_target.unreferenced
|
262
|
+
end
|
333
263
|
|
334
|
-
|
335
|
-
|
336
|
-
|
264
|
+
unless target_changes.empty?
|
265
|
+
signature_services.fetch(target.name).update(target_changes)
|
266
|
+
end
|
337
267
|
end
|
338
268
|
end
|
339
269
|
end
|
340
270
|
end
|
341
271
|
|
342
|
-
def update_sources(changes
|
343
|
-
requests.each_value do |request|
|
344
|
-
source_files
|
345
|
-
.select {|path, file| request.target.possible_source_file?(path) }
|
346
|
-
.each do |path, file|
|
347
|
-
(changes[path] ||= []).prepend(ContentChange.string(file.content))
|
348
|
-
end
|
349
|
-
end
|
350
|
-
|
272
|
+
def update_sources(changes:)
|
351
273
|
changes.each do |path, changes|
|
352
|
-
|
353
|
-
|
354
|
-
if target
|
274
|
+
if source_file?(path)
|
355
275
|
file = source_files[path] || SourceFile.no_data(path: path, content: "")
|
356
276
|
content = changes.inject(file.content) {|text, change| change.apply_to(text) }
|
357
277
|
source_files[path] = file.update_content(content)
|
358
|
-
requests[target].source_paths << path
|
359
278
|
end
|
360
279
|
end
|
361
280
|
end
|
@@ -434,9 +353,7 @@ module Steep
|
|
434
353
|
end
|
435
354
|
|
436
355
|
def source_file?(path)
|
437
|
-
|
438
|
-
project.target_for_source_path(path)
|
439
|
-
end
|
356
|
+
source_files.key?(path) || (project.target_for_source_path(path) ? true : false)
|
440
357
|
end
|
441
358
|
|
442
359
|
def signature_file?(path)
|
@@ -237,7 +237,7 @@ module Steep
|
|
237
237
|
|
238
238
|
def validate_definition_type(definition)
|
239
239
|
each_method_type(definition) do |method_type|
|
240
|
-
upper_bounds = method_type.type_params.each.with_object({}) do |param, hash|
|
240
|
+
upper_bounds = method_type.type_params.each.with_object({}) do |param, hash| #$ Hash[Symbol, AST::Types::t?]
|
241
241
|
hash[param.name] = factory.type_opt(param.upper_bound_type)
|
242
242
|
end
|
243
243
|
|
@@ -298,7 +298,7 @@ module Steep
|
|
298
298
|
|
299
299
|
Steep.logger.tagged "#{name}" do
|
300
300
|
builder.build_instance(name).tap do |definition|
|
301
|
-
upper_bounds = definition.type_params_decl.each.with_object({}) do |param, bounds|
|
301
|
+
upper_bounds = definition.type_params_decl.each.with_object({}) do |param, bounds| #$ Hash[Symbol, AST::Types::t?]
|
302
302
|
bounds[param.name] = factory.type_opt(param.upper_bound_type)
|
303
303
|
end
|
304
304
|
|
@@ -518,7 +518,7 @@ module Steep
|
|
518
518
|
|
519
519
|
validate_type_params(name, definition.type_params_decl)
|
520
520
|
|
521
|
-
upper_bounds = definition.type_params_decl.each.with_object({}) do |param, bounds|
|
521
|
+
upper_bounds = definition.type_params_decl.each.with_object({}) do |param, bounds| #$ Hash[Symbol, AST::Types::t?]
|
522
522
|
bounds[param.name] = factory.type_opt(param.upper_bound_type)
|
523
523
|
end
|
524
524
|
|
@@ -615,7 +615,7 @@ module Steep
|
|
615
615
|
|
616
616
|
validate_type_params(name, entry.decl.type_params)
|
617
617
|
|
618
|
-
upper_bounds = entry.decl.type_params.each.with_object({}) do |param, bounds|
|
618
|
+
upper_bounds = entry.decl.type_params.each.with_object({}) do |param, bounds| #$ Hash[Symbol, AST::Types::t?]
|
619
619
|
bounds[param.name] = factory.type_opt(param.upper_bound_type)
|
620
620
|
end
|
621
621
|
|
@@ -42,7 +42,7 @@ module Steep
|
|
42
42
|
def push_variable_bounds(params)
|
43
43
|
case params
|
44
44
|
when Array
|
45
|
-
b = params.each.with_object({}) do |param, hash|
|
45
|
+
b = params.each.with_object({}) do |param, hash| #$ Hash[Symbol, AST::Types::t?]
|
46
46
|
hash[param.name] = param.upper_bound
|
47
47
|
end
|
48
48
|
when Hash
|
@@ -67,7 +67,7 @@ module Steep
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def variable_upper_bounds
|
70
|
-
@bounds.each_with_object({}) do |bounds, hash|
|
70
|
+
@bounds.each_with_object({}) do |bounds, hash| #$ Hash[Symbol, AST::Types::t?]
|
71
71
|
hash.merge!(bounds)
|
72
72
|
end
|
73
73
|
end
|
data/lib/steep/thread_waiter.rb
CHANGED
@@ -1,34 +1,42 @@
|
|
1
1
|
module Steep
|
2
2
|
class ThreadWaiter
|
3
|
-
attr_reader :
|
3
|
+
attr_reader :queue, :waiter_threads
|
4
4
|
|
5
|
-
def initialize(objects)
|
6
|
-
@objects = objects
|
5
|
+
def initialize(objects = nil)
|
7
6
|
@queue = Thread::Queue.new()
|
8
7
|
@waiter_threads = Set[].compare_by_identity
|
9
8
|
|
10
|
-
objects
|
11
|
-
|
9
|
+
if objects
|
10
|
+
objects.each do |object|
|
11
|
+
thread = yield(object)
|
12
|
+
self << thread
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
12
16
|
|
13
|
-
|
14
|
-
|
17
|
+
def <<(thread)
|
18
|
+
waiter_thread = Thread.new(thread) do |thread|
|
19
|
+
# @type var thread: Thread
|
15
20
|
|
16
|
-
|
17
|
-
thread.join
|
18
|
-
ensure
|
19
|
-
queue << [object, thread]
|
20
|
-
end
|
21
|
-
end
|
21
|
+
Thread.current.report_on_exception = false
|
22
22
|
|
23
|
-
|
23
|
+
begin
|
24
|
+
thread.join
|
25
|
+
ensure
|
26
|
+
queue << thread
|
27
|
+
end
|
24
28
|
end
|
29
|
+
|
30
|
+
waiter_threads << waiter_thread
|
31
|
+
|
32
|
+
self
|
25
33
|
end
|
26
34
|
|
27
35
|
def wait_one
|
28
36
|
unless waiter_threads.empty?
|
29
|
-
|
37
|
+
th = queue.pop() or raise
|
30
38
|
waiter_threads.delete(th)
|
31
|
-
|
39
|
+
th
|
32
40
|
end
|
33
41
|
end
|
34
42
|
end
|
@@ -1434,10 +1434,10 @@ module Steep
|
|
1434
1434
|
case hint
|
1435
1435
|
when AST::Types::Any, AST::Types::Top, AST::Types::Void
|
1436
1436
|
# ok
|
1437
|
-
when hint == pair.type
|
1438
|
-
# ok
|
1439
1437
|
else
|
1440
|
-
pair.
|
1438
|
+
unless hint == pair.type
|
1439
|
+
pair.constr.typing.add_error Diagnostic::Ruby::FallbackAny.new(node: node)
|
1440
|
+
end
|
1441
1441
|
end
|
1442
1442
|
end
|
1443
1443
|
end
|
@@ -2192,7 +2192,7 @@ module Steep
|
|
2192
2192
|
if first_param = block.type&.params&.first_param
|
2193
2193
|
var_type = first_param.type #: AST::Types::t
|
2194
2194
|
else
|
2195
|
-
var_type
|
2195
|
+
var_type = AST::Builtin.any_type
|
2196
2196
|
end
|
2197
2197
|
end
|
2198
2198
|
end
|
@@ -5054,7 +5054,7 @@ module Steep
|
|
5054
5054
|
if (type_, constr = yield(type, constr))
|
5055
5055
|
constr.check_relation(sub_type: type_, super_type: type).then do
|
5056
5056
|
constr = constr.save_typing
|
5057
|
-
return Pair.new(type:
|
5057
|
+
return Pair.new(type: type_, constr: constr)
|
5058
5058
|
end
|
5059
5059
|
end
|
5060
5060
|
end
|
@@ -56,9 +56,8 @@ module Steep
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def variable_types
|
59
|
-
each_param.with_object({}) do |param, hash|
|
59
|
+
each_param.with_object({}) do |param, hash| #$ Hash[Symbol, AST::Types::t?]
|
60
60
|
var_name = param.var || next
|
61
|
-
# @type var hash: Hash[Symbol, AST::Types::t?]
|
62
61
|
hash[var_name] = param.type
|
63
62
|
end
|
64
63
|
end
|
@@ -125,7 +125,7 @@ module Steep
|
|
125
125
|
end
|
126
126
|
|
127
127
|
def upper_bounds
|
128
|
-
@upper_bounds ||= table.each_value.with_object({}) do |type_param, bounds|
|
128
|
+
@upper_bounds ||= table.each_value.with_object({}) do |type_param, bounds| #$ Hash[Symbol, AST::Types::t]
|
129
129
|
if type_param.upper_bound
|
130
130
|
bounds[type_param.name] = type_param.upper_bound
|
131
131
|
end
|
@@ -176,7 +176,7 @@ module Steep
|
|
176
176
|
def pin_local_variables(names)
|
177
177
|
names = Set.new(names) if names
|
178
178
|
|
179
|
-
local_variable_types.each.with_object({}) do |pair, hash|
|
179
|
+
local_variable_types.each.with_object({}) do |pair, hash| #$ Hash[Symbol, [AST::Types::t, AST::Types::t?]]
|
180
180
|
name, entry = pair
|
181
181
|
|
182
182
|
local_variable_name!(name)
|
@@ -193,7 +193,7 @@ module Steep
|
|
193
193
|
def unpin_local_variables(names)
|
194
194
|
names = Set.new(names) if names
|
195
195
|
|
196
|
-
local_var_types = local_variable_types.each.with_object({}) do |pair, hash|
|
196
|
+
local_var_types = local_variable_types.each.with_object({}) do |pair, hash| #$ Hash[Symbol, [AST::Types::t, AST::Types::t?]]
|
197
197
|
name, entry = pair
|
198
198
|
|
199
199
|
local_variable_name!(name)
|
@@ -223,7 +223,7 @@ module Steep
|
|
223
223
|
|
224
224
|
def join(*envs)
|
225
225
|
# @type var all_lvar_types: Hash[Symbol, Array[AST::Types::t]]
|
226
|
-
all_lvar_types = envs.each_with_object({}) do |env, hash|
|
226
|
+
all_lvar_types = envs.each_with_object({}) do |env, hash| #$ Hash[Symbol, Array[AST::Types::t]]
|
227
227
|
env.local_variable_types.each_key do |name|
|
228
228
|
hash[name] = []
|
229
229
|
end
|
@@ -244,7 +244,7 @@ module Steep
|
|
244
244
|
.map {|env| Set.new(env.pure_method_calls.each_key) }
|
245
245
|
.inject {|s1, s2| s1.intersection(s2) } || Set[]
|
246
246
|
|
247
|
-
pure_call_updates = common_pure_nodes.each_with_object({}) do |node, hash|
|
247
|
+
pure_call_updates = common_pure_nodes.each_with_object({}) do |node, hash| #$ Hash[Parser::AST::Node, [MethodCall::Typed, AST::Types::t]]
|
248
248
|
pairs = envs.map {|env| env.pure_method_calls[node] }
|
249
249
|
refined_type = AST::Types::Union.build(types: pairs.map {|call, type| type || call.return_type })
|
250
250
|
|
@@ -41,7 +41,7 @@ module Steep
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def call(env)
|
44
|
-
local_variable_types = annotations.var_type_annotations.each.with_object({}) do |pair, hash|
|
44
|
+
local_variable_types = annotations.var_type_annotations.each.with_object({}) do |pair, hash| #$ Hash[Symbol, [AST::Types::t, AST::Types::t]]
|
45
45
|
name, annotation = pair
|
46
46
|
annotation_type = annotations.absolute_type(annotation.type) || annotation.type
|
47
47
|
|
data/lib/steep/version.rb
CHANGED
data/lib/steep.rb
CHANGED
@@ -125,12 +125,15 @@ require "steep/server/base_worker"
|
|
125
125
|
require "steep/server/worker_process"
|
126
126
|
require "steep/server/interaction_worker"
|
127
127
|
require "steep/server/type_check_worker"
|
128
|
+
require "steep/server/target_group_files"
|
129
|
+
require "steep/server/type_check_controller"
|
128
130
|
require "steep/server/master"
|
129
131
|
|
130
132
|
require "steep/project"
|
131
133
|
require "steep/project/pattern"
|
132
134
|
require "steep/project/options"
|
133
135
|
require "steep/project/target"
|
136
|
+
require "steep/project/group"
|
134
137
|
require "steep/project/dsl"
|
135
138
|
|
136
139
|
require "steep/expectations"
|
@@ -139,7 +142,6 @@ require "steep/drivers/utils/jobs_option"
|
|
139
142
|
require "steep/drivers/check"
|
140
143
|
require "steep/drivers/checkfile"
|
141
144
|
require "steep/drivers/stats"
|
142
|
-
require "steep/drivers/validate"
|
143
145
|
require "steep/drivers/annotations"
|
144
146
|
require "steep/drivers/watch"
|
145
147
|
require "steep/drivers/langserver"
|
@@ -289,7 +291,7 @@ end
|
|
289
291
|
|
290
292
|
klasses = [
|
291
293
|
# Steep::Interface::MethodType
|
292
|
-
]
|
294
|
+
] #: Array[Class]
|
293
295
|
|
294
296
|
klasses.each do |klass|
|
295
297
|
klass.instance_eval do
|
@@ -312,7 +314,7 @@ module GCCounter
|
|
312
314
|
ensure
|
313
315
|
Steep.logger.fatal "===== #{title} ==============================="
|
314
316
|
|
315
|
-
klasses = []
|
317
|
+
klasses = [] #: Array[Class]
|
316
318
|
|
317
319
|
ObjectSpace.each_object(Class) do |klass|
|
318
320
|
if (klass.name || "") =~ regexp
|
@@ -320,7 +322,7 @@ module GCCounter
|
|
320
322
|
end
|
321
323
|
end
|
322
324
|
|
323
|
-
before = {}
|
325
|
+
before = {} #: Hash[Class, Integer]
|
324
326
|
|
325
327
|
klasses.each do |klass|
|
326
328
|
count = ObjectSpace.each_object(klass).count
|
data/sample/Steepfile
CHANGED
data/sample/lib/conference.rb
CHANGED
@@ -11,19 +11,16 @@ end
|
|
11
11
|
|
12
12
|
Conference.new()
|
13
13
|
|
14
|
-
|
15
|
-
Konference
|
16
|
-
|
17
14
|
Konference.new()
|
18
15
|
|
19
16
|
|
17
|
+
|
20
18
|
# @type var foo: Konference
|
21
19
|
|
22
20
|
foo = Conference.new
|
23
21
|
|
24
22
|
class Conference12
|
25
23
|
class Integer
|
26
|
-
|
27
24
|
end
|
28
25
|
end
|
29
26
|
|
@@ -34,6 +31,5 @@ class HogeHoge
|
|
34
31
|
end
|
35
32
|
|
36
33
|
|
37
|
-
|
38
34
|
conference = nil #: Conference?
|
39
35
|
|
data/steep.gemspec
CHANGED
@@ -29,6 +29,12 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ["lib"]
|
31
31
|
|
32
|
+
if false
|
33
|
+
# This is to let dependabot use 3.3, instead of 3.1.x.
|
34
|
+
# They use `required_ruby_version=` method to detect the Ruby version they use.
|
35
|
+
spec.required_ruby_version = ">= 3.3.0"
|
36
|
+
end
|
37
|
+
|
32
38
|
spec.required_ruby_version = '>= 3.1.0'
|
33
39
|
|
34
40
|
spec.add_runtime_dependency "parser", ">= 3.1"
|
@@ -36,7 +42,7 @@ Gem::Specification.new do |spec|
|
|
36
42
|
spec.add_runtime_dependency "rainbow", ">= 2.2.2", "< 4.0"
|
37
43
|
spec.add_runtime_dependency "listen", "~> 3.0"
|
38
44
|
spec.add_runtime_dependency "language_server-protocol", ">= 3.15", "< 4.0"
|
39
|
-
spec.add_runtime_dependency "rbs", "~> 3.
|
45
|
+
spec.add_runtime_dependency "rbs", "~> 3.7.0.dev"
|
40
46
|
spec.add_runtime_dependency "concurrent-ruby", ">= 1.1.10"
|
41
47
|
spec.add_runtime_dependency "terminal-table", ">= 2", "< 4"
|
42
48
|
spec.add_runtime_dependency "securerandom", ">= 0.1"
|