ruby-lsp 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +6 -0
  3. data/.rubocop.yml +16 -0
  4. data/CHANGELOG.md +13 -0
  5. data/Gemfile +8 -5
  6. data/Gemfile.lock +55 -10
  7. data/README.md +40 -0
  8. data/VERSION +1 -1
  9. data/bin/tapioca +29 -0
  10. data/dev.yml +3 -0
  11. data/exe/ruby-lsp +19 -4
  12. data/lib/internal.rb +7 -0
  13. data/lib/ruby-lsp.rb +1 -0
  14. data/lib/ruby_lsp/cli.rb +12 -5
  15. data/lib/ruby_lsp/document.rb +37 -14
  16. data/lib/ruby_lsp/handler.rb +78 -23
  17. data/lib/ruby_lsp/requests/base_request.rb +11 -0
  18. data/lib/ruby_lsp/requests/code_actions.rb +1 -0
  19. data/lib/ruby_lsp/requests/diagnostics.rb +1 -0
  20. data/lib/ruby_lsp/requests/document_highlight.rb +96 -0
  21. data/lib/ruby_lsp/requests/document_symbol.rb +1 -10
  22. data/lib/ruby_lsp/requests/folding_ranges.rb +3 -2
  23. data/lib/ruby_lsp/requests/formatting.rb +2 -1
  24. data/lib/ruby_lsp/requests/rubocop_request.rb +1 -0
  25. data/lib/ruby_lsp/requests/selection_ranges.rb +1 -0
  26. data/lib/ruby_lsp/requests/semantic_highlighting.rb +17 -3
  27. data/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb +1 -0
  28. data/lib/ruby_lsp/requests/support/selection_range.rb +1 -0
  29. data/lib/ruby_lsp/requests/support/semantic_token_encoder.rb +12 -1
  30. data/lib/ruby_lsp/requests/support/syntax_error_diagnostic.rb +1 -0
  31. data/lib/ruby_lsp/requests.rb +2 -0
  32. data/lib/ruby_lsp/store.rb +19 -3
  33. data/rakelib/check_docs.rake +4 -1
  34. data/ruby-lsp.gemspec +1 -0
  35. data/sorbet/config +4 -0
  36. data/sorbet/rbi/.rubocop.yml +8 -0
  37. data/sorbet/rbi/gems/ansi@1.5.0.rbi +338 -0
  38. data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
  39. data/sorbet/rbi/gems/builder@3.2.4.rbi +418 -0
  40. data/sorbet/rbi/gems/coderay@1.1.3.rbi +8 -0
  41. data/sorbet/rbi/gems/debug@1.5.0.rbi +1273 -0
  42. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +867 -0
  43. data/sorbet/rbi/gems/io-console@0.5.11.rbi +8 -0
  44. data/sorbet/rbi/gems/irb@1.4.1.rbi +376 -0
  45. data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +7325 -0
  46. data/sorbet/rbi/gems/method_source@1.0.0.rbi +8 -0
  47. data/sorbet/rbi/gems/minitest-reporters@1.5.0.rbi +612 -0
  48. data/sorbet/rbi/gems/minitest@5.15.0.rbi +994 -0
  49. data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
  50. data/sorbet/rbi/gems/parser@3.1.2.0.rbi +3968 -0
  51. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +734 -0
  52. data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
  53. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +227 -0
  54. data/sorbet/rbi/gems/rake@13.0.6.rbi +1853 -0
  55. data/sorbet/rbi/gems/rbi@0.0.14.rbi +2337 -0
  56. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +1854 -0
  57. data/sorbet/rbi/gems/reline@0.3.1.rbi +1274 -0
  58. data/sorbet/rbi/gems/rexml@3.2.5.rbi +3852 -0
  59. data/sorbet/rbi/gems/rubocop-ast@1.18.0.rbi +4180 -0
  60. data/sorbet/rbi/gems/rubocop-minitest@0.20.0.rbi +1369 -0
  61. data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +246 -0
  62. data/sorbet/rbi/gems/rubocop-shopify@2.6.0.rbi +8 -0
  63. data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +652 -0
  64. data/sorbet/rbi/gems/rubocop@1.30.0.rbi +36729 -0
  65. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +732 -0
  66. data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
  67. data/sorbet/rbi/gems/syntax_tree@2.7.1.rbi +6777 -0
  68. data/sorbet/rbi/gems/tapioca@0.8.1.rbi +1972 -0
  69. data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
  70. data/sorbet/rbi/gems/unicode-display_width@2.1.0.rbi +27 -0
  71. data/sorbet/rbi/gems/unparser@0.6.5.rbi +2789 -0
  72. data/sorbet/rbi/gems/webrick@1.7.0.rbi +1779 -0
  73. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +289 -0
  74. data/sorbet/rbi/gems/yard@0.9.27.rbi +13048 -0
  75. data/sorbet/rbi/shims/fiddle.rbi +4 -0
  76. data/sorbet/rbi/shims/hash.rbi +6 -0
  77. data/sorbet/rbi/shims/rdoc.rbi +4 -0
  78. data/sorbet/tapioca/config.yml +13 -0
  79. data/sorbet/tapioca/require.rb +7 -0
  80. metadata +64 -2
@@ -0,0 +1,2337 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `rbi` gem.
5
+ # Please instead update this file by running `bin/tapioca gem rbi`.
6
+
7
+ module RBI; end
8
+
9
+ # @abstract It cannont be directly instantiated. Subclasses must implement the `abstract` methods below.
10
+ class RBI::ASTVisitor
11
+ abstract!
12
+
13
+ def initialize(*args, **_arg1, &blk); end
14
+
15
+ # @abstract
16
+ sig { abstract.params(node: T.nilable(::AST::Node)).void }
17
+ def visit(node); end
18
+
19
+ sig { params(nodes: T::Array[::AST::Node]).void }
20
+ def visit_all(nodes); end
21
+
22
+ private
23
+
24
+ sig { params(node: ::AST::Node).returns(::String) }
25
+ def parse_expr(node); end
26
+
27
+ sig { params(node: ::AST::Node).returns(::String) }
28
+ def parse_name(node); end
29
+ end
30
+
31
+ class RBI::Arg < ::RBI::Node
32
+ sig { params(value: ::String, loc: T.nilable(::RBI::Loc)).void }
33
+ def initialize(value, loc: T.unsafe(nil)); end
34
+
35
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
36
+ def ==(other); end
37
+
38
+ sig { override.params(v: ::RBI::Printer).void }
39
+ def accept_printer(v); end
40
+
41
+ sig { returns(::String) }
42
+ def to_s; end
43
+
44
+ sig { returns(::String) }
45
+ def value; end
46
+ end
47
+
48
+ # Attributes
49
+ #
50
+ # @abstract It cannont be directly instantiated. Subclasses must implement the `abstract` methods below.
51
+ class RBI::Attr < ::RBI::NodeWithComments
52
+ include ::RBI::Indexable
53
+
54
+ abstract!
55
+
56
+ sig do
57
+ params(
58
+ name: ::Symbol,
59
+ names: T::Array[::Symbol],
60
+ visibility: ::RBI::Visibility,
61
+ sigs: T::Array[::RBI::Sig],
62
+ loc: T.nilable(::RBI::Loc),
63
+ comments: T::Array[::RBI::Comment]
64
+ ).void
65
+ end
66
+ def initialize(name, names, visibility: T.unsafe(nil), sigs: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil)); end
67
+
68
+ sig { override.params(v: ::RBI::Printer).void }
69
+ def accept_printer(v); end
70
+
71
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
72
+ def compatible_with?(other); end
73
+
74
+ # @abstract
75
+ sig { abstract.returns(T::Array[::String]) }
76
+ def fully_qualified_names; end
77
+
78
+ sig { override.returns(T::Array[::String]) }
79
+ def index_ids; end
80
+
81
+ sig { override.params(other: ::RBI::Node).void }
82
+ def merge_with(other); end
83
+
84
+ sig { returns(T::Array[::Symbol]) }
85
+ def names; end
86
+
87
+ # @return [Array<Symbol>]
88
+ def names=(_arg0); end
89
+
90
+ sig { override.returns(T::Boolean) }
91
+ def oneline?; end
92
+
93
+ sig { returns(T::Array[::RBI::Sig]) }
94
+ def sigs; end
95
+
96
+ sig { returns(::RBI::Visibility) }
97
+ def visibility; end
98
+
99
+ # @return [Visibility]
100
+ def visibility=(_arg0); end
101
+ end
102
+
103
+ class RBI::AttrAccessor < ::RBI::Attr
104
+ sig do
105
+ params(
106
+ name: ::Symbol,
107
+ names: ::Symbol,
108
+ visibility: ::RBI::Visibility,
109
+ sigs: T::Array[::RBI::Sig],
110
+ loc: T.nilable(::RBI::Loc),
111
+ comments: T::Array[::RBI::Comment],
112
+ block: T.nilable(T.proc.params(node: ::RBI::AttrAccessor).void)
113
+ ).void
114
+ end
115
+ def initialize(name, *names, visibility: T.unsafe(nil), sigs: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
116
+
117
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
118
+ def compatible_with?(other); end
119
+
120
+ sig { override.returns(T::Array[::String]) }
121
+ def fully_qualified_names; end
122
+
123
+ sig { override.returns(::String) }
124
+ def to_s; end
125
+ end
126
+
127
+ class RBI::AttrReader < ::RBI::Attr
128
+ sig do
129
+ params(
130
+ name: ::Symbol,
131
+ names: ::Symbol,
132
+ visibility: ::RBI::Visibility,
133
+ sigs: T::Array[::RBI::Sig],
134
+ loc: T.nilable(::RBI::Loc),
135
+ comments: T::Array[::RBI::Comment],
136
+ block: T.nilable(T.proc.params(node: ::RBI::AttrReader).void)
137
+ ).void
138
+ end
139
+ def initialize(name, *names, visibility: T.unsafe(nil), sigs: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
140
+
141
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
142
+ def compatible_with?(other); end
143
+
144
+ sig { override.returns(T::Array[::String]) }
145
+ def fully_qualified_names; end
146
+
147
+ sig { override.returns(::String) }
148
+ def to_s; end
149
+ end
150
+
151
+ class RBI::AttrWriter < ::RBI::Attr
152
+ sig do
153
+ params(
154
+ name: ::Symbol,
155
+ names: ::Symbol,
156
+ visibility: ::RBI::Visibility,
157
+ sigs: T::Array[::RBI::Sig],
158
+ loc: T.nilable(::RBI::Loc),
159
+ comments: T::Array[::RBI::Comment],
160
+ block: T.nilable(T.proc.params(node: ::RBI::AttrWriter).void)
161
+ ).void
162
+ end
163
+ def initialize(name, *names, visibility: T.unsafe(nil), sigs: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
164
+
165
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
166
+ def compatible_with?(other); end
167
+
168
+ sig { override.returns(T::Array[::String]) }
169
+ def fully_qualified_names; end
170
+
171
+ sig { override.returns(::String) }
172
+ def to_s; end
173
+ end
174
+
175
+ # An arbitrary blank line that can be added both in trees and comments
176
+ class RBI::BlankLine < ::RBI::Comment
177
+ sig { params(loc: T.nilable(::RBI::Loc)).void }
178
+ def initialize(loc: T.unsafe(nil)); end
179
+
180
+ sig { override.params(v: ::RBI::Printer).void }
181
+ def accept_printer(v); end
182
+ end
183
+
184
+ class RBI::BlockParam < ::RBI::Param
185
+ sig do
186
+ params(
187
+ name: ::String,
188
+ loc: T.nilable(::RBI::Loc),
189
+ comments: T::Array[::RBI::Comment],
190
+ block: T.nilable(T.proc.params(node: ::RBI::BlockParam).void)
191
+ ).void
192
+ end
193
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
194
+
195
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
196
+ def ==(other); end
197
+
198
+ sig { override.params(v: ::RBI::Printer).void }
199
+ def accept_printer(v); end
200
+
201
+ sig { override.params(v: ::RBI::Printer, last: T::Boolean).void }
202
+ def print_comment_leading_space(v, last:); end
203
+
204
+ sig { override.returns(::String) }
205
+ def to_s; end
206
+ end
207
+
208
+ class RBI::Class < ::RBI::Scope
209
+ sig do
210
+ params(
211
+ name: ::String,
212
+ superclass_name: T.nilable(::String),
213
+ loc: T.nilable(::RBI::Loc),
214
+ comments: T::Array[::RBI::Comment],
215
+ block: T.nilable(T.proc.params(node: ::RBI::Class).void)
216
+ ).void
217
+ end
218
+ def initialize(name, superclass_name: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
219
+
220
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
221
+ def compatible_with?(other); end
222
+
223
+ sig { override.returns(::String) }
224
+ def fully_qualified_name; end
225
+
226
+ sig { returns(::String) }
227
+ def name; end
228
+
229
+ # @return [String]
230
+ def name=(_arg0); end
231
+
232
+ sig { override.params(v: ::RBI::Printer).void }
233
+ def print_header(v); end
234
+
235
+ sig { returns(T.nilable(::String)) }
236
+ def superclass_name; end
237
+
238
+ # @return [String, nil]
239
+ def superclass_name=(_arg0); end
240
+ end
241
+
242
+ class RBI::Comment < ::RBI::Node
243
+ sig { params(text: ::String, loc: T.nilable(::RBI::Loc)).void }
244
+ def initialize(text, loc: T.unsafe(nil)); end
245
+
246
+ sig { params(other: ::Object).returns(T::Boolean) }
247
+ def ==(other); end
248
+
249
+ sig { override.params(v: ::RBI::Printer).void }
250
+ def accept_printer(v); end
251
+
252
+ sig { returns(::String) }
253
+ def text; end
254
+
255
+ # @return [String]
256
+ def text=(_arg0); end
257
+ end
258
+
259
+ # A tree showing incompatibles nodes
260
+ #
261
+ # Is rendered as a merge conflict between `left` and` right`:
262
+ # ~~~rb
263
+ # class Foo
264
+ # <<<<<<< left
265
+ # def m1; end
266
+ # def m2(a); end
267
+ # =======
268
+ # def m1(a); end
269
+ # def m2; end
270
+ # >>>>>>> right
271
+ # end
272
+ # ~~~
273
+ class RBI::ConflictTree < ::RBI::Tree
274
+ sig { params(left_name: ::String, right_name: ::String).void }
275
+ def initialize(left_name: T.unsafe(nil), right_name: T.unsafe(nil)); end
276
+
277
+ sig { override.params(v: ::RBI::Printer).void }
278
+ def accept_printer(v); end
279
+
280
+ sig { returns(::RBI::Tree) }
281
+ def left; end
282
+
283
+ # @return [Tree]
284
+ def right; end
285
+ end
286
+
287
+ # Consts
288
+ class RBI::Const < ::RBI::NodeWithComments
289
+ include ::RBI::Indexable
290
+
291
+ sig do
292
+ params(
293
+ name: ::String,
294
+ value: ::String,
295
+ loc: T.nilable(::RBI::Loc),
296
+ comments: T::Array[::RBI::Comment],
297
+ block: T.nilable(T.proc.params(node: ::RBI::Const).void)
298
+ ).void
299
+ end
300
+ def initialize(name, value, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
301
+
302
+ sig { override.params(v: ::RBI::Printer).void }
303
+ def accept_printer(v); end
304
+
305
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
306
+ def compatible_with?(other); end
307
+
308
+ sig { returns(::String) }
309
+ def fully_qualified_name; end
310
+
311
+ sig { override.returns(T::Array[::String]) }
312
+ def index_ids; end
313
+
314
+ sig { returns(::String) }
315
+ def name; end
316
+
317
+ sig { override.returns(::String) }
318
+ def to_s; end
319
+
320
+ # @return [String]
321
+ def value; end
322
+ end
323
+
324
+ class RBI::ConstBuilder < ::RBI::ASTVisitor
325
+ sig { void }
326
+ def initialize; end
327
+
328
+ sig { returns(T::Array[::String]) }
329
+ def names; end
330
+
331
+ # @return [Array<String>]
332
+ def names=(_arg0); end
333
+
334
+ sig { override.params(node: T.nilable(::AST::Node)).void }
335
+ def visit(node); end
336
+
337
+ class << self
338
+ sig { params(node: T.nilable(::AST::Node)).returns(T.nilable(::String)) }
339
+ def visit(node); end
340
+ end
341
+ end
342
+
343
+ class RBI::Error < ::StandardError; end
344
+
345
+ class RBI::Extend < ::RBI::Mixin
346
+ include ::RBI::Indexable
347
+
348
+ sig do
349
+ params(
350
+ name: ::String,
351
+ names: ::String,
352
+ loc: T.nilable(::RBI::Loc),
353
+ comments: T::Array[::RBI::Comment],
354
+ block: T.nilable(T.proc.params(node: ::RBI::Extend).void)
355
+ ).void
356
+ end
357
+ def initialize(name, *names, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
358
+
359
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
360
+ def compatible_with?(other); end
361
+
362
+ sig { override.returns(T::Array[::String]) }
363
+ def index_ids; end
364
+
365
+ sig { override.returns(::String) }
366
+ def to_s; end
367
+ end
368
+
369
+ class RBI::File
370
+ sig do
371
+ params(
372
+ strictness: T.nilable(::String),
373
+ comments: T::Array[::RBI::Comment],
374
+ block: T.nilable(T.proc.params(file: ::RBI::File).void)
375
+ ).void
376
+ end
377
+ def initialize(strictness: T.unsafe(nil), comments: T.unsafe(nil), &block); end
378
+
379
+ sig { params(node: ::RBI::Node).void }
380
+ def <<(node); end
381
+
382
+ sig { params(v: ::RBI::Printer).void }
383
+ def accept_printer(v); end
384
+
385
+ sig { returns(T::Array[::RBI::Comment]) }
386
+ def comments; end
387
+
388
+ # @return [Array<Comment>]
389
+ def comments=(_arg0); end
390
+
391
+ sig { returns(T::Boolean) }
392
+ def empty?; end
393
+
394
+ sig do
395
+ params(
396
+ out: T.any(::IO, ::StringIO),
397
+ indent: ::Integer,
398
+ print_locs: T::Boolean,
399
+ max_line_length: T.nilable(::Integer)
400
+ ).void
401
+ end
402
+ def print(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil), max_line_length: T.unsafe(nil)); end
403
+
404
+ sig { returns(::RBI::Tree) }
405
+ def root; end
406
+
407
+ # @return [Tree]
408
+ def root=(_arg0); end
409
+
410
+ sig { returns(T.nilable(::String)) }
411
+ def strictness; end
412
+
413
+ # @return [String, nil]
414
+ def strictness=(_arg0); end
415
+
416
+ sig { params(indent: ::Integer, print_locs: T::Boolean, max_line_length: T.nilable(::Integer)).returns(::String) }
417
+ def string(indent: T.unsafe(nil), print_locs: T.unsafe(nil), max_line_length: T.unsafe(nil)); end
418
+ end
419
+
420
+ class RBI::Formatter
421
+ sig do
422
+ params(
423
+ add_sig_templates: T::Boolean,
424
+ group_nodes: T::Boolean,
425
+ max_line_length: T.nilable(::Integer),
426
+ nest_singleton_methods: T::Boolean,
427
+ nest_non_public_methods: T::Boolean,
428
+ sort_nodes: T::Boolean
429
+ ).void
430
+ end
431
+ def initialize(add_sig_templates: T.unsafe(nil), group_nodes: T.unsafe(nil), max_line_length: T.unsafe(nil), nest_singleton_methods: T.unsafe(nil), nest_non_public_methods: T.unsafe(nil), sort_nodes: T.unsafe(nil)); end
432
+
433
+ sig { returns(T::Boolean) }
434
+ def add_sig_templates; end
435
+
436
+ # @return [Boolean]
437
+ def add_sig_templates=(_arg0); end
438
+
439
+ sig { params(file: ::RBI::File).void }
440
+ def format_file(file); end
441
+
442
+ sig { params(tree: ::RBI::Tree).void }
443
+ def format_tree(tree); end
444
+
445
+ # @return [Boolean]
446
+ def group_nodes; end
447
+
448
+ # @return [Boolean]
449
+ def group_nodes=(_arg0); end
450
+
451
+ sig { returns(T.nilable(::Integer)) }
452
+ def max_line_length; end
453
+
454
+ # @return [Integer, nil]
455
+ def max_line_length=(_arg0); end
456
+
457
+ # @return [Boolean]
458
+ def nest_non_public_methods; end
459
+
460
+ # @return [Boolean]
461
+ def nest_non_public_methods=(_arg0); end
462
+
463
+ # @return [Boolean]
464
+ def nest_singleton_methods; end
465
+
466
+ # @return [Boolean]
467
+ def nest_singleton_methods=(_arg0); end
468
+
469
+ sig { params(file: ::RBI::File).returns(::String) }
470
+ def print_file(file); end
471
+
472
+ sig { params(tree: ::RBI::Tree).returns(::String) }
473
+ def print_tree(tree); end
474
+
475
+ # @return [Boolean]
476
+ def sort_nodes; end
477
+
478
+ # @return [Boolean]
479
+ def sort_nodes=(_arg0); end
480
+ end
481
+
482
+ class RBI::Group < ::RBI::Tree
483
+ sig { params(kind: ::RBI::Group::Kind).void }
484
+ def initialize(kind); end
485
+
486
+ sig { override.params(v: ::RBI::Printer).void }
487
+ def accept_printer(v); end
488
+
489
+ sig { returns(::RBI::Group::Kind) }
490
+ def kind; end
491
+ end
492
+
493
+ class RBI::Group::Kind < ::T::Enum
494
+ enums do
495
+ Mixins = new
496
+ RequiredAncestors = new
497
+ Helpers = new
498
+ TypeMembers = new
499
+ MixesInClassMethods = new
500
+ Sends = new
501
+ Attrs = new
502
+ TStructFields = new
503
+ TEnums = new
504
+ Inits = new
505
+ Methods = new
506
+ SingletonClasses = new
507
+ Consts = new
508
+ end
509
+ end
510
+
511
+ # Sorbet's misc.
512
+ class RBI::Helper < ::RBI::NodeWithComments
513
+ include ::RBI::Indexable
514
+
515
+ sig do
516
+ params(
517
+ name: ::String,
518
+ loc: T.nilable(::RBI::Loc),
519
+ comments: T::Array[::RBI::Comment],
520
+ block: T.nilable(T.proc.params(node: ::RBI::Helper).void)
521
+ ).void
522
+ end
523
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
524
+
525
+ sig { override.params(v: ::RBI::Printer).void }
526
+ def accept_printer(v); end
527
+
528
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
529
+ def compatible_with?(other); end
530
+
531
+ sig { override.returns(T::Array[::String]) }
532
+ def index_ids; end
533
+
534
+ sig { returns(::String) }
535
+ def name; end
536
+
537
+ sig { override.returns(::String) }
538
+ def to_s; end
539
+ end
540
+
541
+ class RBI::Include < ::RBI::Mixin
542
+ include ::RBI::Indexable
543
+
544
+ sig do
545
+ params(
546
+ name: ::String,
547
+ names: ::String,
548
+ loc: T.nilable(::RBI::Loc),
549
+ comments: T::Array[::RBI::Comment],
550
+ block: T.nilable(T.proc.params(node: ::RBI::Include).void)
551
+ ).void
552
+ end
553
+ def initialize(name, *names, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
554
+
555
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
556
+ def compatible_with?(other); end
557
+
558
+ sig { override.returns(T::Array[::String]) }
559
+ def index_ids; end
560
+
561
+ sig { override.returns(::String) }
562
+ def to_s; end
563
+ end
564
+
565
+ class RBI::Index < ::RBI::Visitor
566
+ sig { void }
567
+ def initialize; end
568
+
569
+ sig { params(id: ::String).returns(T::Array[::RBI::Node]) }
570
+ def [](id); end
571
+
572
+ sig { params(nodes: ::RBI::Node).void }
573
+ def index(*nodes); end
574
+
575
+ sig { returns(T::Array[::String]) }
576
+ def keys; end
577
+
578
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
579
+ def visit(node); end
580
+
581
+ private
582
+
583
+ sig { params(node: T.all(::RBI::Indexable, ::RBI::Node)).void }
584
+ def index_node(node); end
585
+
586
+ class << self
587
+ sig { params(node: ::RBI::Node).returns(::RBI::Index) }
588
+ def index(*node); end
589
+ end
590
+ end
591
+
592
+ # A Node that can be refered to by a unique ID inside an index
593
+ #
594
+ # @abstract Subclasses must implement the `abstract` methods below.
595
+ module RBI::Indexable
596
+ interface!
597
+
598
+ # Unique IDs that refer to this node.
599
+ #
600
+ # Some nodes can have multiple ids, for example an attribute accessor matches the ID of the
601
+ # getter and the setter.
602
+ #
603
+ # @abstract
604
+ sig { abstract.returns(T::Array[::String]) }
605
+ def index_ids; end
606
+ end
607
+
608
+ class RBI::KwArg < ::RBI::Arg
609
+ sig { params(keyword: ::String, value: ::String, loc: T.nilable(::RBI::Loc)).void }
610
+ def initialize(keyword, value, loc: T.unsafe(nil)); end
611
+
612
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
613
+ def ==(other); end
614
+
615
+ sig { override.params(v: ::RBI::Printer).void }
616
+ def accept_printer(v); end
617
+
618
+ sig { returns(::String) }
619
+ def keyword; end
620
+
621
+ sig { returns(::String) }
622
+ def to_s; end
623
+ end
624
+
625
+ class RBI::KwOptParam < ::RBI::Param
626
+ sig do
627
+ params(
628
+ name: ::String,
629
+ value: ::String,
630
+ loc: T.nilable(::RBI::Loc),
631
+ comments: T::Array[::RBI::Comment],
632
+ block: T.nilable(T.proc.params(node: ::RBI::KwOptParam).void)
633
+ ).void
634
+ end
635
+ def initialize(name, value, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
636
+
637
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
638
+ def ==(other); end
639
+
640
+ sig { override.params(v: ::RBI::Printer).void }
641
+ def accept_printer(v); end
642
+
643
+ sig { override.params(v: ::RBI::Printer, last: T::Boolean).void }
644
+ def print_comment_leading_space(v, last:); end
645
+
646
+ sig { override.returns(::String) }
647
+ def to_s; end
648
+
649
+ sig { returns(::String) }
650
+ def value; end
651
+ end
652
+
653
+ class RBI::KwParam < ::RBI::Param
654
+ sig do
655
+ params(
656
+ name: ::String,
657
+ loc: T.nilable(::RBI::Loc),
658
+ comments: T::Array[::RBI::Comment],
659
+ block: T.nilable(T.proc.params(node: ::RBI::KwParam).void)
660
+ ).void
661
+ end
662
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
663
+
664
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
665
+ def ==(other); end
666
+
667
+ sig { override.params(v: ::RBI::Printer).void }
668
+ def accept_printer(v); end
669
+
670
+ sig { override.params(v: ::RBI::Printer, last: T::Boolean).void }
671
+ def print_comment_leading_space(v, last:); end
672
+
673
+ sig { override.returns(::String) }
674
+ def to_s; end
675
+ end
676
+
677
+ class RBI::KwRestParam < ::RBI::Param
678
+ sig do
679
+ params(
680
+ name: ::String,
681
+ loc: T.nilable(::RBI::Loc),
682
+ comments: T::Array[::RBI::Comment],
683
+ block: T.nilable(T.proc.params(node: ::RBI::KwRestParam).void)
684
+ ).void
685
+ end
686
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
687
+
688
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
689
+ def ==(other); end
690
+
691
+ sig { override.params(v: ::RBI::Printer).void }
692
+ def accept_printer(v); end
693
+
694
+ sig { override.params(v: ::RBI::Printer, last: T::Boolean).void }
695
+ def print_comment_leading_space(v, last:); end
696
+
697
+ sig { override.returns(::String) }
698
+ def to_s; end
699
+ end
700
+
701
+ class RBI::Loc
702
+ sig do
703
+ params(
704
+ file: T.nilable(::String),
705
+ begin_line: T.nilable(::Integer),
706
+ end_line: T.nilable(::Integer),
707
+ begin_column: T.nilable(::Integer),
708
+ end_column: T.nilable(::Integer)
709
+ ).void
710
+ end
711
+ def initialize(file: T.unsafe(nil), begin_line: T.unsafe(nil), end_line: T.unsafe(nil), begin_column: T.unsafe(nil), end_column: T.unsafe(nil)); end
712
+
713
+ # @return [Integer, nil]
714
+ def begin_column; end
715
+
716
+ sig { returns(T.nilable(::Integer)) }
717
+ def begin_line; end
718
+
719
+ # @return [Integer, nil]
720
+ def end_column; end
721
+
722
+ # @return [Integer, nil]
723
+ def end_line; end
724
+
725
+ sig { returns(T.nilable(::String)) }
726
+ def file; end
727
+
728
+ sig { returns(T.nilable(::String)) }
729
+ def source; end
730
+
731
+ sig { returns(::String) }
732
+ def to_s; end
733
+
734
+ class << self
735
+ sig { params(file: ::String, ast_loc: T.any(::Parser::Source::Map, ::Parser::Source::Range)).returns(::RBI::Loc) }
736
+ def from_ast_loc(file, ast_loc); end
737
+ end
738
+ end
739
+
740
+ # A tree that _might_ contain conflicts
741
+ class RBI::MergeTree < ::RBI::Tree
742
+ sig do
743
+ params(
744
+ loc: T.nilable(::RBI::Loc),
745
+ comments: T::Array[::RBI::Comment],
746
+ conflicts: T::Array[::RBI::Rewriters::Merge::Conflict],
747
+ block: T.nilable(T.proc.params(node: ::RBI::Tree).void)
748
+ ).void
749
+ end
750
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), conflicts: T.unsafe(nil), &block); end
751
+
752
+ sig { returns(T::Array[::RBI::Rewriters::Merge::Conflict]) }
753
+ def conflicts; end
754
+ end
755
+
756
+ # Methods and args
757
+ class RBI::Method < ::RBI::NodeWithComments
758
+ include ::RBI::Indexable
759
+
760
+ sig do
761
+ params(
762
+ name: ::String,
763
+ params: T::Array[::RBI::Param],
764
+ is_singleton: T::Boolean,
765
+ visibility: ::RBI::Visibility,
766
+ sigs: T::Array[::RBI::Sig],
767
+ loc: T.nilable(::RBI::Loc),
768
+ comments: T::Array[::RBI::Comment],
769
+ block: T.nilable(T.proc.params(node: ::RBI::Method).void)
770
+ ).void
771
+ end
772
+ def initialize(name, params: T.unsafe(nil), is_singleton: T.unsafe(nil), visibility: T.unsafe(nil), sigs: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
773
+
774
+ sig { params(param: ::RBI::Param).void }
775
+ def <<(param); end
776
+
777
+ sig { override.params(v: ::RBI::Printer).void }
778
+ def accept_printer(v); end
779
+
780
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
781
+ def compatible_with?(other); end
782
+
783
+ sig { returns(::String) }
784
+ def fully_qualified_name; end
785
+
786
+ sig { override.returns(T::Array[::String]) }
787
+ def index_ids; end
788
+
789
+ sig { returns(T::Boolean) }
790
+ def inline_params?; end
791
+
792
+ sig { returns(T::Boolean) }
793
+ def is_singleton; end
794
+
795
+ # @return [Boolean]
796
+ def is_singleton=(_arg0); end
797
+
798
+ sig { override.params(other: ::RBI::Node).void }
799
+ def merge_with(other); end
800
+
801
+ sig { returns(::String) }
802
+ def name; end
803
+
804
+ # @return [String]
805
+ def name=(_arg0); end
806
+
807
+ sig { override.returns(T::Boolean) }
808
+ def oneline?; end
809
+
810
+ sig { returns(T::Array[::RBI::Param]) }
811
+ def params; end
812
+
813
+ sig { returns(T::Array[::RBI::Sig]) }
814
+ def sigs; end
815
+
816
+ # @return [Array<Sig>]
817
+ def sigs=(_arg0); end
818
+
819
+ sig { override.returns(::String) }
820
+ def to_s; end
821
+
822
+ sig { returns(::RBI::Visibility) }
823
+ def visibility; end
824
+
825
+ # @return [Visibility]
826
+ def visibility=(_arg0); end
827
+ end
828
+
829
+ class RBI::MixesInClassMethods < ::RBI::Mixin
830
+ include ::RBI::Indexable
831
+
832
+ sig do
833
+ params(
834
+ name: ::String,
835
+ names: ::String,
836
+ loc: T.nilable(::RBI::Loc),
837
+ comments: T::Array[::RBI::Comment],
838
+ block: T.nilable(T.proc.params(node: ::RBI::MixesInClassMethods).void)
839
+ ).void
840
+ end
841
+ def initialize(name, *names, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
842
+
843
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
844
+ def compatible_with?(other); end
845
+
846
+ sig { override.returns(T::Array[::String]) }
847
+ def index_ids; end
848
+
849
+ sig { override.returns(::String) }
850
+ def to_s; end
851
+ end
852
+
853
+ # Mixins
854
+ #
855
+ # @abstract It cannont be directly instantiated. Subclasses must implement the `abstract` methods below.
856
+ class RBI::Mixin < ::RBI::NodeWithComments
857
+ abstract!
858
+
859
+ sig do
860
+ params(
861
+ name: ::String,
862
+ names: T::Array[::String],
863
+ loc: T.nilable(::RBI::Loc),
864
+ comments: T::Array[::RBI::Comment]
865
+ ).void
866
+ end
867
+ def initialize(name, names, loc: T.unsafe(nil), comments: T.unsafe(nil)); end
868
+
869
+ sig { override.params(v: ::RBI::Printer).void }
870
+ def accept_printer(v); end
871
+
872
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
873
+ def compatible_with?(other); end
874
+
875
+ sig { returns(T::Array[::String]) }
876
+ def names; end
877
+
878
+ # @return [Array<String>]
879
+ def names=(_arg0); end
880
+ end
881
+
882
+ class RBI::Module < ::RBI::Scope
883
+ sig do
884
+ params(
885
+ name: ::String,
886
+ loc: T.nilable(::RBI::Loc),
887
+ comments: T::Array[::RBI::Comment],
888
+ block: T.nilable(T.proc.params(node: ::RBI::Module).void)
889
+ ).void
890
+ end
891
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
892
+
893
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
894
+ def compatible_with?(other); end
895
+
896
+ sig { override.returns(::String) }
897
+ def fully_qualified_name; end
898
+
899
+ sig { returns(::String) }
900
+ def name; end
901
+
902
+ # @return [String]
903
+ def name=(_arg0); end
904
+
905
+ sig { override.params(v: ::RBI::Printer).void }
906
+ def print_header(v); end
907
+ end
908
+
909
+ # @abstract It cannont be directly instantiated. Subclasses must implement the `abstract` methods below.
910
+ class RBI::Node
911
+ abstract!
912
+
913
+ sig { params(loc: T.nilable(::RBI::Loc)).void }
914
+ def initialize(loc: T.unsafe(nil)); end
915
+
916
+ # @abstract
917
+ sig { abstract.params(v: ::RBI::Printer).void }
918
+ def accept_printer(v); end
919
+
920
+ # Can `self` and `_other` be merged into a single definition?
921
+ sig { params(_other: ::RBI::Node).returns(T::Boolean) }
922
+ def compatible_with?(_other); end
923
+
924
+ sig { void }
925
+ def detach; end
926
+
927
+ sig { returns(::RBI::Group::Kind) }
928
+ def group_kind; end
929
+
930
+ sig { returns(T.nilable(::RBI::Loc)) }
931
+ def loc; end
932
+
933
+ # @return [Loc, nil]
934
+ def loc=(_arg0); end
935
+
936
+ # Merge `self` and `other` into a single definition
937
+ sig { params(other: ::RBI::Node).void }
938
+ def merge_with(other); end
939
+
940
+ sig { returns(T::Boolean) }
941
+ def oneline?; end
942
+
943
+ sig { returns(T.nilable(::RBI::ConflictTree)) }
944
+ def parent_conflict_tree; end
945
+
946
+ sig { returns(T.nilable(::RBI::Scope)) }
947
+ def parent_scope; end
948
+
949
+ sig { returns(T.nilable(::RBI::Tree)) }
950
+ def parent_tree; end
951
+
952
+ # @return [Tree, nil]
953
+ def parent_tree=(_arg0); end
954
+
955
+ sig do
956
+ params(
957
+ out: T.any(::IO, ::StringIO),
958
+ indent: ::Integer,
959
+ print_locs: T::Boolean,
960
+ max_line_length: T.nilable(::Integer)
961
+ ).void
962
+ end
963
+ def print(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil), max_line_length: T.unsafe(nil)); end
964
+
965
+ sig { params(v: ::RBI::Printer).void }
966
+ def print_blank_line_before(v); end
967
+
968
+ sig { params(node: ::RBI::Node).void }
969
+ def replace(node); end
970
+
971
+ sig { params(indent: ::Integer, print_locs: T::Boolean, max_line_length: T.nilable(::Integer)).returns(::String) }
972
+ def string(indent: T.unsafe(nil), print_locs: T.unsafe(nil), max_line_length: T.unsafe(nil)); end
973
+ end
974
+
975
+ # @abstract It cannont be directly instantiated. Subclasses must implement the `abstract` methods below.
976
+ class RBI::NodeWithComments < ::RBI::Node
977
+ abstract!
978
+
979
+ sig { params(loc: T.nilable(::RBI::Loc), comments: T::Array[::RBI::Comment]).void }
980
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil)); end
981
+
982
+ sig { returns(T::Array[::String]) }
983
+ def annotations; end
984
+
985
+ sig { returns(T::Array[::RBI::Comment]) }
986
+ def comments; end
987
+
988
+ # @return [Array<Comment>]
989
+ def comments=(_arg0); end
990
+
991
+ sig { override.params(other: ::RBI::Node).void }
992
+ def merge_with(other); end
993
+
994
+ sig { override.returns(T::Boolean) }
995
+ def oneline?; end
996
+ end
997
+
998
+ class RBI::OptParam < ::RBI::Param
999
+ sig do
1000
+ params(
1001
+ name: ::String,
1002
+ value: ::String,
1003
+ loc: T.nilable(::RBI::Loc),
1004
+ comments: T::Array[::RBI::Comment],
1005
+ block: T.nilable(T.proc.params(node: ::RBI::OptParam).void)
1006
+ ).void
1007
+ end
1008
+ def initialize(name, value, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1009
+
1010
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
1011
+ def ==(other); end
1012
+
1013
+ sig { override.params(v: ::RBI::Printer).void }
1014
+ def accept_printer(v); end
1015
+
1016
+ sig { override.params(v: ::RBI::Printer, last: T::Boolean).void }
1017
+ def print_comment_leading_space(v, last:); end
1018
+
1019
+ sig { returns(::String) }
1020
+ def value; end
1021
+ end
1022
+
1023
+ # @abstract It cannont be directly instantiated. Subclasses must implement the `abstract` methods below.
1024
+ class RBI::Param < ::RBI::NodeWithComments
1025
+ abstract!
1026
+
1027
+ sig { params(name: ::String, loc: T.nilable(::RBI::Loc), comments: T::Array[::RBI::Comment]).void }
1028
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil)); end
1029
+
1030
+ sig { override.params(v: ::RBI::Printer).void }
1031
+ def accept_printer(v); end
1032
+
1033
+ sig { returns(T::Array[::String]) }
1034
+ def comments_lines; end
1035
+
1036
+ sig { returns(::String) }
1037
+ def name; end
1038
+
1039
+ sig { params(v: ::RBI::Printer, last: T::Boolean).void }
1040
+ def print_comment_leading_space(v, last:); end
1041
+
1042
+ sig { override.returns(::String) }
1043
+ def to_s; end
1044
+ end
1045
+
1046
+ class RBI::ParseError < ::StandardError
1047
+ sig { params(message: ::String, location: ::RBI::Loc).void }
1048
+ def initialize(message, location); end
1049
+
1050
+ sig { returns(::RBI::Loc) }
1051
+ def location; end
1052
+ end
1053
+
1054
+ class RBI::Parser
1055
+ sig { void }
1056
+ def initialize; end
1057
+
1058
+ sig { params(path: ::String).returns(::RBI::Tree) }
1059
+ def parse_file(path); end
1060
+
1061
+ sig { params(string: ::String).returns(::RBI::Tree) }
1062
+ def parse_string(string); end
1063
+
1064
+ private
1065
+
1066
+ sig { params(content: ::String, file: ::String).returns(::RBI::Tree) }
1067
+ def parse(content, file:); end
1068
+
1069
+ class << self
1070
+ sig { params(path: ::String).returns(::RBI::Tree) }
1071
+ def parse_file(path); end
1072
+
1073
+ sig { params(paths: T::Array[::String]).returns(T::Array[::RBI::Tree]) }
1074
+ def parse_files(paths); end
1075
+
1076
+ sig { params(string: ::String).returns(::RBI::Tree) }
1077
+ def parse_string(string); end
1078
+
1079
+ sig { params(strings: T::Array[::String]).returns(T::Array[::RBI::Tree]) }
1080
+ def parse_strings(strings); end
1081
+ end
1082
+ end
1083
+
1084
+ class RBI::Printer < ::RBI::Visitor
1085
+ sig do
1086
+ params(
1087
+ out: T.any(::IO, ::StringIO),
1088
+ indent: ::Integer,
1089
+ print_locs: T::Boolean,
1090
+ max_line_length: T.nilable(::Integer)
1091
+ ).void
1092
+ end
1093
+ def initialize(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil), max_line_length: T.unsafe(nil)); end
1094
+
1095
+ sig { returns(::Integer) }
1096
+ def current_indent; end
1097
+
1098
+ sig { void }
1099
+ def dedent; end
1100
+
1101
+ # @return [Boolean]
1102
+ def in_visibility_group; end
1103
+
1104
+ # @return [Boolean]
1105
+ def in_visibility_group=(_arg0); end
1106
+
1107
+ # Printing
1108
+ sig { void }
1109
+ def indent; end
1110
+
1111
+ sig { returns(T.nilable(::Integer)) }
1112
+ def max_line_length; end
1113
+
1114
+ sig { returns(T.nilable(::RBI::Node)) }
1115
+ def previous_node; end
1116
+
1117
+ # Print a string without indentation nor `\n` at the end.
1118
+ sig { params(string: ::String).void }
1119
+ def print(string); end
1120
+
1121
+ sig { returns(T::Boolean) }
1122
+ def print_locs; end
1123
+
1124
+ # @return [Boolean]
1125
+ def print_locs=(_arg0); end
1126
+
1127
+ # Print a string with indentation and `\n` at the end.
1128
+ sig { params(string: ::String).void }
1129
+ def printl(string); end
1130
+
1131
+ # Print a string without indentation but with a `\n` at the end.
1132
+ sig { params(string: T.nilable(::String)).void }
1133
+ def printn(string = T.unsafe(nil)); end
1134
+
1135
+ # Print a string with indentation but without a `\n` at the end.
1136
+ sig { params(string: T.nilable(::String)).void }
1137
+ def printt(string = T.unsafe(nil)); end
1138
+
1139
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1140
+ def visit(node); end
1141
+
1142
+ sig { override.params(nodes: T::Array[::RBI::Node]).void }
1143
+ def visit_all(nodes); end
1144
+
1145
+ sig { params(file: ::RBI::File).void }
1146
+ def visit_file(file); end
1147
+ end
1148
+
1149
+ class RBI::Private < ::RBI::Visibility
1150
+ sig do
1151
+ params(
1152
+ loc: T.nilable(::RBI::Loc),
1153
+ comments: T::Array[::RBI::Comment],
1154
+ block: T.nilable(T.proc.params(node: ::RBI::Private).void)
1155
+ ).void
1156
+ end
1157
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1158
+ end
1159
+
1160
+ class RBI::Protected < ::RBI::Visibility
1161
+ sig do
1162
+ params(
1163
+ loc: T.nilable(::RBI::Loc),
1164
+ comments: T::Array[::RBI::Comment],
1165
+ block: T.nilable(T.proc.params(node: ::RBI::Protected).void)
1166
+ ).void
1167
+ end
1168
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1169
+ end
1170
+
1171
+ class RBI::Public < ::RBI::Visibility
1172
+ sig do
1173
+ params(
1174
+ loc: T.nilable(::RBI::Loc),
1175
+ comments: T::Array[::RBI::Comment],
1176
+ block: T.nilable(T.proc.params(node: ::RBI::Public).void)
1177
+ ).void
1178
+ end
1179
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1180
+ end
1181
+
1182
+ class RBI::ReqParam < ::RBI::Param
1183
+ sig do
1184
+ params(
1185
+ name: ::String,
1186
+ loc: T.nilable(::RBI::Loc),
1187
+ comments: T::Array[::RBI::Comment],
1188
+ block: T.nilable(T.proc.params(node: ::RBI::ReqParam).void)
1189
+ ).void
1190
+ end
1191
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1192
+
1193
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
1194
+ def ==(other); end
1195
+ end
1196
+
1197
+ class RBI::RequiresAncestor < ::RBI::NodeWithComments
1198
+ include ::RBI::Indexable
1199
+
1200
+ sig { params(name: ::String, loc: T.nilable(::RBI::Loc), comments: T::Array[::RBI::Comment]).void }
1201
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil)); end
1202
+
1203
+ sig { override.params(v: ::RBI::Printer).void }
1204
+ def accept_printer(v); end
1205
+
1206
+ sig { override.returns(T::Array[::String]) }
1207
+ def index_ids; end
1208
+
1209
+ sig { returns(::String) }
1210
+ def name; end
1211
+
1212
+ sig { override.returns(::String) }
1213
+ def to_s; end
1214
+ end
1215
+
1216
+ class RBI::RestParam < ::RBI::Param
1217
+ sig do
1218
+ params(
1219
+ name: ::String,
1220
+ loc: T.nilable(::RBI::Loc),
1221
+ comments: T::Array[::RBI::Comment],
1222
+ block: T.nilable(T.proc.params(node: ::RBI::RestParam).void)
1223
+ ).void
1224
+ end
1225
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1226
+
1227
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
1228
+ def ==(other); end
1229
+
1230
+ sig { override.params(v: ::RBI::Printer).void }
1231
+ def accept_printer(v); end
1232
+
1233
+ sig { override.params(v: ::RBI::Printer, last: T::Boolean).void }
1234
+ def print_comment_leading_space(v, last:); end
1235
+
1236
+ sig { override.returns(::String) }
1237
+ def to_s; end
1238
+ end
1239
+
1240
+ module RBI::Rewriters; end
1241
+
1242
+ class RBI::Rewriters::AddSigTemplates < ::RBI::Visitor
1243
+ sig { params(with_todo_comment: T::Boolean).void }
1244
+ def initialize(with_todo_comment: T.unsafe(nil)); end
1245
+
1246
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1247
+ def visit(node); end
1248
+
1249
+ private
1250
+
1251
+ sig { params(attr: ::RBI::Attr).void }
1252
+ def add_attr_sig(attr); end
1253
+
1254
+ sig { params(method: ::RBI::Method).void }
1255
+ def add_method_sig(method); end
1256
+
1257
+ sig { params(node: ::RBI::NodeWithComments).void }
1258
+ def add_todo_comment(node); end
1259
+ end
1260
+
1261
+ class RBI::Rewriters::Annotate < ::RBI::Visitor
1262
+ sig { params(annotation: ::String, annotate_scopes: T::Boolean, annotate_properties: T::Boolean).void }
1263
+ def initialize(annotation, annotate_scopes: T.unsafe(nil), annotate_properties: T.unsafe(nil)); end
1264
+
1265
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1266
+ def visit(node); end
1267
+
1268
+ private
1269
+
1270
+ sig { params(node: ::RBI::NodeWithComments).void }
1271
+ def annotate_node(node); end
1272
+
1273
+ sig { params(node: ::RBI::Node).returns(T::Boolean) }
1274
+ def root?(node); end
1275
+ end
1276
+
1277
+ class RBI::Rewriters::Deannotate < ::RBI::Visitor
1278
+ sig { params(annotation: ::String).void }
1279
+ def initialize(annotation); end
1280
+
1281
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1282
+ def visit(node); end
1283
+
1284
+ private
1285
+
1286
+ sig { params(node: ::RBI::NodeWithComments).void }
1287
+ def deannotate_node(node); end
1288
+ end
1289
+
1290
+ class RBI::Rewriters::GroupNodes < ::RBI::Visitor
1291
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1292
+ def visit(node); end
1293
+ end
1294
+
1295
+ # Merge two RBI trees together
1296
+ #
1297
+ # Be this `Tree`:
1298
+ # ~~~rb
1299
+ # class Foo
1300
+ # attr_accessor :a
1301
+ # def m; end
1302
+ # C = 10
1303
+ # end
1304
+ # ~~~
1305
+ #
1306
+ # Merged with this one:
1307
+ # ~~~rb
1308
+ # class Foo
1309
+ # attr_reader :a
1310
+ # def m(x); end
1311
+ # C = 10
1312
+ # end
1313
+ # ~~~
1314
+ #
1315
+ # Compatible definitions are merged together while incompatible definitions are moved into a `ConflictTree`:
1316
+ # ~~~rb
1317
+ # class Foo
1318
+ # <<<<<<< left
1319
+ # attr_accessor :a
1320
+ # def m; end
1321
+ # =======
1322
+ # attr_reader :a
1323
+ # def m(x); end
1324
+ # >>>>>>> right
1325
+ # C = 10
1326
+ # end
1327
+ # ~~~
1328
+ class RBI::Rewriters::Merge
1329
+ sig { params(left_name: ::String, right_name: ::String, keep: ::RBI::Rewriters::Merge::Keep).void }
1330
+ def initialize(left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end
1331
+
1332
+ sig { params(tree: ::RBI::Tree).void }
1333
+ def merge(tree); end
1334
+
1335
+ sig { returns(::RBI::MergeTree) }
1336
+ def tree; end
1337
+
1338
+ class << self
1339
+ sig do
1340
+ params(
1341
+ left: ::RBI::Tree,
1342
+ right: ::RBI::Tree,
1343
+ left_name: ::String,
1344
+ right_name: ::String,
1345
+ keep: ::RBI::Rewriters::Merge::Keep
1346
+ ).returns(::RBI::MergeTree)
1347
+ end
1348
+ def merge_trees(left, right, left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end
1349
+ end
1350
+ end
1351
+
1352
+ # Used for logging / error displaying purpose
1353
+ class RBI::Rewriters::Merge::Conflict < ::T::Struct
1354
+ const :left, ::RBI::Node
1355
+ const :left_name, ::String
1356
+ const :right, ::RBI::Node
1357
+ const :right_name, ::String
1358
+
1359
+ sig { returns(::String) }
1360
+ def to_s; end
1361
+
1362
+ class << self
1363
+ def inherited(s); end
1364
+ end
1365
+ end
1366
+
1367
+ # Merge adjacent conflict trees
1368
+ #
1369
+ # Transform this:
1370
+ # ~~~rb
1371
+ # class Foo
1372
+ # <<<<<<< left
1373
+ # def m1; end
1374
+ # =======
1375
+ # def m1(a); end
1376
+ # >>>>>>> right
1377
+ # <<<<<<< left
1378
+ # def m2(a); end
1379
+ # =======
1380
+ # def m2; end
1381
+ # >>>>>>> right
1382
+ # end
1383
+ # ~~~
1384
+ #
1385
+ # Into this:
1386
+ # ~~~rb
1387
+ # class Foo
1388
+ # <<<<<<< left
1389
+ # def m1; end
1390
+ # def m2(a); end
1391
+ # =======
1392
+ # def m1(a); end
1393
+ # def m2; end
1394
+ # >>>>>>> right
1395
+ # end
1396
+ # ~~~
1397
+ class RBI::Rewriters::Merge::ConflictTreeMerger < ::RBI::Visitor
1398
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1399
+ def visit(node); end
1400
+
1401
+ sig { override.params(nodes: T::Array[::RBI::Node]).void }
1402
+ def visit_all(nodes); end
1403
+
1404
+ private
1405
+
1406
+ sig { params(left: ::RBI::Tree, right: ::RBI::Tree).void }
1407
+ def merge_conflict_trees(left, right); end
1408
+ end
1409
+
1410
+ class RBI::Rewriters::Merge::Keep < ::T::Enum
1411
+ enums do
1412
+ NONE = new
1413
+ LEFT = new
1414
+ RIGHT = new
1415
+ end
1416
+ end
1417
+
1418
+ class RBI::Rewriters::Merge::TreeMerger < ::RBI::Visitor
1419
+ sig do
1420
+ params(
1421
+ output: ::RBI::Tree,
1422
+ left_name: ::String,
1423
+ right_name: ::String,
1424
+ keep: ::RBI::Rewriters::Merge::Keep
1425
+ ).void
1426
+ end
1427
+ def initialize(output, left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end
1428
+
1429
+ sig { returns(T::Array[::RBI::Rewriters::Merge::Conflict]) }
1430
+ def conflicts; end
1431
+
1432
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1433
+ def visit(node); end
1434
+
1435
+ private
1436
+
1437
+ sig { returns(::RBI::Tree) }
1438
+ def current_scope; end
1439
+
1440
+ sig { params(left: ::RBI::Scope, right: ::RBI::Scope).void }
1441
+ def make_conflict_scope(left, right); end
1442
+
1443
+ sig { params(left: ::RBI::Node, right: ::RBI::Node).void }
1444
+ def make_conflict_tree(left, right); end
1445
+
1446
+ sig { params(node: ::RBI::Node).returns(T.nilable(::RBI::Node)) }
1447
+ def previous_definition(node); end
1448
+
1449
+ sig { params(left: ::RBI::Scope, right: ::RBI::Scope).returns(::RBI::Scope) }
1450
+ def replace_scope_header(left, right); end
1451
+ end
1452
+
1453
+ class RBI::Rewriters::NestNonPublicMethods < ::RBI::Visitor
1454
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1455
+ def visit(node); end
1456
+ end
1457
+
1458
+ class RBI::Rewriters::NestSingletonMethods < ::RBI::Visitor
1459
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1460
+ def visit(node); end
1461
+ end
1462
+
1463
+ # Remove all definitions existing in the index from the current tree
1464
+ #
1465
+ # Let's create an `Index` from two different `Tree`s:
1466
+ # ~~~rb
1467
+ # tree1 = Parse.parse_string(<<~RBI)
1468
+ # class Foo
1469
+ # def foo; end
1470
+ # end
1471
+ # RBI
1472
+ #
1473
+ # tree2 = Parse.parse_string(<<~RBI)
1474
+ # FOO = 10
1475
+ # RBI
1476
+ #
1477
+ # index = Index.index(tree1, tree2)
1478
+ # ~~~
1479
+ #
1480
+ # We can use `RemoveKnownDefinitions` to remove the definitions found in the `index` from the `Tree` to clean:
1481
+ # ~~~rb
1482
+ # tree_to_clean = Parser.parse_string(<<~RBI)
1483
+ # class Foo
1484
+ # def foo; end
1485
+ # def bar; end
1486
+ # end
1487
+ # FOO = 10
1488
+ # BAR = 42
1489
+ # RBI
1490
+ #
1491
+ # cleaned_tree, operations = RemoveKnownDefinitions.remove(tree_to_clean, index)
1492
+ #
1493
+ # assert_equal(<<~RBI, cleaned_tree)
1494
+ # class Foo
1495
+ # def bar; end
1496
+ # end
1497
+ # BAR = 42
1498
+ # RBI
1499
+ #
1500
+ # assert_equal(<<~OPERATIONS, operations.join("\n"))
1501
+ # Deleted ::Foo#foo at -:2:2-2-16 (duplicate from -:2:2-2:16)
1502
+ # Deleted ::FOO at -:5:0-5:8 (duplicate from -:1:0-1:8)
1503
+ # OPERATIONS
1504
+ # ~~~
1505
+ class RBI::Rewriters::RemoveKnownDefinitions < ::RBI::Visitor
1506
+ sig { params(index: ::RBI::Index).void }
1507
+ def initialize(index); end
1508
+
1509
+ sig { returns(T::Array[::RBI::Rewriters::RemoveKnownDefinitions::Operation]) }
1510
+ def operations; end
1511
+
1512
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1513
+ def visit(node); end
1514
+
1515
+ sig { params(nodes: T::Array[::RBI::Node]).void }
1516
+ def visit_all(nodes); end
1517
+
1518
+ private
1519
+
1520
+ sig { params(node: ::RBI::Node, previous: ::RBI::Node).returns(T::Boolean) }
1521
+ def can_delete_node?(node, previous); end
1522
+
1523
+ sig { params(node: ::RBI::Node, previous: ::RBI::Node).void }
1524
+ def delete_node(node, previous); end
1525
+
1526
+ sig { params(node: ::RBI::Indexable).returns(T.nilable(::RBI::Node)) }
1527
+ def previous_definition_for(node); end
1528
+
1529
+ class << self
1530
+ sig do
1531
+ params(
1532
+ tree: ::RBI::Tree,
1533
+ index: ::RBI::Index
1534
+ ).returns([::RBI::Tree, T::Array[::RBI::Rewriters::RemoveKnownDefinitions::Operation]])
1535
+ end
1536
+ def remove(tree, index); end
1537
+ end
1538
+ end
1539
+
1540
+ class RBI::Rewriters::RemoveKnownDefinitions::Operation < ::T::Struct
1541
+ const :deleted_node, ::RBI::Node
1542
+ const :duplicate_of, ::RBI::Node
1543
+
1544
+ sig { returns(::String) }
1545
+ def to_s; end
1546
+
1547
+ class << self
1548
+ def inherited(s); end
1549
+ end
1550
+ end
1551
+
1552
+ class RBI::Rewriters::SortNodes < ::RBI::Visitor
1553
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1554
+ def visit(node); end
1555
+
1556
+ private
1557
+
1558
+ sig { params(kind: ::RBI::Group::Kind).returns(::Integer) }
1559
+ def group_rank(kind); end
1560
+
1561
+ sig { params(node: ::RBI::Node).returns(T.nilable(::String)) }
1562
+ def node_name(node); end
1563
+
1564
+ sig { params(node: ::RBI::Node).returns(::Integer) }
1565
+ def node_rank(node); end
1566
+
1567
+ sig { params(node: ::RBI::Node).void }
1568
+ def sort_node_names!(node); end
1569
+ end
1570
+
1571
+ # Scopes
1572
+ #
1573
+ # @abstract It cannont be directly instantiated. Subclasses must implement the `abstract` methods below.
1574
+ class RBI::Scope < ::RBI::Tree
1575
+ include ::RBI::Indexable
1576
+
1577
+ abstract!
1578
+
1579
+ def initialize(*args, **_arg1, &blk); end
1580
+
1581
+ sig { override.params(v: ::RBI::Printer).void }
1582
+ def accept_printer(v); end
1583
+
1584
+ # Duplicate `self` scope without its body
1585
+ sig { returns(T.self_type) }
1586
+ def dup_empty; end
1587
+
1588
+ # @abstract
1589
+ sig { abstract.returns(::String) }
1590
+ def fully_qualified_name; end
1591
+
1592
+ sig { override.returns(T::Array[::String]) }
1593
+ def index_ids; end
1594
+
1595
+ sig { params(v: ::RBI::Printer).void }
1596
+ def print_body(v); end
1597
+
1598
+ # @abstract
1599
+ sig { abstract.params(v: ::RBI::Printer).void }
1600
+ def print_header(v); end
1601
+
1602
+ sig { override.returns(::String) }
1603
+ def to_s; end
1604
+ end
1605
+
1606
+ # A conflict between two scope headers
1607
+ #
1608
+ # Is rendered as a merge conflict between `left` and` right` for scope definitions:
1609
+ # ~~~rb
1610
+ # <<<<<<< left
1611
+ # class Foo
1612
+ # =======
1613
+ # module Foo
1614
+ # >>>>>>> right
1615
+ # def m1; end
1616
+ # end
1617
+ # ~~~
1618
+ class RBI::ScopeConflict < ::RBI::Tree
1619
+ sig { params(left: ::RBI::Scope, right: ::RBI::Scope, left_name: ::String, right_name: ::String).void }
1620
+ def initialize(left:, right:, left_name: T.unsafe(nil), right_name: T.unsafe(nil)); end
1621
+
1622
+ sig { override.params(v: ::RBI::Printer).void }
1623
+ def accept_printer(v); end
1624
+
1625
+ sig { returns(::RBI::Scope) }
1626
+ def left; end
1627
+
1628
+ sig { override.returns(T::Boolean) }
1629
+ def oneline?; end
1630
+
1631
+ # @return [Scope]
1632
+ def right; end
1633
+ end
1634
+
1635
+ # Sends
1636
+ class RBI::Send < ::RBI::NodeWithComments
1637
+ include ::RBI::Indexable
1638
+
1639
+ sig do
1640
+ params(
1641
+ method: ::String,
1642
+ args: T::Array[::RBI::Arg],
1643
+ loc: T.nilable(::RBI::Loc),
1644
+ comments: T::Array[::RBI::Comment],
1645
+ block: T.nilable(T.proc.params(node: ::RBI::Send).void)
1646
+ ).void
1647
+ end
1648
+ def initialize(method, args = T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1649
+
1650
+ sig { params(arg: ::RBI::Arg).void }
1651
+ def <<(arg); end
1652
+
1653
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
1654
+ def ==(other); end
1655
+
1656
+ sig { override.params(v: ::RBI::Printer).void }
1657
+ def accept_printer(v); end
1658
+
1659
+ sig { returns(T::Array[::RBI::Arg]) }
1660
+ def args; end
1661
+
1662
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
1663
+ def compatible_with?(other); end
1664
+
1665
+ sig { override.returns(T::Array[::String]) }
1666
+ def index_ids; end
1667
+
1668
+ sig { returns(::String) }
1669
+ def method; end
1670
+
1671
+ sig { returns(::String) }
1672
+ def to_s; end
1673
+ end
1674
+
1675
+ # Sorbet's sigs
1676
+ class RBI::Sig < ::RBI::Node
1677
+ sig do
1678
+ params(
1679
+ params: T::Array[::RBI::SigParam],
1680
+ return_type: T.nilable(::String),
1681
+ is_abstract: T::Boolean,
1682
+ is_override: T::Boolean,
1683
+ is_overridable: T::Boolean,
1684
+ is_final: T::Boolean,
1685
+ type_params: T::Array[::String],
1686
+ checked: T.nilable(::Symbol),
1687
+ loc: T.nilable(::RBI::Loc),
1688
+ block: T.nilable(T.proc.params(node: ::RBI::Sig).void)
1689
+ ).void
1690
+ end
1691
+ def initialize(params: T.unsafe(nil), return_type: T.unsafe(nil), is_abstract: T.unsafe(nil), is_override: T.unsafe(nil), is_overridable: T.unsafe(nil), is_final: T.unsafe(nil), type_params: T.unsafe(nil), checked: T.unsafe(nil), loc: T.unsafe(nil), &block); end
1692
+
1693
+ sig { params(param: ::RBI::SigParam).void }
1694
+ def <<(param); end
1695
+
1696
+ sig { params(other: ::Object).returns(T::Boolean) }
1697
+ def ==(other); end
1698
+
1699
+ sig { override.params(v: ::RBI::Printer).void }
1700
+ def accept_printer(v); end
1701
+
1702
+ sig { returns(T.nilable(::Symbol)) }
1703
+ def checked; end
1704
+
1705
+ # @return [Symbol, nil]
1706
+ def checked=(_arg0); end
1707
+
1708
+ sig { returns(T::Boolean) }
1709
+ def inline_params?; end
1710
+
1711
+ sig { returns(T::Boolean) }
1712
+ def is_abstract; end
1713
+
1714
+ # @return [Boolean]
1715
+ def is_abstract=(_arg0); end
1716
+
1717
+ # @return [Boolean]
1718
+ def is_final; end
1719
+
1720
+ # @return [Boolean]
1721
+ def is_final=(_arg0); end
1722
+
1723
+ # @return [Boolean]
1724
+ def is_overridable; end
1725
+
1726
+ # @return [Boolean]
1727
+ def is_overridable=(_arg0); end
1728
+
1729
+ # @return [Boolean]
1730
+ def is_override; end
1731
+
1732
+ # @return [Boolean]
1733
+ def is_override=(_arg0); end
1734
+
1735
+ sig { override.returns(T::Boolean) }
1736
+ def oneline?; end
1737
+
1738
+ sig { returns(T::Array[::RBI::SigParam]) }
1739
+ def params; end
1740
+
1741
+ sig { returns(T.nilable(::String)) }
1742
+ def return_type; end
1743
+
1744
+ # @return [String, nil]
1745
+ def return_type=(_arg0); end
1746
+
1747
+ sig { returns(T::Array[::String]) }
1748
+ def type_params; end
1749
+
1750
+ private
1751
+
1752
+ sig { params(v: ::RBI::Printer).void }
1753
+ def print_as_block(v); end
1754
+
1755
+ sig { params(v: ::RBI::Printer).void }
1756
+ def print_as_line(v); end
1757
+
1758
+ sig { returns(T::Array[::String]) }
1759
+ def sig_modifiers; end
1760
+ end
1761
+
1762
+ class RBI::SigBuilder < ::RBI::ASTVisitor
1763
+ sig { void }
1764
+ def initialize; end
1765
+
1766
+ sig { returns(::RBI::Sig) }
1767
+ def current; end
1768
+
1769
+ # @return [Sig]
1770
+ def current=(_arg0); end
1771
+
1772
+ sig { override.params(node: T.nilable(::AST::Node)).void }
1773
+ def visit(node); end
1774
+
1775
+ sig { params(node: ::AST::Node).void }
1776
+ def visit_send(node); end
1777
+
1778
+ class << self
1779
+ sig { params(node: ::AST::Node).returns(::RBI::Sig) }
1780
+ def build(node); end
1781
+ end
1782
+ end
1783
+
1784
+ class RBI::SigParam < ::RBI::NodeWithComments
1785
+ sig do
1786
+ params(
1787
+ name: ::String,
1788
+ type: ::String,
1789
+ loc: T.nilable(::RBI::Loc),
1790
+ comments: T::Array[::RBI::Comment],
1791
+ block: T.nilable(T.proc.params(node: ::RBI::SigParam).void)
1792
+ ).void
1793
+ end
1794
+ def initialize(name, type, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1795
+
1796
+ sig { params(other: ::Object).returns(T::Boolean) }
1797
+ def ==(other); end
1798
+
1799
+ sig { override.params(v: ::RBI::Printer).void }
1800
+ def accept_printer(v); end
1801
+
1802
+ sig { returns(T::Array[::String]) }
1803
+ def comments_lines; end
1804
+
1805
+ sig { returns(::String) }
1806
+ def name; end
1807
+
1808
+ sig { params(v: ::RBI::Printer, last: T::Boolean).void }
1809
+ def print_comment_leading_space(v, last:); end
1810
+
1811
+ # @return [String]
1812
+ def type; end
1813
+ end
1814
+
1815
+ class RBI::SingletonClass < ::RBI::Scope
1816
+ sig do
1817
+ params(
1818
+ loc: T.nilable(::RBI::Loc),
1819
+ comments: T::Array[::RBI::Comment],
1820
+ block: T.nilable(T.proc.params(node: ::RBI::SingletonClass).void)
1821
+ ).void
1822
+ end
1823
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1824
+
1825
+ sig { override.returns(::String) }
1826
+ def fully_qualified_name; end
1827
+
1828
+ sig { override.params(v: ::RBI::Printer).void }
1829
+ def print_header(v); end
1830
+ end
1831
+
1832
+ class RBI::Struct < ::RBI::Scope
1833
+ sig do
1834
+ params(
1835
+ name: ::String,
1836
+ members: T::Array[::Symbol],
1837
+ keyword_init: T::Boolean,
1838
+ loc: T.nilable(::RBI::Loc),
1839
+ comments: T::Array[::RBI::Comment],
1840
+ block: T.nilable(T.proc.params(struct: ::RBI::Struct).void)
1841
+ ).void
1842
+ end
1843
+ def initialize(name, members: T.unsafe(nil), keyword_init: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1844
+
1845
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
1846
+ def compatible_with?(other); end
1847
+
1848
+ sig { override.returns(::String) }
1849
+ def fully_qualified_name; end
1850
+
1851
+ sig { returns(T::Boolean) }
1852
+ def keyword_init; end
1853
+
1854
+ # @return [Boolean]
1855
+ def keyword_init=(_arg0); end
1856
+
1857
+ sig { returns(T::Array[::Symbol]) }
1858
+ def members; end
1859
+
1860
+ # @return [Array<Symbol>]
1861
+ def members=(_arg0); end
1862
+
1863
+ sig { returns(::String) }
1864
+ def name; end
1865
+
1866
+ # @return [String]
1867
+ def name=(_arg0); end
1868
+
1869
+ sig { override.params(v: ::RBI::Printer).void }
1870
+ def print_header(v); end
1871
+ end
1872
+
1873
+ # Sorbet's T::Enum
1874
+ class RBI::TEnum < ::RBI::Class
1875
+ sig do
1876
+ params(
1877
+ name: ::String,
1878
+ loc: T.nilable(::RBI::Loc),
1879
+ comments: T::Array[::RBI::Comment],
1880
+ block: T.nilable(T.proc.params(klass: ::RBI::TEnum).void)
1881
+ ).void
1882
+ end
1883
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1884
+ end
1885
+
1886
+ class RBI::TEnumBlock < ::RBI::NodeWithComments
1887
+ include ::RBI::Indexable
1888
+
1889
+ sig do
1890
+ params(
1891
+ names: T::Array[::String],
1892
+ loc: T.nilable(::RBI::Loc),
1893
+ comments: T::Array[::RBI::Comment],
1894
+ block: T.nilable(T.proc.params(node: ::RBI::TEnumBlock).void)
1895
+ ).void
1896
+ end
1897
+ def initialize(names = T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1898
+
1899
+ sig { params(name: ::String).void }
1900
+ def <<(name); end
1901
+
1902
+ sig { override.params(v: ::RBI::Printer).void }
1903
+ def accept_printer(v); end
1904
+
1905
+ sig { returns(T::Boolean) }
1906
+ def empty?; end
1907
+
1908
+ sig { override.returns(T::Array[::String]) }
1909
+ def index_ids; end
1910
+
1911
+ sig { override.params(other: ::RBI::Node).void }
1912
+ def merge_with(other); end
1913
+
1914
+ sig { returns(T::Array[::String]) }
1915
+ def names; end
1916
+
1917
+ sig { override.returns(::String) }
1918
+ def to_s; end
1919
+ end
1920
+
1921
+ # Sorbet's T::Struct
1922
+ class RBI::TStruct < ::RBI::Class
1923
+ sig do
1924
+ params(
1925
+ name: ::String,
1926
+ loc: T.nilable(::RBI::Loc),
1927
+ comments: T::Array[::RBI::Comment],
1928
+ block: T.nilable(T.proc.params(klass: ::RBI::TStruct).void)
1929
+ ).void
1930
+ end
1931
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1932
+ end
1933
+
1934
+ class RBI::TStructConst < ::RBI::TStructField
1935
+ include ::RBI::Indexable
1936
+
1937
+ sig do
1938
+ params(
1939
+ name: ::String,
1940
+ type: ::String,
1941
+ default: T.nilable(::String),
1942
+ loc: T.nilable(::RBI::Loc),
1943
+ comments: T::Array[::RBI::Comment],
1944
+ block: T.nilable(T.proc.params(node: ::RBI::TStructConst).void)
1945
+ ).void
1946
+ end
1947
+ def initialize(name, type, default: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1948
+
1949
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
1950
+ def compatible_with?(other); end
1951
+
1952
+ sig { override.returns(T::Array[::String]) }
1953
+ def fully_qualified_names; end
1954
+
1955
+ sig { override.returns(T::Array[::String]) }
1956
+ def index_ids; end
1957
+
1958
+ sig { override.returns(::String) }
1959
+ def to_s; end
1960
+ end
1961
+
1962
+ # @abstract It cannont be directly instantiated. Subclasses must implement the `abstract` methods below.
1963
+ class RBI::TStructField < ::RBI::NodeWithComments
1964
+ abstract!
1965
+
1966
+ sig do
1967
+ params(
1968
+ name: ::String,
1969
+ type: ::String,
1970
+ default: T.nilable(::String),
1971
+ loc: T.nilable(::RBI::Loc),
1972
+ comments: T::Array[::RBI::Comment]
1973
+ ).void
1974
+ end
1975
+ def initialize(name, type, default: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil)); end
1976
+
1977
+ sig { override.params(v: ::RBI::Printer).void }
1978
+ def accept_printer(v); end
1979
+
1980
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
1981
+ def compatible_with?(other); end
1982
+
1983
+ sig { returns(T.nilable(::String)) }
1984
+ def default; end
1985
+
1986
+ # @return [String, nil]
1987
+ def default=(_arg0); end
1988
+
1989
+ # @abstract
1990
+ sig { abstract.returns(T::Array[::String]) }
1991
+ def fully_qualified_names; end
1992
+
1993
+ sig { returns(::String) }
1994
+ def name; end
1995
+
1996
+ # @return [String]
1997
+ def name=(_arg0); end
1998
+
1999
+ # @return [String]
2000
+ def type; end
2001
+
2002
+ # @return [String]
2003
+ def type=(_arg0); end
2004
+ end
2005
+
2006
+ class RBI::TStructProp < ::RBI::TStructField
2007
+ include ::RBI::Indexable
2008
+
2009
+ sig do
2010
+ params(
2011
+ name: ::String,
2012
+ type: ::String,
2013
+ default: T.nilable(::String),
2014
+ loc: T.nilable(::RBI::Loc),
2015
+ comments: T::Array[::RBI::Comment],
2016
+ block: T.nilable(T.proc.params(node: ::RBI::TStructProp).void)
2017
+ ).void
2018
+ end
2019
+ def initialize(name, type, default: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2020
+
2021
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
2022
+ def compatible_with?(other); end
2023
+
2024
+ sig { override.returns(T::Array[::String]) }
2025
+ def fully_qualified_names; end
2026
+
2027
+ sig { override.returns(T::Array[::String]) }
2028
+ def index_ids; end
2029
+
2030
+ sig { override.returns(::String) }
2031
+ def to_s; end
2032
+ end
2033
+
2034
+ class RBI::Tree < ::RBI::NodeWithComments
2035
+ sig do
2036
+ params(
2037
+ loc: T.nilable(::RBI::Loc),
2038
+ comments: T::Array[::RBI::Comment],
2039
+ block: T.nilable(T.proc.params(node: ::RBI::Tree).void)
2040
+ ).void
2041
+ end
2042
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2043
+
2044
+ sig { params(node: ::RBI::Node).void }
2045
+ def <<(node); end
2046
+
2047
+ sig { override.params(v: ::RBI::Printer).void }
2048
+ def accept_printer(v); end
2049
+
2050
+ sig { params(with_todo_comment: T::Boolean).void }
2051
+ def add_sig_templates!(with_todo_comment: T.unsafe(nil)); end
2052
+
2053
+ sig { params(annotation: ::String, annotate_scopes: T::Boolean, annotate_properties: T::Boolean).void }
2054
+ def annotate!(annotation, annotate_scopes: T.unsafe(nil), annotate_properties: T.unsafe(nil)); end
2055
+
2056
+ sig do
2057
+ params(
2058
+ name: ::String,
2059
+ superclass_name: T.nilable(::String),
2060
+ block: T.nilable(T.proc.params(scope: ::RBI::Scope).void)
2061
+ ).returns(::RBI::Scope)
2062
+ end
2063
+ def create_class(name, superclass_name: T.unsafe(nil), &block); end
2064
+
2065
+ sig { params(name: ::String, value: ::String).void }
2066
+ def create_constant(name, value:); end
2067
+
2068
+ sig { params(name: ::String).void }
2069
+ def create_extend(name); end
2070
+
2071
+ sig { params(name: ::String).void }
2072
+ def create_include(name); end
2073
+
2074
+ sig do
2075
+ params(
2076
+ name: ::String,
2077
+ parameters: T::Array[::RBI::TypedParam],
2078
+ return_type: ::String,
2079
+ class_method: T::Boolean,
2080
+ visibility: ::RBI::Visibility
2081
+ ).void
2082
+ end
2083
+ def create_method(name, parameters: T.unsafe(nil), return_type: T.unsafe(nil), class_method: T.unsafe(nil), visibility: T.unsafe(nil)); end
2084
+
2085
+ sig { params(name: ::String).void }
2086
+ def create_mixes_in_class_methods(name); end
2087
+
2088
+ sig { params(name: ::String, block: T.nilable(T.proc.params(scope: ::RBI::Scope).void)).returns(::RBI::Scope) }
2089
+ def create_module(name, &block); end
2090
+
2091
+ sig { params(constant: ::Module, block: T.nilable(T.proc.params(scope: ::RBI::Scope).void)).void }
2092
+ def create_path(constant, &block); end
2093
+
2094
+ sig do
2095
+ params(
2096
+ name: ::String,
2097
+ type: ::String,
2098
+ variance: ::Symbol,
2099
+ fixed: T.nilable(::String),
2100
+ upper: T.nilable(::String),
2101
+ lower: T.nilable(::String)
2102
+ ).void
2103
+ end
2104
+ def create_type_variable(name, type:, variance: T.unsafe(nil), fixed: T.unsafe(nil), upper: T.unsafe(nil), lower: T.unsafe(nil)); end
2105
+
2106
+ sig { params(annotation: ::String).void }
2107
+ def deannotate!(annotation); end
2108
+
2109
+ sig { returns(T::Boolean) }
2110
+ def empty?; end
2111
+
2112
+ sig { void }
2113
+ def group_nodes!; end
2114
+
2115
+ sig { returns(::RBI::Index) }
2116
+ def index; end
2117
+
2118
+ sig do
2119
+ params(
2120
+ other: ::RBI::Tree,
2121
+ left_name: ::String,
2122
+ right_name: ::String,
2123
+ keep: ::RBI::Rewriters::Merge::Keep
2124
+ ).returns(::RBI::MergeTree)
2125
+ end
2126
+ def merge(other, left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end
2127
+
2128
+ sig { void }
2129
+ def nest_non_public_methods!; end
2130
+
2131
+ sig { void }
2132
+ def nest_singleton_methods!; end
2133
+
2134
+ sig { returns(T::Array[::RBI::Node]) }
2135
+ def nodes; end
2136
+
2137
+ sig { override.returns(T::Boolean) }
2138
+ def oneline?; end
2139
+
2140
+ sig { void }
2141
+ def sort_nodes!; end
2142
+
2143
+ private
2144
+
2145
+ sig { params(node: ::RBI::Node).returns(::RBI::Node) }
2146
+ def create_node(node); end
2147
+
2148
+ sig { returns(T::Hash[::String, ::RBI::Node]) }
2149
+ def nodes_cache; end
2150
+
2151
+ sig { params(name: ::String).returns(T::Boolean) }
2152
+ def valid_method_name?(name); end
2153
+ end
2154
+
2155
+ RBI::Tree::SPECIAL_METHOD_NAMES = T.let(T.unsafe(nil), Array)
2156
+
2157
+ class RBI::TreeBuilder < ::RBI::ASTVisitor
2158
+ sig do
2159
+ params(
2160
+ file: ::String,
2161
+ comments: T::Array[::Parser::Source::Comment],
2162
+ nodes_comments_assoc: T::Hash[::Parser::Source::Map, T::Array[::Parser::Source::Comment]]
2163
+ ).void
2164
+ end
2165
+ def initialize(file:, comments: T.unsafe(nil), nodes_comments_assoc: T.unsafe(nil)); end
2166
+
2167
+ sig { returns(T.nilable(::AST::Node)) }
2168
+ def last_node; end
2169
+
2170
+ sig { void }
2171
+ def post_process; end
2172
+
2173
+ sig { returns(::RBI::Tree) }
2174
+ def tree; end
2175
+
2176
+ sig { override.params(node: T.nilable(::Object)).void }
2177
+ def visit(node); end
2178
+
2179
+ private
2180
+
2181
+ sig { void }
2182
+ def assoc_dangling_comments; end
2183
+
2184
+ sig { returns(::RBI::Tree) }
2185
+ def current_scope; end
2186
+
2187
+ sig { returns(T::Array[::RBI::Sig]) }
2188
+ def current_sigs; end
2189
+
2190
+ sig { params(node: ::AST::Node).returns(T::Array[::RBI::Comment]) }
2191
+ def node_comments(node); end
2192
+
2193
+ sig { params(node: ::AST::Node).returns(::RBI::Loc) }
2194
+ def node_loc(node); end
2195
+
2196
+ sig { params(node: ::AST::Node).returns(T.nilable(::RBI::Node)) }
2197
+ def parse_block(node); end
2198
+
2199
+ sig { params(node: ::AST::Node).returns(::RBI::Node) }
2200
+ def parse_const_assign(node); end
2201
+
2202
+ sig { params(node: ::AST::Node).returns(::RBI::Method) }
2203
+ def parse_def(node); end
2204
+
2205
+ sig { params(node: ::AST::Node).returns(::RBI::TEnumBlock) }
2206
+ def parse_enum(node); end
2207
+
2208
+ sig { params(node: ::AST::Node).returns(::RBI::Param) }
2209
+ def parse_param(node); end
2210
+
2211
+ sig { params(node: ::AST::Node).returns(::RBI::RequiresAncestor) }
2212
+ def parse_requires_ancestor(node); end
2213
+
2214
+ sig { params(node: ::AST::Node).returns(::RBI::Scope) }
2215
+ def parse_scope(node); end
2216
+
2217
+ sig { params(node: ::AST::Node).returns(T.nilable(::RBI::Node)) }
2218
+ def parse_send(node); end
2219
+
2220
+ sig { params(node: ::AST::Node).returns(T::Array[::RBI::Arg]) }
2221
+ def parse_send_args(node); end
2222
+
2223
+ sig { params(node: ::AST::Node).returns(::RBI::Sig) }
2224
+ def parse_sig(node); end
2225
+
2226
+ sig { params(node: ::AST::Node).returns(::RBI::Struct) }
2227
+ def parse_struct(node); end
2228
+
2229
+ sig { params(node: ::AST::Node).returns([::String, ::String, T.nilable(::String)]) }
2230
+ def parse_tstruct_prop(node); end
2231
+
2232
+ sig { void }
2233
+ def separate_header_comments; end
2234
+
2235
+ sig { void }
2236
+ def set_root_tree_loc; end
2237
+
2238
+ sig { params(node: ::AST::Node).returns(T::Boolean) }
2239
+ def struct_definition?(node); end
2240
+ end
2241
+
2242
+ class RBI::TypeMember < ::RBI::NodeWithComments
2243
+ sig do
2244
+ params(
2245
+ name: ::String,
2246
+ value: ::String,
2247
+ loc: T.nilable(::RBI::Loc),
2248
+ comments: T::Array[::RBI::Comment],
2249
+ block: T.nilable(T.proc.params(node: ::RBI::TypeMember).void)
2250
+ ).void
2251
+ end
2252
+ def initialize(name, value, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2253
+
2254
+ sig { override.params(v: ::RBI::Printer).void }
2255
+ def accept_printer(v); end
2256
+
2257
+ sig { returns(::String) }
2258
+ def fully_qualified_name; end
2259
+
2260
+ sig { returns(::String) }
2261
+ def name; end
2262
+
2263
+ sig { override.returns(::String) }
2264
+ def to_s; end
2265
+
2266
+ # @return [String]
2267
+ def value; end
2268
+ end
2269
+
2270
+ class RBI::UnexpectedParserError < ::StandardError
2271
+ sig { params(parent_exception: ::Exception, last_location: ::RBI::Loc).void }
2272
+ def initialize(parent_exception, last_location); end
2273
+
2274
+ sig { returns(::RBI::Loc) }
2275
+ def last_location; end
2276
+
2277
+ sig { params(io: T.any(::IO, ::StringIO)).void }
2278
+ def print_debug(io: T.unsafe(nil)); end
2279
+ end
2280
+
2281
+ RBI::VERSION = T.let(T.unsafe(nil), String)
2282
+
2283
+ # Visibility
2284
+ #
2285
+ # @abstract It cannont be directly instantiated. Subclasses must implement the `abstract` methods below.
2286
+ class RBI::Visibility < ::RBI::NodeWithComments
2287
+ abstract!
2288
+
2289
+ sig { params(visibility: ::Symbol, loc: T.nilable(::RBI::Loc), comments: T::Array[::RBI::Comment]).void }
2290
+ def initialize(visibility, loc: T.unsafe(nil), comments: T.unsafe(nil)); end
2291
+
2292
+ sig { params(other: ::RBI::Visibility).returns(T::Boolean) }
2293
+ def ==(other); end
2294
+
2295
+ sig { override.params(v: ::RBI::Printer).void }
2296
+ def accept_printer(v); end
2297
+
2298
+ sig { returns(T::Boolean) }
2299
+ def private?; end
2300
+
2301
+ sig { returns(T::Boolean) }
2302
+ def protected?; end
2303
+
2304
+ sig { returns(T::Boolean) }
2305
+ def public?; end
2306
+
2307
+ sig { returns(::Symbol) }
2308
+ def visibility; end
2309
+ end
2310
+
2311
+ class RBI::VisibilityGroup < ::RBI::Tree
2312
+ sig { params(visibility: ::RBI::Visibility).void }
2313
+ def initialize(visibility); end
2314
+
2315
+ sig { override.params(v: ::RBI::Printer).void }
2316
+ def accept_printer(v); end
2317
+
2318
+ sig { override.returns(T::Boolean) }
2319
+ def oneline?; end
2320
+
2321
+ sig { returns(::RBI::Visibility) }
2322
+ def visibility; end
2323
+ end
2324
+
2325
+ # @abstract It cannont be directly instantiated. Subclasses must implement the `abstract` methods below.
2326
+ class RBI::Visitor
2327
+ abstract!
2328
+
2329
+ def initialize(*args, **_arg1, &blk); end
2330
+
2331
+ # @abstract
2332
+ sig { abstract.params(node: T.nilable(::RBI::Node)).void }
2333
+ def visit(node); end
2334
+
2335
+ sig { params(nodes: T::Array[::RBI::Node]).void }
2336
+ def visit_all(nodes); end
2337
+ end