steep 1.3.0 → 1.4.0.dev.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby-windows.yml +1 -0
- data/.github/workflows/ruby.yml +1 -5
- data/Gemfile +3 -1
- data/Gemfile.lock +22 -19
- data/Gemfile.steep +2 -1
- data/Gemfile.steep.lock +18 -14
- data/Steepfile +16 -0
- data/bin/rbs +21 -0
- data/bin/setup +1 -1
- data/lib/steep/annotation_parser.rb +40 -20
- data/lib/steep/ast/types/factory.rb +56 -10
- data/lib/steep/ast/types/name.rb +10 -0
- data/lib/steep/diagnostic/ruby.rb +1 -1
- data/lib/steep/diagnostic/signature.rb +40 -0
- data/lib/steep/index/rbs_index.rb +25 -9
- data/lib/steep/index/signature_symbol_provider.rb +1 -1
- data/lib/steep/project/dsl.rb +12 -4
- data/lib/steep/project/options.rb +3 -1
- data/lib/steep/project/target.rb +1 -3
- data/lib/steep/server/interaction_worker.rb +37 -20
- data/lib/steep/server/lsp_formatter.rb +14 -5
- data/lib/steep/services/completion_provider.rb +10 -12
- data/lib/steep/services/goto_service.rb +15 -14
- data/lib/steep/services/hover_provider/rbs.rb +29 -9
- data/lib/steep/services/hover_provider/ruby.rb +16 -10
- data/lib/steep/services/signature_service.rb +36 -39
- data/lib/steep/signature/validator.rb +28 -6
- data/lib/steep/subtyping/check.rb +1 -1
- data/lib/steep/type_construction.rb +16 -14
- data/lib/steep/type_inference/constant_env.rb +7 -3
- data/lib/steep/version.rb +1 -1
- data/rbs_collection.steep.lock.yaml +48 -51
- data/rbs_collection.steep.yaml +3 -1
- data/sample/lib/conference.rb +10 -0
- data/sample/sig/conference.rbs +23 -0
- data/sig/steep/annotation_parser.rbs +3 -2
- data/sig/steep/ast/annotation/collection.rbs +1 -1
- data/sig/steep/ast/types/factory.rbs +2 -0
- data/sig/steep/ast/types/name.rbs +4 -0
- data/sig/steep/diagnostic/signature.rbs +18 -14
- data/sig/steep/index/rbs_index.rbs +92 -42
- data/sig/steep/project/dsl.rbs +35 -30
- data/sig/steep/project/options.rbs +16 -4
- data/sig/steep/project/target.rbs +7 -7
- data/sig/steep/server/interaction_worker.rbs +2 -2
- data/sig/steep/server/lsp_formatter.rbs +4 -2
- data/sig/steep/services/completion_provider.rbs +6 -0
- data/sig/steep/services/hover_provider/rbs.rbs +6 -4
- data/sig/steep/services/hover_provider/ruby.rbs +8 -4
- data/sig/steep/services/signature_service.rbs +27 -3
- data/sig/steep/signature/validator.rbs +9 -5
- data/sig/steep/type_construction.rbs +1 -1
- data/sig/steep/type_inference/constant_env.rbs +2 -0
- data/smoke/diagnostics-rbs/test_expectations.yml +1 -1
- data/smoke/regexp/a.rb +2 -2
- data/steep.gemspec +2 -1
- metadata +21 -6
@@ -75,7 +75,7 @@ module Steep
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
FileStatus = _ = Struct.new(:path, :content, :
|
78
|
+
FileStatus = _ = Struct.new(:path, :content, :signature, keyword_init: true)
|
79
79
|
|
80
80
|
def initialize(env:)
|
81
81
|
builder = RBS::DefinitionBuilder.new(env: env)
|
@@ -150,7 +150,7 @@ module Steep
|
|
150
150
|
def apply_changes(files, changes)
|
151
151
|
Steep.logger.tagged "#apply_changes" do
|
152
152
|
Steep.measure2 "Applying change" do |sampler|
|
153
|
-
changes.each.with_object({}) do |pair, update|
|
153
|
+
changes.each.with_object({}) do |pair, update| # $ Hash[Pathname, FileStatus]
|
154
154
|
path, cs = pair
|
155
155
|
sampler.sample "#{path}" do
|
156
156
|
old_text = files[path]&.content
|
@@ -158,17 +158,18 @@ module Steep
|
|
158
158
|
|
159
159
|
buffer = RBS::Buffer.new(name: path, content: content)
|
160
160
|
|
161
|
-
update[path] =
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
161
|
+
update[path] =
|
162
|
+
begin
|
163
|
+
FileStatus.new(path: path, content: content, signature: RBS::Parser.parse_signature(buffer))
|
164
|
+
rescue ArgumentError => exn
|
165
|
+
error = Diagnostic::Signature::UnexpectedError.new(
|
166
|
+
message: exn.message,
|
167
|
+
location: RBS::Location.new(buffer: buffer, start_pos: 0, end_pos: content.size)
|
168
|
+
)
|
169
|
+
FileStatus.new(path: path, content: content, signature: error)
|
170
|
+
rescue RBS::ParsingError => exn
|
171
|
+
FileStatus.new(path: path, content: content, signature: exn)
|
172
|
+
end
|
172
173
|
end
|
173
174
|
end
|
174
175
|
end
|
@@ -181,16 +182,16 @@ module Steep
|
|
181
182
|
paths = Set.new(updates.each_key)
|
182
183
|
paths.merge(pending_changed_paths)
|
183
184
|
|
184
|
-
if updates.each_value.any? {|file| !file.
|
185
|
-
diagnostics = []
|
185
|
+
if updates.each_value.any? {|file| !file.signature.is_a?(Array) }
|
186
|
+
diagnostics = [] #: Array[Diagnostic::Signature::Base]
|
186
187
|
|
187
188
|
updates.each_value do |file|
|
188
|
-
unless file.
|
189
|
-
diagnostic = if file.
|
190
|
-
file.
|
189
|
+
unless file.signature.is_a?(Array)
|
190
|
+
diagnostic = if file.signature.is_a?(Diagnostic::Signature::Base)
|
191
|
+
file.signature
|
191
192
|
else
|
192
193
|
# factory is not used here because the error is a syntax error.
|
193
|
-
Diagnostic::Signature.from_rbs_error(file.
|
194
|
+
Diagnostic::Signature.from_rbs_error(file.signature, factory: _ = nil)
|
194
195
|
end
|
195
196
|
diagnostics << diagnostic
|
196
197
|
end
|
@@ -204,9 +205,7 @@ module Steep
|
|
204
205
|
)
|
205
206
|
else
|
206
207
|
files = self.files.merge(updates)
|
207
|
-
updated_files = paths.
|
208
|
-
hash[path] = files[path]
|
209
|
-
end
|
208
|
+
updated_files = files.slice(*paths.to_a)
|
210
209
|
result =
|
211
210
|
Steep.measure "#update_env with updated #{paths.size} files" do
|
212
211
|
update_env(updated_files, paths: paths)
|
@@ -229,33 +228,29 @@ module Steep
|
|
229
228
|
end
|
230
229
|
|
231
230
|
def update_env(updated_files, paths:)
|
231
|
+
|
232
232
|
Steep.logger.tagged "#update_env" do
|
233
|
-
|
234
|
-
|
235
|
-
new_decls = Set[].compare_by_identity
|
233
|
+
errors = [] #: Array[RBS::BaseError]
|
234
|
+
new_decls = Set[].compare_by_identity #: Set[RBS::AST::Declarations::t]
|
236
235
|
|
237
236
|
env =
|
238
237
|
Steep.measure "Deleting out of date decls" do
|
239
|
-
latest_env.
|
240
|
-
|
241
|
-
paths.include?(decl.location.buffer.name)
|
242
|
-
end
|
243
|
-
end
|
238
|
+
bufs = latest_env.buffers.select {|buf| paths.include?(buf.name) }
|
239
|
+
latest_env.unload(Set.new(bufs))
|
244
240
|
end
|
245
241
|
|
246
242
|
Steep.measure "Loading new decls" do
|
247
243
|
updated_files.each_value do |content|
|
248
|
-
case
|
249
|
-
when RBS::
|
250
|
-
errors <<
|
244
|
+
case content.signature
|
245
|
+
when RBS::ParsingError
|
246
|
+
errors << content.signature
|
251
247
|
when Diagnostic::Signature::UnexpectedError
|
252
|
-
return [
|
248
|
+
return [content.signature]
|
253
249
|
else
|
254
250
|
begin
|
255
|
-
decls
|
256
|
-
|
257
|
-
|
258
|
-
end
|
251
|
+
buffer, dirs, decls = content.signature
|
252
|
+
env.add_signature(buffer: buffer, directives: dirs, decls: decls)
|
253
|
+
new_decls.merge(decls)
|
259
254
|
rescue RBS::LoadingError => exn
|
260
255
|
errors << exn
|
261
256
|
end
|
@@ -375,8 +370,10 @@ module Steep
|
|
375
370
|
type_name_from_decl(member, set: set)
|
376
371
|
end
|
377
372
|
end
|
378
|
-
when RBS::AST::Declarations::
|
373
|
+
when RBS::AST::Declarations::TypeAlias
|
379
374
|
set << decl.name
|
375
|
+
when RBS::AST::Declarations::ClassAlias, RBS::AST::Declarations::ModuleAlias
|
376
|
+
set << decl.new_name
|
380
377
|
end
|
381
378
|
end
|
382
379
|
|
@@ -36,7 +36,7 @@ module Steep
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def type_name_resolver
|
39
|
-
@type_name_resolver ||= RBS::TypeNameResolver.
|
39
|
+
@type_name_resolver ||= RBS::Resolver::TypeNameResolver.new(env)
|
40
40
|
end
|
41
41
|
|
42
42
|
def validator
|
@@ -112,7 +112,7 @@ module Steep
|
|
112
112
|
type.args
|
113
113
|
]
|
114
114
|
when RBS::Types::Alias
|
115
|
-
entry = env.
|
115
|
+
entry = env.type_alias_decls[type.name]
|
116
116
|
|
117
117
|
[
|
118
118
|
type.name,
|
@@ -135,7 +135,7 @@ module Steep
|
|
135
135
|
def validate_type(type)
|
136
136
|
Steep.logger.debug "#{Location.to_string type.location}: Validating #{type}..."
|
137
137
|
|
138
|
-
validator.validate_type
|
138
|
+
validator.validate_type(type, context: nil)
|
139
139
|
validate_type_application(type)
|
140
140
|
end
|
141
141
|
|
@@ -235,7 +235,7 @@ module Steep
|
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
238
|
-
def
|
238
|
+
def validate_one_class_decl(name)
|
239
239
|
rescue_validation_errors(name) do
|
240
240
|
Steep.logger.debug { "Validating class definition `#{name}`..." }
|
241
241
|
|
@@ -390,6 +390,17 @@ module Steep
|
|
390
390
|
end
|
391
391
|
end
|
392
392
|
|
393
|
+
def validate_one_class(name)
|
394
|
+
entry = env.constant_entry(name)
|
395
|
+
|
396
|
+
case entry
|
397
|
+
when RBS::Environment::ClassEntry, RBS::Environment::ModuleEntry
|
398
|
+
validate_one_class_decl(name)
|
399
|
+
when RBS::Environment::ClassAliasEntry, RBS::Environment::ModuleAliasEntry
|
400
|
+
validate_one_class_alias(name, entry)
|
401
|
+
end
|
402
|
+
end
|
403
|
+
|
393
404
|
def validate_ancestor_application(name, ancestor)
|
394
405
|
unless ancestor.args.empty?
|
395
406
|
definition =
|
@@ -465,6 +476,10 @@ module Steep
|
|
465
476
|
validate_one_class(name)
|
466
477
|
end
|
467
478
|
|
479
|
+
env.class_alias_decls.each do |name, entry|
|
480
|
+
validate_one_class_alias(name, entry)
|
481
|
+
end
|
482
|
+
|
468
483
|
env.interface_decls.each_key do |name|
|
469
484
|
validate_one_interface(name)
|
470
485
|
end
|
@@ -497,7 +512,7 @@ module Steep
|
|
497
512
|
end
|
498
513
|
end
|
499
514
|
|
500
|
-
def validate_one_alias(name, entry = env.
|
515
|
+
def validate_one_alias(name, entry = env.type_alias_decls[name])
|
501
516
|
rescue_validation_errors(name) do
|
502
517
|
Steep.logger.debug "Validating alias `#{name}`..."
|
503
518
|
upper_bounds = entry.decl.type_params.each.with_object({}) do |param, bounds|
|
@@ -512,8 +527,15 @@ module Steep
|
|
512
527
|
end
|
513
528
|
end
|
514
529
|
|
530
|
+
def validate_one_class_alias(name, entry)
|
531
|
+
rescue_validation_errors(name) do
|
532
|
+
Steep.logger.debug "Validating class/module alias `#{name}`..."
|
533
|
+
validator.validate_class_alias(entry: entry)
|
534
|
+
end
|
535
|
+
end
|
536
|
+
|
515
537
|
def validate_alias
|
516
|
-
env.
|
538
|
+
env.type_alias_decls.each do |name, entry|
|
517
539
|
validate_one_alias(name, entry)
|
518
540
|
end
|
519
541
|
end
|
@@ -135,8 +135,8 @@ module Steep
|
|
135
135
|
checker.check(
|
136
136
|
relation,
|
137
137
|
self_type: self_type,
|
138
|
-
instance_type: module_context
|
139
|
-
class_type: module_context
|
138
|
+
instance_type: module_context!.instance_type,
|
139
|
+
class_type: module_context!.module_type,
|
140
140
|
constraints: constraints
|
141
141
|
)
|
142
142
|
end
|
@@ -295,10 +295,12 @@ module Steep
|
|
295
295
|
else
|
296
296
|
name = module_name || super_name
|
297
297
|
|
298
|
-
if name &&
|
298
|
+
if name && checker.factory.env.module_name?(name)
|
299
|
+
definition = checker.factory.definition_builder.build_instance(name)
|
300
|
+
|
299
301
|
AST::Annotation::Implements::Module.new(
|
300
302
|
name: name,
|
301
|
-
args:
|
303
|
+
args: definition.type_params
|
302
304
|
)
|
303
305
|
end
|
304
306
|
end
|
@@ -338,7 +340,7 @@ module Steep
|
|
338
340
|
end
|
339
341
|
|
340
342
|
def for_module(node, new_module_name)
|
341
|
-
new_nesting = [nesting, new_module_name || false]
|
343
|
+
new_nesting = [nesting, new_module_name || false] #: RBS::Resolver::context
|
342
344
|
|
343
345
|
annots = source.annotations(block: node, factory: checker.factory, context: new_nesting)
|
344
346
|
|
@@ -353,9 +355,7 @@ module Steep
|
|
353
355
|
end
|
354
356
|
|
355
357
|
if implement_module_name
|
356
|
-
module_entry = checker.factory.definition_builder.env.
|
357
|
-
|
358
|
-
raise unless module_entry.is_a?(RBS::Environment::ModuleEntry)
|
358
|
+
module_entry = checker.factory.definition_builder.env.normalized_module_entry(implement_module_name.name) or raise
|
359
359
|
|
360
360
|
module_context = module_context.update(
|
361
361
|
instance_type: AST::Types::Intersection.build(
|
@@ -566,10 +566,10 @@ module Steep
|
|
566
566
|
when AST::Types::Name::Singleton
|
567
567
|
type_name = instance_type.name
|
568
568
|
|
569
|
-
case checker.factory.env.
|
570
|
-
when RBS::Environment::ModuleEntry
|
569
|
+
case checker.factory.env.constant_entry(type_name)
|
570
|
+
when RBS::Environment::ModuleEntry, RBS::Environment::ModuleAliasEntry
|
571
571
|
AST::Builtin::Module.instance_type
|
572
|
-
when RBS::Environment::ClassEntry
|
572
|
+
when RBS::Environment::ClassEntry, RBS::Environment::ClassAliasEntry
|
573
573
|
AST::Builtin::Class.instance_type
|
574
574
|
else
|
575
575
|
raise
|
@@ -2399,7 +2399,7 @@ module Steep
|
|
2399
2399
|
if type = as_type.type?(module_context!.nesting, checker.factory, [])
|
2400
2400
|
actual_type, constr = synthesize(asserted_node, hint: type)
|
2401
2401
|
|
2402
|
-
if
|
2402
|
+
if no_subtyping?(sub_type: type, super_type: actual_type) && no_subtyping?(sub_type: actual_type, super_type: type)
|
2403
2403
|
typing.add_error(
|
2404
2404
|
Diagnostic::Ruby::FalseAssertion.new(
|
2405
2405
|
node: node,
|
@@ -4098,7 +4098,8 @@ module Steep
|
|
4098
4098
|
|
4099
4099
|
def validate_method_definitions(node, module_name)
|
4100
4100
|
module_name_1 = module_name.name
|
4101
|
-
|
4101
|
+
module_entry = checker.factory.env.normalized_module_class_entry(module_name_1) or raise
|
4102
|
+
member_decl_count = module_entry.decls.count {|d| d.decl.each_member.count > 0 }
|
4102
4103
|
|
4103
4104
|
return unless member_decl_count == 1
|
4104
4105
|
|
@@ -4267,7 +4268,8 @@ module Steep
|
|
4267
4268
|
def to_instance_type(type, args: nil)
|
4268
4269
|
args = args || case type
|
4269
4270
|
when AST::Types::Name::Singleton
|
4270
|
-
checker.factory.env.
|
4271
|
+
decl = checker.factory.env.normalized_module_class_entry(type.name) or raise
|
4272
|
+
decl.type_params.each.map { AST::Builtin.any_type }
|
4271
4273
|
else
|
4272
4274
|
raise "unexpected type to to_instance_type: #{type}"
|
4273
4275
|
end
|
@@ -6,7 +6,6 @@ module Steep
|
|
6
6
|
attr_reader :resolver
|
7
7
|
|
8
8
|
def initialize(factory:, context:, resolver:)
|
9
|
-
@cache = {}
|
10
9
|
@factory = factory
|
11
10
|
@context = context
|
12
11
|
@resolver = resolver
|
@@ -25,7 +24,8 @@ module Steep
|
|
25
24
|
end
|
26
25
|
|
27
26
|
def constants
|
28
|
-
resolver.constants(context)
|
27
|
+
cs = resolver.constants(context) or raise
|
28
|
+
cs.transform_values {|c| decompose_constant!(c) }
|
29
29
|
end
|
30
30
|
|
31
31
|
def resolve_child(module_name, constant_name)
|
@@ -35,7 +35,11 @@ module Steep
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def children(module_name)
|
38
|
-
resolver.children(module_name).transform_values {|c| decompose_constant(c) }
|
38
|
+
resolver.children(module_name).transform_values {|c| decompose_constant!(c) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def decompose_constant!(constant)
|
42
|
+
decompose_constant(constant) || raise
|
39
43
|
end
|
40
44
|
|
41
45
|
def decompose_constant(constant)
|
data/lib/steep/version.rb
CHANGED
@@ -1,29 +1,18 @@
|
|
1
1
|
---
|
2
2
|
sources:
|
3
|
-
-
|
3
|
+
- type: git
|
4
|
+
name: ruby/gem_rbs_collection
|
5
|
+
revision: c42c09528dd99252db98f0744181a6de54ec2f55
|
4
6
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
5
|
-
revision: main
|
6
7
|
repo_dir: gems
|
7
8
|
path: ".gem_rbs_collection"
|
8
9
|
gems:
|
9
|
-
- name: set
|
10
|
-
version: '0'
|
11
|
-
source:
|
12
|
-
type: stdlib
|
13
|
-
- name: rbs
|
14
|
-
version: 2.8.0
|
15
|
-
source:
|
16
|
-
type: rubygems
|
17
|
-
- name: dbm
|
18
|
-
version: '0'
|
19
|
-
source:
|
20
|
-
type: stdlib
|
21
10
|
- name: activesupport
|
22
|
-
version: '
|
11
|
+
version: '7.0'
|
23
12
|
source:
|
24
13
|
type: git
|
25
14
|
name: ruby/gem_rbs_collection
|
26
|
-
revision:
|
15
|
+
revision: c42c09528dd99252db98f0744181a6de54ec2f55
|
27
16
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
28
17
|
repo_dir: gems
|
29
18
|
- name: ast
|
@@ -31,23 +20,43 @@ gems:
|
|
31
20
|
source:
|
32
21
|
type: git
|
33
22
|
name: ruby/gem_rbs_collection
|
34
|
-
revision:
|
23
|
+
revision: c42c09528dd99252db98f0744181a6de54ec2f55
|
24
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
25
|
+
repo_dir: gems
|
26
|
+
- name: concurrent-ruby
|
27
|
+
version: '1.1'
|
28
|
+
source:
|
29
|
+
type: git
|
30
|
+
name: ruby/gem_rbs_collection
|
31
|
+
revision: c42c09528dd99252db98f0744181a6de54ec2f55
|
35
32
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
36
33
|
repo_dir: gems
|
37
34
|
- name: csv
|
38
35
|
version: '0'
|
39
36
|
source:
|
40
37
|
type: stdlib
|
38
|
+
- name: date
|
39
|
+
version: '0'
|
40
|
+
source:
|
41
|
+
type: stdlib
|
42
|
+
- name: dbm
|
43
|
+
version: '0'
|
44
|
+
source:
|
45
|
+
type: stdlib
|
41
46
|
- name: fileutils
|
42
47
|
version: '0'
|
43
48
|
source:
|
44
49
|
type: stdlib
|
50
|
+
- name: forwardable
|
51
|
+
version: '0'
|
52
|
+
source:
|
53
|
+
type: stdlib
|
45
54
|
- name: i18n
|
46
55
|
version: '1.10'
|
47
56
|
source:
|
48
57
|
type: git
|
49
58
|
name: ruby/gem_rbs_collection
|
50
|
-
revision:
|
59
|
+
revision: c42c09528dd99252db98f0744181a6de54ec2f55
|
51
60
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
52
61
|
repo_dir: gems
|
53
62
|
- name: json
|
@@ -59,7 +68,7 @@ gems:
|
|
59
68
|
source:
|
60
69
|
type: git
|
61
70
|
name: ruby/gem_rbs_collection
|
62
|
-
revision:
|
71
|
+
revision: c42c09528dd99252db98f0744181a6de54ec2f55
|
63
72
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
64
73
|
repo_dir: gems
|
65
74
|
- name: logger
|
@@ -70,51 +79,43 @@ gems:
|
|
70
79
|
version: '0'
|
71
80
|
source:
|
72
81
|
type: stdlib
|
82
|
+
- name: monitor
|
83
|
+
version: '0'
|
84
|
+
source:
|
85
|
+
type: stdlib
|
86
|
+
- name: mutex_m
|
87
|
+
version: '0'
|
88
|
+
source:
|
89
|
+
type: stdlib
|
90
|
+
- name: optparse
|
91
|
+
version: '0'
|
92
|
+
source:
|
93
|
+
type: stdlib
|
73
94
|
- name: parallel
|
74
95
|
version: '1.20'
|
75
96
|
source:
|
76
97
|
type: git
|
77
98
|
name: ruby/gem_rbs_collection
|
78
|
-
revision:
|
99
|
+
revision: c42c09528dd99252db98f0744181a6de54ec2f55
|
79
100
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
80
101
|
repo_dir: gems
|
102
|
+
- name: pathname
|
103
|
+
version: '0'
|
104
|
+
source:
|
105
|
+
type: stdlib
|
81
106
|
- name: rainbow
|
82
107
|
version: '3.0'
|
83
108
|
source:
|
84
109
|
type: git
|
85
110
|
name: ruby/gem_rbs_collection
|
86
|
-
revision:
|
111
|
+
revision: c42c09528dd99252db98f0744181a6de54ec2f55
|
87
112
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
88
113
|
repo_dir: gems
|
89
114
|
- name: securerandom
|
90
115
|
version: '0'
|
91
116
|
source:
|
92
117
|
type: stdlib
|
93
|
-
- name:
|
94
|
-
version: '0'
|
95
|
-
source:
|
96
|
-
type: stdlib
|
97
|
-
- name: pathname
|
98
|
-
version: '0'
|
99
|
-
source:
|
100
|
-
type: stdlib
|
101
|
-
- name: optparse
|
102
|
-
version: '0'
|
103
|
-
source:
|
104
|
-
type: stdlib
|
105
|
-
- name: tsort
|
106
|
-
version: '0'
|
107
|
-
source:
|
108
|
-
type: stdlib
|
109
|
-
- name: rdoc
|
110
|
-
version: '0'
|
111
|
-
source:
|
112
|
-
type: stdlib
|
113
|
-
- name: monitor
|
114
|
-
version: '0'
|
115
|
-
source:
|
116
|
-
type: stdlib
|
117
|
-
- name: date
|
118
|
+
- name: set
|
118
119
|
version: '0'
|
119
120
|
source:
|
120
121
|
type: stdlib
|
@@ -122,7 +123,7 @@ gems:
|
|
122
123
|
version: '0'
|
123
124
|
source:
|
124
125
|
type: stdlib
|
125
|
-
- name:
|
126
|
+
- name: strscan
|
126
127
|
version: '0'
|
127
128
|
source:
|
128
129
|
type: stdlib
|
@@ -130,8 +131,4 @@ gems:
|
|
130
131
|
version: '0'
|
131
132
|
source:
|
132
133
|
type: stdlib
|
133
|
-
- name: forwardable
|
134
|
-
version: '0'
|
135
|
-
source:
|
136
|
-
type: stdlib
|
137
134
|
gemfile_lock_path: Gemfile.steep.lock
|
data/rbs_collection.steep.yaml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
sources:
|
3
3
|
- name: ruby/gem_rbs_collection
|
4
4
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
5
|
-
revision:
|
5
|
+
revision: c42c09528dd99252db98f0744181a6de54ec2f55
|
6
6
|
repo_dir: gems
|
7
7
|
|
8
8
|
# A directory to install the downloaded RBSs
|
@@ -15,6 +15,8 @@ gems:
|
|
15
15
|
ignore: true
|
16
16
|
- name: set
|
17
17
|
- name: rbs
|
18
|
+
ignore: true
|
18
19
|
- name: with_steep_types
|
19
20
|
ignore: true
|
20
21
|
- name: dbm
|
22
|
+
- name: optparse
|
data/sample/lib/conference.rb
CHANGED
data/sample/sig/conference.rbs
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
use Object as Foo
|
2
|
+
|
1
3
|
class Conference
|
2
4
|
attr_reader title: String
|
3
5
|
attr_reader year: Integer
|
@@ -12,3 +14,24 @@ end
|
|
12
14
|
class Object
|
13
15
|
def must: () -> self
|
14
16
|
end
|
17
|
+
|
18
|
+
# Test data
|
19
|
+
class Konference = Conference
|
20
|
+
|
21
|
+
class Allay = ::Array
|
22
|
+
|
23
|
+
module Hoge = Bazzz
|
24
|
+
|
25
|
+
module Bazzz = Hoge
|
26
|
+
|
27
|
+
class Foo < Konference
|
28
|
+
class OBH = String
|
29
|
+
|
30
|
+
type a = Integer
|
31
|
+
end
|
32
|
+
|
33
|
+
type foo = [Conference, Konference]
|
34
|
+
|
35
|
+
|
36
|
+
type b = ::Foo::OBH
|
37
|
+
|
@@ -19,7 +19,8 @@ module Steep
|
|
19
19
|
|
20
20
|
attr_reader location: RBS::Location[untyped, untyped]
|
21
21
|
|
22
|
-
def initialize: (source: String, location: RBS::Location[untyped, untyped],
|
22
|
+
def initialize: (source: String, location: RBS::Location[untyped, untyped], exn: Exception) -> void
|
23
|
+
| (source: String, location: RBS::Location[untyped, untyped], message: String) -> void
|
23
24
|
end
|
24
25
|
|
25
26
|
TYPE: Regexp
|
@@ -30,7 +31,7 @@ module Steep
|
|
30
31
|
|
31
32
|
TYPE_PARAMS: Regexp
|
32
33
|
|
33
|
-
def parse_type: (
|
34
|
+
def parse_type: (MatchData, ?Symbol, location: RBS::Location[untyped, untyped]) -> AST::Types::t
|
34
35
|
|
35
36
|
# ```
|
36
37
|
# @type ${keyword} ${name}: ${type}
|
@@ -16,6 +16,8 @@ module Steep
|
|
16
16
|
def subst: (Steep::Interface::Substitution s) -> self
|
17
17
|
|
18
18
|
def level: () -> Array[Integer]
|
19
|
+
|
20
|
+
def map_type: () { (t) -> t } -> self
|
19
21
|
end
|
20
22
|
|
21
23
|
class Applying < Base
|
@@ -45,6 +47,8 @@ module Steep
|
|
45
47
|
include Helper::ChildrenLevel
|
46
48
|
|
47
49
|
def level: () -> Array[Integer]
|
50
|
+
|
51
|
+
def map_type: () { (t) -> t } -> self
|
48
52
|
end
|
49
53
|
|
50
54
|
class Singleton < Base
|