steep 1.3.0 → 1.4.0.dev.2

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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-windows.yml +1 -0
  3. data/.github/workflows/ruby.yml +1 -5
  4. data/Gemfile +3 -1
  5. data/Gemfile.lock +22 -19
  6. data/Gemfile.steep +2 -1
  7. data/Gemfile.steep.lock +18 -14
  8. data/Steepfile +16 -0
  9. data/bin/rbs +21 -0
  10. data/bin/setup +1 -1
  11. data/lib/steep/annotation_parser.rb +40 -20
  12. data/lib/steep/ast/types/factory.rb +56 -10
  13. data/lib/steep/ast/types/name.rb +10 -0
  14. data/lib/steep/diagnostic/ruby.rb +1 -1
  15. data/lib/steep/diagnostic/signature.rb +40 -0
  16. data/lib/steep/index/rbs_index.rb +25 -9
  17. data/lib/steep/index/signature_symbol_provider.rb +1 -1
  18. data/lib/steep/project/dsl.rb +12 -4
  19. data/lib/steep/project/options.rb +3 -1
  20. data/lib/steep/project/target.rb +1 -3
  21. data/lib/steep/server/interaction_worker.rb +37 -20
  22. data/lib/steep/server/lsp_formatter.rb +14 -5
  23. data/lib/steep/services/completion_provider.rb +10 -12
  24. data/lib/steep/services/goto_service.rb +15 -14
  25. data/lib/steep/services/hover_provider/rbs.rb +29 -9
  26. data/lib/steep/services/hover_provider/ruby.rb +16 -10
  27. data/lib/steep/services/signature_service.rb +36 -39
  28. data/lib/steep/signature/validator.rb +28 -6
  29. data/lib/steep/subtyping/check.rb +1 -1
  30. data/lib/steep/type_construction.rb +16 -14
  31. data/lib/steep/type_inference/constant_env.rb +7 -3
  32. data/lib/steep/version.rb +1 -1
  33. data/rbs_collection.steep.lock.yaml +48 -51
  34. data/rbs_collection.steep.yaml +3 -1
  35. data/sample/lib/conference.rb +10 -0
  36. data/sample/sig/conference.rbs +23 -0
  37. data/sig/steep/annotation_parser.rbs +3 -2
  38. data/sig/steep/ast/annotation/collection.rbs +1 -1
  39. data/sig/steep/ast/types/factory.rbs +2 -0
  40. data/sig/steep/ast/types/name.rbs +4 -0
  41. data/sig/steep/diagnostic/signature.rbs +18 -14
  42. data/sig/steep/index/rbs_index.rbs +92 -42
  43. data/sig/steep/project/dsl.rbs +35 -30
  44. data/sig/steep/project/options.rbs +16 -4
  45. data/sig/steep/project/target.rbs +7 -7
  46. data/sig/steep/server/interaction_worker.rbs +2 -2
  47. data/sig/steep/server/lsp_formatter.rbs +4 -2
  48. data/sig/steep/services/completion_provider.rbs +6 -0
  49. data/sig/steep/services/hover_provider/rbs.rbs +6 -4
  50. data/sig/steep/services/hover_provider/ruby.rbs +8 -4
  51. data/sig/steep/services/signature_service.rbs +27 -3
  52. data/sig/steep/signature/validator.rbs +9 -5
  53. data/sig/steep/type_construction.rbs +1 -1
  54. data/sig/steep/type_inference/constant_env.rbs +2 -0
  55. data/smoke/diagnostics-rbs/test_expectations.yml +1 -1
  56. data/smoke/regexp/a.rb +2 -2
  57. data/steep.gemspec +2 -1
  58. metadata +21 -6
@@ -75,7 +75,7 @@ module Steep
75
75
  end
76
76
  end
77
77
 
78
- FileStatus = _ = Struct.new(:path, :content, :decls, keyword_init: true)
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] = begin
162
- FileStatus.new(path: path, content: content, decls: RBS::Parser.parse_signature(buffer))
163
- rescue ArgumentError => exn
164
- error = Diagnostic::Signature::UnexpectedError.new(
165
- message: exn.message,
166
- location: RBS::Location.new(buffer: buffer, start_pos: 0, end_pos: content.size)
167
- )
168
- FileStatus.new(path: path, content: content, decls: error)
169
- rescue RBS::ParsingError => exn
170
- FileStatus.new(path: path, content: content, decls: exn)
171
- end
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.decls.is_a?(Array) }
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.decls.is_a?(Array)
189
- diagnostic = if file.decls.is_a?(Diagnostic::Signature::Base)
190
- file.decls
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.decls, factory: _ = nil)
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.each_with_object({}) do |path, hash|
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
- # @type var errors: Array[RBS::BaseError]
234
- errors = []
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.reject do |decl|
240
- if decl.location
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 decls = content.decls
249
- when RBS::BaseError
250
- errors << decls
244
+ case content.signature
245
+ when RBS::ParsingError
246
+ errors << content.signature
251
247
  when Diagnostic::Signature::UnexpectedError
252
- return [decls]
248
+ return [content.signature]
253
249
  else
254
250
  begin
255
- decls.each do |decl|
256
- env << decl
257
- new_decls << decl
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::Alias
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.from_env(env)
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.alias_decls[type.name]
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 type, context: [RBS::Namespace.root]
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 validate_one_class(name)
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.alias_decls[name])
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.alias_decls.each do |name, entry|
538
+ env.type_alias_decls.each do |name, entry|
517
539
  validate_one_alias(name, entry)
518
540
  end
519
541
  end
@@ -619,7 +619,7 @@ module Steep
619
619
  return true
620
620
  end
621
621
 
622
- relation.sub_type == relation.super_type
622
+ builder.factory.normalize_type(relation.sub_type) == builder.factory.normalize_type(relation.super_type)
623
623
  end
624
624
 
625
625
  def check_interface(relation)
@@ -135,8 +135,8 @@ module Steep
135
135
  checker.check(
136
136
  relation,
137
137
  self_type: self_type,
138
- instance_type: module_context.instance_type,
139
- class_type: module_context.module_type,
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 && entry = checker.factory.env.class_decls[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: entry.type_params.each.map(&:name)
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.class_decls[implement_module_name.name]
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.class_decls[type_name]
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 result = no_subtyping?(sub_type: type, super_type: actual_type)
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
- member_decl_count = checker.factory.env.class_decls[module_name_1].decls.count {|d| d.decl.each_member.count > 0 }
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.class_decls[type.name].type_params.each.map { AST::Builtin.any_type }
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).transform_values {|c| decompose_constant(c) }
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,3 +1,3 @@
1
1
  module Steep
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0.dev.2"
3
3
  end
@@ -1,29 +1,18 @@
1
1
  ---
2
2
  sources:
3
- - name: ruby/gem_rbs_collection
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: '6.0'
11
+ version: '7.0'
23
12
  source:
24
13
  type: git
25
14
  name: ruby/gem_rbs_collection
26
- revision: 94fcc911186b127cffdfd7a378b5e0b511196089
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: 94fcc911186b127cffdfd7a378b5e0b511196089
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: 94fcc911186b127cffdfd7a378b5e0b511196089
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: 94fcc911186b127cffdfd7a378b5e0b511196089
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: 94fcc911186b127cffdfd7a378b5e0b511196089
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: 94fcc911186b127cffdfd7a378b5e0b511196089
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: strscan
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: mutex_m
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
@@ -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: main
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
@@ -10,3 +10,13 @@ class Conference
10
10
  end
11
11
 
12
12
  Conference.new()
13
+
14
+
15
+ Konference
16
+
17
+ Konference.new()
18
+
19
+
20
+ # @type var foo: Konference
21
+
22
+ foo = Conference.new
@@ -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], ?exn: Exception?) -> void
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: (String) -> AST::Types::t
34
+ def parse_type: (MatchData, ?Symbol, location: RBS::Location[untyped, untyped]) -> AST::Types::t
34
35
 
35
36
  # ```
36
37
  # @type ${keyword} ${name}: ${type}
@@ -26,7 +26,7 @@ module Steep
26
26
 
27
27
  attr_reader module_type_annotation: untyped
28
28
 
29
- attr_reader implement_module_annotation: untyped
29
+ attr_reader implement_module_annotation: Implements?
30
30
 
31
31
  attr_reader dynamic_annotations: untyped
32
32
 
@@ -74,6 +74,8 @@ module Steep
74
74
  def try_singleton_type: (t) -> t?
75
75
 
76
76
  def try_instance_type: (t) -> t?
77
+
78
+ def normalize_type: (t) -> t
77
79
  end
78
80
  end
79
81
  end
@@ -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