rbi 0.2.2 → 0.3.3

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.
data/rbi/rbi.rbi ADDED
@@ -0,0 +1,3686 @@
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 `spoom srb sigs export`.
6
+
7
+ module RBI; end
8
+
9
+ class RBI::Arg < ::RBI::Node
10
+ sig { params(value: ::String, loc: T.nilable(::RBI::Loc)).void }
11
+ def initialize(value, loc: T.unsafe(nil)); end
12
+
13
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
14
+ def ==(other); end
15
+
16
+ sig { returns(::String) }
17
+ def to_s; end
18
+
19
+ sig { returns(::String) }
20
+ def value; end
21
+ end
22
+
23
+ # Attributes
24
+ #
25
+ # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
26
+ class RBI::Attr < ::RBI::NodeWithComments
27
+ include ::RBI::Indexable
28
+
29
+ abstract!
30
+
31
+ sig do
32
+ params(
33
+ name: ::Symbol,
34
+ names: T::Array[::Symbol],
35
+ visibility: ::RBI::Visibility,
36
+ sigs: T::Array[::RBI::Sig],
37
+ loc: T.nilable(::RBI::Loc),
38
+ comments: T::Array[::RBI::Comment]
39
+ ).void
40
+ end
41
+ def initialize(name, names, visibility: T.unsafe(nil), sigs: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil)); end
42
+
43
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
44
+ def compatible_with?(other); end
45
+
46
+ # @abstract
47
+ sig { abstract.returns(T::Array[::RBI::Method]) }
48
+ def convert_to_methods; end
49
+
50
+ # @abstract
51
+ sig { abstract.returns(T::Array[::String]) }
52
+ def fully_qualified_names; end
53
+
54
+ sig { override.returns(T::Array[::String]) }
55
+ def index_ids; end
56
+
57
+ sig { override.params(other: ::RBI::Node).void }
58
+ def merge_with(other); end
59
+
60
+ sig { returns(T::Array[::Symbol]) }
61
+ def names; end
62
+
63
+ sig { returns(T::Array[::RBI::Sig]) }
64
+ def sigs; end
65
+
66
+ sig { returns(::RBI::Visibility) }
67
+ def visibility; end
68
+
69
+ # @return [Visibility]
70
+ def visibility=(_arg0); end
71
+
72
+ private
73
+
74
+ sig do
75
+ params(
76
+ name: ::String,
77
+ sig: T.nilable(::RBI::Sig),
78
+ visibility: ::RBI::Visibility,
79
+ loc: T.nilable(::RBI::Loc),
80
+ comments: T::Array[::RBI::Comment]
81
+ ).returns(::RBI::Method)
82
+ end
83
+ def create_getter_method(name, sig, visibility, loc, comments); end
84
+
85
+ sig do
86
+ params(
87
+ name: ::String,
88
+ sig: T.nilable(::RBI::Sig),
89
+ attribute_type: T.nilable(T.any(::RBI::Type, ::String)),
90
+ visibility: ::RBI::Visibility,
91
+ loc: T.nilable(::RBI::Loc),
92
+ comments: T::Array[::RBI::Comment]
93
+ ).returns(::RBI::Method)
94
+ end
95
+ def create_setter_method(name, sig, attribute_type, visibility, loc, comments); end
96
+
97
+ # @raise [UnexpectedMultipleSigsError]
98
+ sig(:final) { returns([T.nilable(::RBI::Sig), T.nilable(T.any(::RBI::Type, ::String))]) }
99
+ def parse_sig; end
100
+ end
101
+
102
+ class RBI::AttrAccessor < ::RBI::Attr
103
+ sig do
104
+ params(
105
+ name: ::Symbol,
106
+ names: ::Symbol,
107
+ visibility: ::RBI::Visibility,
108
+ sigs: T::Array[::RBI::Sig],
109
+ loc: T.nilable(::RBI::Loc),
110
+ comments: T::Array[::RBI::Comment],
111
+ block: T.nilable(T.proc.params(node: ::RBI::AttrAccessor).void)
112
+ ).void
113
+ end
114
+ def initialize(name, *names, visibility: T.unsafe(nil), sigs: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
115
+
116
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
117
+ def compatible_with?(other); end
118
+
119
+ sig { override.returns(T::Array[::RBI::Method]) }
120
+ def convert_to_methods; end
121
+
122
+ sig { override.returns(T::Array[::String]) }
123
+ def fully_qualified_names; end
124
+
125
+ sig { override.returns(::String) }
126
+ def to_s; end
127
+ end
128
+
129
+ class RBI::AttrReader < ::RBI::Attr
130
+ sig do
131
+ params(
132
+ name: ::Symbol,
133
+ names: ::Symbol,
134
+ visibility: ::RBI::Visibility,
135
+ sigs: T::Array[::RBI::Sig],
136
+ loc: T.nilable(::RBI::Loc),
137
+ comments: T::Array[::RBI::Comment],
138
+ block: T.nilable(T.proc.params(node: ::RBI::AttrReader).void)
139
+ ).void
140
+ end
141
+ def initialize(name, *names, visibility: T.unsafe(nil), sigs: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
142
+
143
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
144
+ def compatible_with?(other); end
145
+
146
+ sig { override.returns(T::Array[::RBI::Method]) }
147
+ def convert_to_methods; end
148
+
149
+ sig { override.returns(T::Array[::String]) }
150
+ def fully_qualified_names; end
151
+
152
+ sig { override.returns(::String) }
153
+ def to_s; end
154
+ end
155
+
156
+ class RBI::AttrWriter < ::RBI::Attr
157
+ sig do
158
+ params(
159
+ name: ::Symbol,
160
+ names: ::Symbol,
161
+ visibility: ::RBI::Visibility,
162
+ sigs: T::Array[::RBI::Sig],
163
+ loc: T.nilable(::RBI::Loc),
164
+ comments: T::Array[::RBI::Comment],
165
+ block: T.nilable(T.proc.params(node: ::RBI::AttrWriter).void)
166
+ ).void
167
+ end
168
+ def initialize(name, *names, visibility: T.unsafe(nil), sigs: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
169
+
170
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
171
+ def compatible_with?(other); end
172
+
173
+ sig { override.returns(T::Array[::RBI::Method]) }
174
+ def convert_to_methods; end
175
+
176
+ sig { override.returns(T::Array[::String]) }
177
+ def fully_qualified_names; end
178
+
179
+ sig { override.returns(::String) }
180
+ def to_s; end
181
+ end
182
+
183
+ # An arbitrary blank line that can be added both in trees and comments
184
+ class RBI::BlankLine < ::RBI::Comment
185
+ sig { params(loc: T.nilable(::RBI::Loc)).void }
186
+ def initialize(loc: T.unsafe(nil)); end
187
+ end
188
+
189
+ class RBI::BlockParam < ::RBI::Param
190
+ sig do
191
+ params(
192
+ name: ::String,
193
+ loc: T.nilable(::RBI::Loc),
194
+ comments: T::Array[::RBI::Comment],
195
+ block: T.nilable(T.proc.params(node: ::RBI::BlockParam).void)
196
+ ).void
197
+ end
198
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
199
+
200
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
201
+ def ==(other); end
202
+
203
+ sig { override.returns(::String) }
204
+ def to_s; end
205
+ end
206
+
207
+ class RBI::Class < ::RBI::Scope
208
+ sig do
209
+ params(
210
+ name: ::String,
211
+ superclass_name: T.nilable(::String),
212
+ loc: T.nilable(::RBI::Loc),
213
+ comments: T::Array[::RBI::Comment],
214
+ block: T.nilable(T.proc.params(node: ::RBI::Class).void)
215
+ ).void
216
+ end
217
+ def initialize(name, superclass_name: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
218
+
219
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
220
+ def compatible_with?(other); end
221
+
222
+ sig { override.returns(::String) }
223
+ def fully_qualified_name; end
224
+
225
+ sig { returns(::String) }
226
+ def name; end
227
+
228
+ # @return [String]
229
+ def name=(_arg0); end
230
+
231
+ sig { returns(T.nilable(::String)) }
232
+ def superclass_name; end
233
+
234
+ # @return [String, nil]
235
+ def superclass_name=(_arg0); end
236
+ end
237
+
238
+ class RBI::Comment < ::RBI::Node
239
+ sig { params(text: ::String, loc: T.nilable(::RBI::Loc)).void }
240
+ def initialize(text, loc: T.unsafe(nil)); end
241
+
242
+ sig { params(other: ::Object).returns(T::Boolean) }
243
+ def ==(other); end
244
+
245
+ sig { returns(::String) }
246
+ def text; end
247
+
248
+ # @return [String]
249
+ def text=(_arg0); end
250
+ end
251
+
252
+ # A tree showing incompatibles nodes
253
+ #
254
+ # Is rendered as a merge conflict between `left` and` right`:
255
+ # ~~~rb
256
+ # class Foo
257
+ # <<<<<<< left
258
+ # def m1; end
259
+ # def m2(a); end
260
+ # =======
261
+ # def m1(a); end
262
+ # def m2; end
263
+ # >>>>>>> right
264
+ # end
265
+ # ~~~
266
+ class RBI::ConflictTree < ::RBI::Tree
267
+ sig { params(left_name: ::String, right_name: ::String).void }
268
+ def initialize(left_name: T.unsafe(nil), right_name: T.unsafe(nil)); end
269
+
270
+ sig { returns(::RBI::Tree) }
271
+ def left; end
272
+
273
+ sig { returns(::String) }
274
+ def left_name; end
275
+
276
+ # @return [Tree]
277
+ def right; end
278
+
279
+ # @return [String]
280
+ def right_name; end
281
+ end
282
+
283
+ # Consts
284
+ class RBI::Const < ::RBI::NodeWithComments
285
+ include ::RBI::Indexable
286
+
287
+ sig do
288
+ params(
289
+ name: ::String,
290
+ value: ::String,
291
+ loc: T.nilable(::RBI::Loc),
292
+ comments: T::Array[::RBI::Comment],
293
+ block: T.nilable(T.proc.params(node: ::RBI::Const).void)
294
+ ).void
295
+ end
296
+ def initialize(name, value, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
297
+
298
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
299
+ def compatible_with?(other); end
300
+
301
+ sig { returns(::String) }
302
+ def fully_qualified_name; end
303
+
304
+ sig { override.returns(T::Array[::String]) }
305
+ def index_ids; end
306
+
307
+ sig { returns(::String) }
308
+ def name; end
309
+
310
+ sig { override.returns(::String) }
311
+ def to_s; end
312
+
313
+ # @return [String]
314
+ def value; end
315
+ end
316
+
317
+ class RBI::DuplicateNodeError < ::RBI::Error; end
318
+ class RBI::Error < ::StandardError; end
319
+
320
+ class RBI::Extend < ::RBI::Mixin
321
+ include ::RBI::Indexable
322
+
323
+ sig do
324
+ params(
325
+ name: ::String,
326
+ names: ::String,
327
+ loc: T.nilable(::RBI::Loc),
328
+ comments: T::Array[::RBI::Comment],
329
+ block: T.nilable(T.proc.params(node: ::RBI::Extend).void)
330
+ ).void
331
+ end
332
+ def initialize(name, *names, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
333
+
334
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
335
+ def compatible_with?(other); end
336
+
337
+ sig { override.returns(T::Array[::String]) }
338
+ def index_ids; end
339
+
340
+ sig { override.returns(::String) }
341
+ def to_s; end
342
+ end
343
+
344
+ class RBI::File
345
+ sig do
346
+ params(
347
+ strictness: T.nilable(::String),
348
+ comments: T::Array[::RBI::Comment],
349
+ block: T.nilable(T.proc.params(file: ::RBI::File).void)
350
+ ).void
351
+ end
352
+ def initialize(strictness: T.unsafe(nil), comments: T.unsafe(nil), &block); end
353
+
354
+ sig { params(node: ::RBI::Node).void }
355
+ def <<(node); end
356
+
357
+ sig { returns(T::Array[::RBI::Comment]) }
358
+ def comments; end
359
+
360
+ # @return [Array<Comment>]
361
+ def comments=(_arg0); end
362
+
363
+ sig { returns(T::Boolean) }
364
+ def empty?; end
365
+
366
+ sig do
367
+ params(
368
+ out: T.any(::IO, ::StringIO),
369
+ indent: ::Integer,
370
+ print_locs: T::Boolean,
371
+ max_line_length: T.nilable(::Integer)
372
+ ).void
373
+ end
374
+ def print(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil), max_line_length: T.unsafe(nil)); end
375
+
376
+ sig { params(out: T.any(::IO, ::StringIO), indent: ::Integer, print_locs: T::Boolean).void }
377
+ def rbs_print(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil)); end
378
+
379
+ sig { params(indent: ::Integer, print_locs: T::Boolean).returns(::String) }
380
+ def rbs_string(indent: T.unsafe(nil), print_locs: T.unsafe(nil)); end
381
+
382
+ sig { returns(::RBI::Tree) }
383
+ def root; end
384
+
385
+ # @return [Tree]
386
+ def root=(_arg0); end
387
+
388
+ sig { returns(T.nilable(::String)) }
389
+ def strictness; end
390
+
391
+ # @return [String, nil]
392
+ def strictness=(_arg0); end
393
+
394
+ sig { params(indent: ::Integer, print_locs: T::Boolean, max_line_length: T.nilable(::Integer)).returns(::String) }
395
+ def string(indent: T.unsafe(nil), print_locs: T.unsafe(nil), max_line_length: T.unsafe(nil)); end
396
+ end
397
+
398
+ class RBI::Formatter
399
+ sig do
400
+ params(
401
+ add_sig_templates: T::Boolean,
402
+ group_nodes: T::Boolean,
403
+ max_line_length: T.nilable(::Integer),
404
+ nest_singleton_methods: T::Boolean,
405
+ nest_non_public_members: T::Boolean,
406
+ sort_nodes: T::Boolean,
407
+ replace_attributes_with_methods: T::Boolean
408
+ ).void
409
+ end
410
+ 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_members: T.unsafe(nil), sort_nodes: T.unsafe(nil), replace_attributes_with_methods: T.unsafe(nil)); end
411
+
412
+ sig { params(file: ::RBI::File).void }
413
+ def format_file(file); end
414
+
415
+ sig { params(tree: ::RBI::Tree).void }
416
+ def format_tree(tree); end
417
+
418
+ sig { returns(T.nilable(::Integer)) }
419
+ def max_line_length; end
420
+
421
+ # @return [Integer, nil]
422
+ def max_line_length=(_arg0); end
423
+
424
+ sig { params(file: ::RBI::File).returns(::String) }
425
+ def print_file(file); end
426
+ end
427
+
428
+ class RBI::Group < ::RBI::Tree
429
+ sig { params(kind: ::RBI::Group::Kind).void }
430
+ def initialize(kind); end
431
+
432
+ sig { returns(::RBI::Group::Kind) }
433
+ def kind; end
434
+ end
435
+
436
+ class RBI::Group::Kind < ::T::Enum
437
+ enums do
438
+ Attrs = new
439
+ Consts = new
440
+ Helpers = new
441
+ Inits = new
442
+ Methods = new
443
+ MixesInClassMethods = new
444
+ Mixins = new
445
+ RequiredAncestors = new
446
+ Sends = new
447
+ SingletonClasses = new
448
+ TEnums = new
449
+ TStructFields = new
450
+ TypeMembers = new
451
+ end
452
+ end
453
+
454
+ class RBI::GroupNodesError < ::RBI::Error; end
455
+
456
+ # Sorbet's misc.
457
+ class RBI::Helper < ::RBI::NodeWithComments
458
+ include ::RBI::Indexable
459
+
460
+ sig do
461
+ params(
462
+ name: ::String,
463
+ loc: T.nilable(::RBI::Loc),
464
+ comments: T::Array[::RBI::Comment],
465
+ block: T.nilable(T.proc.params(node: ::RBI::Helper).void)
466
+ ).void
467
+ end
468
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
469
+
470
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
471
+ def compatible_with?(other); end
472
+
473
+ sig { override.returns(T::Array[::String]) }
474
+ def index_ids; end
475
+
476
+ sig { returns(::String) }
477
+ def name; end
478
+
479
+ sig { override.returns(::String) }
480
+ def to_s; end
481
+ end
482
+
483
+ class RBI::Include < ::RBI::Mixin
484
+ include ::RBI::Indexable
485
+
486
+ sig do
487
+ params(
488
+ name: ::String,
489
+ names: ::String,
490
+ loc: T.nilable(::RBI::Loc),
491
+ comments: T::Array[::RBI::Comment],
492
+ block: T.nilable(T.proc.params(node: ::RBI::Include).void)
493
+ ).void
494
+ end
495
+ def initialize(name, *names, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
496
+
497
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
498
+ def compatible_with?(other); end
499
+
500
+ sig { override.returns(T::Array[::String]) }
501
+ def index_ids; end
502
+
503
+ sig { override.returns(::String) }
504
+ def to_s; end
505
+ end
506
+
507
+ class RBI::Index < ::RBI::Visitor
508
+ sig { void }
509
+ def initialize; end
510
+
511
+ sig { params(id: ::String).returns(T::Array[::RBI::Node]) }
512
+ def [](id); end
513
+
514
+ sig { params(nodes: ::RBI::Node).void }
515
+ def index(*nodes); end
516
+
517
+ sig { returns(T::Array[::String]) }
518
+ def keys; end
519
+
520
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
521
+ def visit(node); end
522
+
523
+ private
524
+
525
+ sig { params(node: T.all(::RBI::Indexable, ::RBI::Node)).void }
526
+ def index_node(node); end
527
+
528
+ class << self
529
+ sig { params(node: ::RBI::Node).returns(::RBI::Index) }
530
+ def index(*node); end
531
+ end
532
+ end
533
+
534
+ # A Node that can be referred to by a unique ID inside an index
535
+ #
536
+ # @abstract Subclasses must implement the `abstract` methods below.
537
+ module RBI::Indexable
538
+ interface!
539
+
540
+ # Unique IDs that refer to this node.
541
+ #
542
+ # Some nodes can have multiple ids, for example an attribute accessor matches the ID of the
543
+ # getter and the setter.
544
+ #
545
+ # @abstract
546
+ sig { abstract.returns(T::Array[::String]) }
547
+ def index_ids; end
548
+ end
549
+
550
+ class RBI::KwArg < ::RBI::Arg
551
+ sig { params(keyword: ::String, value: ::String, loc: T.nilable(::RBI::Loc)).void }
552
+ def initialize(keyword, value, loc: T.unsafe(nil)); end
553
+
554
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
555
+ def ==(other); end
556
+
557
+ sig { returns(::String) }
558
+ def keyword; end
559
+
560
+ sig { returns(::String) }
561
+ def to_s; end
562
+ end
563
+
564
+ class RBI::KwOptParam < ::RBI::Param
565
+ sig do
566
+ params(
567
+ name: ::String,
568
+ value: ::String,
569
+ loc: T.nilable(::RBI::Loc),
570
+ comments: T::Array[::RBI::Comment],
571
+ block: T.nilable(T.proc.params(node: ::RBI::KwOptParam).void)
572
+ ).void
573
+ end
574
+ def initialize(name, value, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
575
+
576
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
577
+ def ==(other); end
578
+
579
+ sig { override.returns(::String) }
580
+ def to_s; end
581
+
582
+ sig { returns(::String) }
583
+ def value; end
584
+ end
585
+
586
+ class RBI::KwParam < ::RBI::Param
587
+ sig do
588
+ params(
589
+ name: ::String,
590
+ loc: T.nilable(::RBI::Loc),
591
+ comments: T::Array[::RBI::Comment],
592
+ block: T.nilable(T.proc.params(node: ::RBI::KwParam).void)
593
+ ).void
594
+ end
595
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
596
+
597
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
598
+ def ==(other); end
599
+
600
+ sig { override.returns(::String) }
601
+ def to_s; end
602
+ end
603
+
604
+ class RBI::KwRestParam < ::RBI::Param
605
+ sig do
606
+ params(
607
+ name: ::String,
608
+ loc: T.nilable(::RBI::Loc),
609
+ comments: T::Array[::RBI::Comment],
610
+ block: T.nilable(T.proc.params(node: ::RBI::KwRestParam).void)
611
+ ).void
612
+ end
613
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
614
+
615
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
616
+ def ==(other); end
617
+
618
+ sig { override.returns(::String) }
619
+ def to_s; end
620
+ end
621
+
622
+ class RBI::Loc
623
+ sig do
624
+ params(
625
+ file: T.nilable(::String),
626
+ begin_line: T.nilable(::Integer),
627
+ end_line: T.nilable(::Integer),
628
+ begin_column: T.nilable(::Integer),
629
+ end_column: T.nilable(::Integer)
630
+ ).void
631
+ end
632
+ 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
633
+
634
+ # @return [Integer, nil]
635
+ def begin_column; end
636
+
637
+ sig { returns(T.nilable(::Integer)) }
638
+ def begin_line; end
639
+
640
+ # @return [Integer, nil]
641
+ def end_column; end
642
+
643
+ # @return [Integer, nil]
644
+ def end_line; end
645
+
646
+ sig { returns(T.nilable(::String)) }
647
+ def file; end
648
+
649
+ sig { returns(T.nilable(::String)) }
650
+ def source; end
651
+
652
+ sig { returns(::String) }
653
+ def to_s; end
654
+
655
+ class << self
656
+ sig { params(file: ::String, prism_location: ::Prism::Location).returns(::RBI::Loc) }
657
+ def from_prism(file, prism_location); end
658
+ end
659
+ end
660
+
661
+ # A tree that _might_ contain conflicts
662
+ class RBI::MergeTree < ::RBI::Tree
663
+ sig do
664
+ params(
665
+ loc: T.nilable(::RBI::Loc),
666
+ comments: T::Array[::RBI::Comment],
667
+ conflicts: T::Array[::RBI::Rewriters::Merge::Conflict],
668
+ block: T.nilable(T.proc.params(node: ::RBI::Tree).void)
669
+ ).void
670
+ end
671
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), conflicts: T.unsafe(nil), &block); end
672
+
673
+ sig { returns(T::Array[::RBI::Rewriters::Merge::Conflict]) }
674
+ def conflicts; end
675
+ end
676
+
677
+ # Methods and args
678
+ class RBI::Method < ::RBI::NodeWithComments
679
+ include ::RBI::Indexable
680
+
681
+ sig do
682
+ params(
683
+ name: ::String,
684
+ params: T::Array[::RBI::Param],
685
+ is_singleton: T::Boolean,
686
+ visibility: ::RBI::Visibility,
687
+ sigs: T::Array[::RBI::Sig],
688
+ loc: T.nilable(::RBI::Loc),
689
+ comments: T::Array[::RBI::Comment],
690
+ block: T.nilable(T.proc.params(node: ::RBI::Method).void)
691
+ ).void
692
+ end
693
+ 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
694
+
695
+ sig { params(param: ::RBI::Param).void }
696
+ def <<(param); end
697
+
698
+ sig { params(name: ::String).void }
699
+ def add_block_param(name); end
700
+
701
+ sig { params(name: ::String, default_value: ::String).void }
702
+ def add_kw_opt_param(name, default_value); end
703
+
704
+ sig { params(name: ::String).void }
705
+ def add_kw_param(name); end
706
+
707
+ sig { params(name: ::String).void }
708
+ def add_kw_rest_param(name); end
709
+
710
+ sig { params(name: ::String, default_value: ::String).void }
711
+ def add_opt_param(name, default_value); end
712
+
713
+ sig { params(name: ::String).void }
714
+ def add_param(name); end
715
+
716
+ sig { params(name: ::String).void }
717
+ def add_rest_param(name); end
718
+
719
+ sig do
720
+ params(
721
+ params: T::Array[::RBI::SigParam],
722
+ return_type: T.any(::RBI::Type, ::String),
723
+ is_abstract: T::Boolean,
724
+ is_override: T::Boolean,
725
+ is_overridable: T::Boolean,
726
+ is_final: T::Boolean,
727
+ type_params: T::Array[::String],
728
+ checked: T.nilable(::Symbol),
729
+ block: T.nilable(T.proc.params(node: ::RBI::Sig).void)
730
+ ).void
731
+ end
732
+ def add_sig(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), &block); end
733
+
734
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
735
+ def compatible_with?(other); end
736
+
737
+ sig { returns(::String) }
738
+ def fully_qualified_name; end
739
+
740
+ sig { override.returns(T::Array[::String]) }
741
+ def index_ids; end
742
+
743
+ sig { returns(T::Boolean) }
744
+ def is_singleton; end
745
+
746
+ # @return [Boolean]
747
+ def is_singleton=(_arg0); end
748
+
749
+ sig { override.params(other: ::RBI::Node).void }
750
+ def merge_with(other); end
751
+
752
+ sig { returns(::String) }
753
+ def name; end
754
+
755
+ # @return [String]
756
+ def name=(_arg0); end
757
+
758
+ sig { returns(T::Array[::RBI::Param]) }
759
+ def params; end
760
+
761
+ sig { returns(T::Array[::RBI::Sig]) }
762
+ def sigs; end
763
+
764
+ # @return [Array<Sig>]
765
+ def sigs=(_arg0); end
766
+
767
+ sig { override.returns(::String) }
768
+ def to_s; end
769
+
770
+ sig { returns(::RBI::Visibility) }
771
+ def visibility; end
772
+
773
+ # @return [Visibility]
774
+ def visibility=(_arg0); end
775
+ end
776
+
777
+ class RBI::MixesInClassMethods < ::RBI::Mixin
778
+ include ::RBI::Indexable
779
+
780
+ sig do
781
+ params(
782
+ name: ::String,
783
+ names: ::String,
784
+ loc: T.nilable(::RBI::Loc),
785
+ comments: T::Array[::RBI::Comment],
786
+ block: T.nilable(T.proc.params(node: ::RBI::MixesInClassMethods).void)
787
+ ).void
788
+ end
789
+ def initialize(name, *names, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
790
+
791
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
792
+ def compatible_with?(other); end
793
+
794
+ sig { override.returns(T::Array[::String]) }
795
+ def index_ids; end
796
+
797
+ sig { override.returns(::String) }
798
+ def to_s; end
799
+ end
800
+
801
+ # Mixins
802
+ #
803
+ # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
804
+ class RBI::Mixin < ::RBI::NodeWithComments
805
+ abstract!
806
+
807
+ sig do
808
+ params(
809
+ name: ::String,
810
+ names: T::Array[::String],
811
+ loc: T.nilable(::RBI::Loc),
812
+ comments: T::Array[::RBI::Comment]
813
+ ).void
814
+ end
815
+ def initialize(name, names, loc: T.unsafe(nil), comments: T.unsafe(nil)); end
816
+
817
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
818
+ def compatible_with?(other); end
819
+
820
+ sig { returns(T::Array[::String]) }
821
+ def names; end
822
+ end
823
+
824
+ class RBI::Module < ::RBI::Scope
825
+ sig do
826
+ params(
827
+ name: ::String,
828
+ loc: T.nilable(::RBI::Loc),
829
+ comments: T::Array[::RBI::Comment],
830
+ block: T.nilable(T.proc.params(node: ::RBI::Module).void)
831
+ ).void
832
+ end
833
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
834
+
835
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
836
+ def compatible_with?(other); end
837
+
838
+ sig { override.returns(::String) }
839
+ def fully_qualified_name; end
840
+
841
+ sig { returns(::String) }
842
+ def name; end
843
+
844
+ # @return [String]
845
+ def name=(_arg0); end
846
+ end
847
+
848
+ # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
849
+ class RBI::Node
850
+ abstract!
851
+
852
+ sig { params(loc: T.nilable(::RBI::Loc)).void }
853
+ def initialize(loc: T.unsafe(nil)); end
854
+
855
+ # Can `self` and `_other` be merged into a single definition?
856
+ sig { params(_other: ::RBI::Node).returns(T::Boolean) }
857
+ def compatible_with?(_other); end
858
+
859
+ sig { void }
860
+ def detach; end
861
+
862
+ sig { returns(T.nilable(::RBI::Loc)) }
863
+ def loc; end
864
+
865
+ # @return [Loc, nil]
866
+ def loc=(_arg0); end
867
+
868
+ # Merge `self` and `other` into a single definition
869
+ sig { params(other: ::RBI::Node).void }
870
+ def merge_with(other); end
871
+
872
+ sig { returns(T.nilable(::RBI::ConflictTree)) }
873
+ def parent_conflict_tree; end
874
+
875
+ sig { returns(T.nilable(::RBI::Scope)) }
876
+ def parent_scope; end
877
+
878
+ sig { returns(T.nilable(::RBI::Tree)) }
879
+ def parent_tree; end
880
+
881
+ # @return [Tree, nil]
882
+ def parent_tree=(_arg0); end
883
+
884
+ sig do
885
+ params(
886
+ out: T.any(::IO, ::StringIO),
887
+ indent: ::Integer,
888
+ print_locs: T::Boolean,
889
+ max_line_length: T.nilable(::Integer)
890
+ ).void
891
+ end
892
+ def print(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil), max_line_length: T.unsafe(nil)); end
893
+
894
+ sig do
895
+ params(
896
+ out: T.any(::IO, ::StringIO),
897
+ indent: ::Integer,
898
+ print_locs: T::Boolean,
899
+ positional_names: T::Boolean
900
+ ).void
901
+ end
902
+ def rbs_print(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil), positional_names: T.unsafe(nil)); end
903
+
904
+ sig { params(indent: ::Integer, print_locs: T::Boolean, positional_names: T::Boolean).returns(::String) }
905
+ def rbs_string(indent: T.unsafe(nil), print_locs: T.unsafe(nil), positional_names: T.unsafe(nil)); end
906
+
907
+ # @raise [ReplaceNodeError]
908
+ sig { params(node: ::RBI::Node).void }
909
+ def replace(node); end
910
+
911
+ sig { params(version: ::Gem::Version).returns(T::Boolean) }
912
+ def satisfies_version?(version); end
913
+
914
+ sig { params(indent: ::Integer, print_locs: T::Boolean, max_line_length: T.nilable(::Integer)).returns(::String) }
915
+ def string(indent: T.unsafe(nil), print_locs: T.unsafe(nil), max_line_length: T.unsafe(nil)); end
916
+ end
917
+
918
+ # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
919
+ class RBI::NodeWithComments < ::RBI::Node
920
+ abstract!
921
+
922
+ sig { params(loc: T.nilable(::RBI::Loc), comments: T::Array[::RBI::Comment]).void }
923
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil)); end
924
+
925
+ sig { returns(T::Array[::String]) }
926
+ def annotations; end
927
+
928
+ sig { returns(T::Array[::RBI::Comment]) }
929
+ def comments; end
930
+
931
+ # @return [Array<Comment>]
932
+ def comments=(_arg0); end
933
+
934
+ sig { override.params(other: ::RBI::Node).void }
935
+ def merge_with(other); end
936
+
937
+ sig { returns(T::Array[::Gem::Requirement]) }
938
+ def version_requirements; end
939
+ end
940
+
941
+ class RBI::OptParam < ::RBI::Param
942
+ sig do
943
+ params(
944
+ name: ::String,
945
+ value: ::String,
946
+ loc: T.nilable(::RBI::Loc),
947
+ comments: T::Array[::RBI::Comment],
948
+ block: T.nilable(T.proc.params(node: ::RBI::OptParam).void)
949
+ ).void
950
+ end
951
+ def initialize(name, value, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
952
+
953
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
954
+ def ==(other); end
955
+
956
+ sig { returns(::String) }
957
+ def value; end
958
+ end
959
+
960
+ # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
961
+ class RBI::Param < ::RBI::NodeWithComments
962
+ abstract!
963
+
964
+ sig { params(name: ::String, loc: T.nilable(::RBI::Loc), comments: T::Array[::RBI::Comment]).void }
965
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil)); end
966
+
967
+ sig { returns(::String) }
968
+ def name; end
969
+
970
+ sig { override.returns(::String) }
971
+ def to_s; end
972
+ end
973
+
974
+ class RBI::ParseError < ::RBI::Error
975
+ sig { params(message: ::String, location: ::RBI::Loc).void }
976
+ def initialize(message, location); end
977
+
978
+ sig { returns(::RBI::Loc) }
979
+ def location; end
980
+ end
981
+
982
+ class RBI::Parser
983
+ sig { params(path: ::String).returns(::RBI::Tree) }
984
+ def parse_file(path); end
985
+
986
+ sig { params(string: ::String).returns(::RBI::Tree) }
987
+ def parse_string(string); end
988
+
989
+ private
990
+
991
+ sig { params(source: ::String, file: ::String).returns(::RBI::Tree) }
992
+ def parse(source, file:); end
993
+
994
+ class << self
995
+ sig { params(path: ::String).returns(::RBI::Tree) }
996
+ def parse_file(path); end
997
+
998
+ sig { params(paths: T::Array[::String]).returns(T::Array[::RBI::Tree]) }
999
+ def parse_files(paths); end
1000
+
1001
+ sig { params(string: ::String).returns(::RBI::Tree) }
1002
+ def parse_string(string); end
1003
+
1004
+ sig { params(strings: T::Array[::String]).returns(T::Array[::RBI::Tree]) }
1005
+ def parse_strings(strings); end
1006
+ end
1007
+ end
1008
+
1009
+ class RBI::Parser::HeredocLocationVisitor < ::Prism::Visitor
1010
+ sig { params(source: ::Prism::Source, begin_offset: ::Integer, end_offset: ::Integer).void }
1011
+ def initialize(source, begin_offset, end_offset); end
1012
+
1013
+ sig { returns(::Prism::Location) }
1014
+ def location; end
1015
+
1016
+ sig { override.params(node: ::Prism::InterpolatedStringNode).void }
1017
+ def visit_interpolated_string_node(node); end
1018
+
1019
+ sig { override.params(node: ::Prism::StringNode).void }
1020
+ def visit_string_node(node); end
1021
+
1022
+ private
1023
+
1024
+ sig { params(node: T.any(::Prism::InterpolatedStringNode, ::Prism::StringNode)).void }
1025
+ def handle_string_node(node); end
1026
+ end
1027
+
1028
+ class RBI::Parser::SigBuilder < ::RBI::Parser::Visitor
1029
+ sig { params(content: ::String, file: ::String).void }
1030
+ def initialize(content, file:); end
1031
+
1032
+ sig { returns(::RBI::Sig) }
1033
+ def current; end
1034
+
1035
+ sig { override.params(node: ::Prism::AssocNode).void }
1036
+ def visit_assoc_node(node); end
1037
+
1038
+ sig { override.params(node: ::Prism::CallNode).void }
1039
+ def visit_call_node(node); end
1040
+ end
1041
+
1042
+ class RBI::Parser::TreeBuilder < ::RBI::Parser::Visitor
1043
+ sig { params(source: ::String, comments: T::Array[::Prism::Comment], file: ::String).void }
1044
+ def initialize(source, comments:, file:); end
1045
+
1046
+ sig { returns(T.nilable(::Prism::Node)) }
1047
+ def last_node; end
1048
+
1049
+ sig { returns(::RBI::Tree) }
1050
+ def tree; end
1051
+
1052
+ sig { params(node: ::Prism::CallNode).void }
1053
+ def visit_call_node(node); end
1054
+
1055
+ sig { override.params(node: ::Prism::ClassNode).void }
1056
+ def visit_class_node(node); end
1057
+
1058
+ sig { params(node: T.any(::Prism::ConstantPathWriteNode, ::Prism::ConstantWriteNode)).void }
1059
+ def visit_constant_assign(node); end
1060
+
1061
+ sig { override.params(node: ::Prism::ConstantPathWriteNode).void }
1062
+ def visit_constant_path_write_node(node); end
1063
+
1064
+ sig { override.params(node: ::Prism::ConstantWriteNode).void }
1065
+ def visit_constant_write_node(node); end
1066
+
1067
+ sig { override.params(node: ::Prism::DefNode).void }
1068
+ def visit_def_node(node); end
1069
+
1070
+ sig { override.params(node: ::Prism::ModuleNode).void }
1071
+ def visit_module_node(node); end
1072
+
1073
+ sig { override.params(node: ::Prism::ProgramNode).void }
1074
+ def visit_program_node(node); end
1075
+
1076
+ sig { override.params(node: ::Prism::SingletonClassNode).void }
1077
+ def visit_singleton_class_node(node); end
1078
+
1079
+ private
1080
+
1081
+ # Collect all the remaining comments within a node
1082
+ sig { params(node: ::Prism::Node).void }
1083
+ def collect_dangling_comments(node); end
1084
+
1085
+ # Collect all the remaining comments after visiting the tree
1086
+ sig { void }
1087
+ def collect_orphan_comments; end
1088
+
1089
+ sig { returns(::RBI::Tree) }
1090
+ def current_scope; end
1091
+
1092
+ sig { returns(T::Array[::RBI::Sig]) }
1093
+ def current_sigs; end
1094
+
1095
+ sig { params(sigs: T::Array[::RBI::Sig]).returns(T::Array[::RBI::Comment]) }
1096
+ def detach_comments_from_sigs(sigs); end
1097
+
1098
+ sig { params(node: ::Prism::Node).returns(T::Array[::RBI::Comment]) }
1099
+ def node_comments(node); end
1100
+
1101
+ sig { params(node: ::Prism::Comment).returns(::RBI::Comment) }
1102
+ def parse_comment(node); end
1103
+
1104
+ sig { params(node: T.nilable(::Prism::Node)).returns(T::Array[::RBI::Param]) }
1105
+ def parse_params(node); end
1106
+
1107
+ sig { params(node: T.nilable(::Prism::Node)).returns(T::Array[::RBI::Arg]) }
1108
+ def parse_send_args(node); end
1109
+
1110
+ sig { params(node: ::Prism::CallNode).returns(::RBI::Sig) }
1111
+ def parse_sig(node); end
1112
+
1113
+ sig do
1114
+ params(
1115
+ node: T.any(::Prism::ConstantPathWriteNode, ::Prism::ConstantWriteNode)
1116
+ ).returns(T.nilable(::RBI::Struct))
1117
+ end
1118
+ def parse_struct(node); end
1119
+
1120
+ sig { params(send: ::Prism::CallNode).void }
1121
+ def parse_tstruct_field(send); end
1122
+
1123
+ sig { params(name: ::String, node: ::Prism::Node).returns(::RBI::Visibility) }
1124
+ def parse_visibility(name, node); end
1125
+
1126
+ sig { void }
1127
+ def separate_header_comments; end
1128
+
1129
+ sig { void }
1130
+ def set_root_tree_loc; end
1131
+
1132
+ sig { params(node: T.nilable(::Prism::Node)).returns(T::Boolean) }
1133
+ def t_enum_value?(node); end
1134
+
1135
+ sig { params(node: T.nilable(::Prism::Node)).returns(T::Boolean) }
1136
+ def type_variable_definition?(node); end
1137
+ end
1138
+
1139
+ class RBI::Parser::Visitor < ::Prism::Visitor
1140
+ sig { params(source: ::String, file: ::String).void }
1141
+ def initialize(source, file:); end
1142
+
1143
+ private
1144
+
1145
+ sig { params(node: ::Prism::Node).returns(::Prism::Location) }
1146
+ def adjust_prism_location_for_heredoc(node); end
1147
+
1148
+ sig { params(node: ::Prism::Node).returns(::RBI::Loc) }
1149
+ def node_loc(node); end
1150
+
1151
+ sig { params(node: T.nilable(::Prism::Node)).returns(T.nilable(::String)) }
1152
+ def node_string(node); end
1153
+
1154
+ sig { params(node: ::Prism::Node).returns(::String) }
1155
+ def node_string!(node); end
1156
+
1157
+ sig { params(node: T.nilable(::Prism::Node)).returns(T::Boolean) }
1158
+ def self?(node); end
1159
+
1160
+ sig { params(node: T.nilable(::Prism::Node)).returns(T::Boolean) }
1161
+ def t_sig_without_runtime?(node); end
1162
+ end
1163
+
1164
+ class RBI::Printer < ::RBI::Visitor
1165
+ sig do
1166
+ params(
1167
+ out: T.any(::IO, ::StringIO),
1168
+ indent: ::Integer,
1169
+ print_locs: T::Boolean,
1170
+ max_line_length: T.nilable(::Integer)
1171
+ ).void
1172
+ end
1173
+ def initialize(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil), max_line_length: T.unsafe(nil)); end
1174
+
1175
+ sig { returns(::Integer) }
1176
+ def current_indent; end
1177
+
1178
+ sig { void }
1179
+ def dedent; end
1180
+
1181
+ # @return [Boolean]
1182
+ def in_visibility_group; end
1183
+
1184
+ # @return [Boolean]
1185
+ def in_visibility_group=(_arg0); end
1186
+
1187
+ # Printing
1188
+ sig { void }
1189
+ def indent; end
1190
+
1191
+ sig { returns(T.nilable(::Integer)) }
1192
+ def max_line_length; end
1193
+
1194
+ sig { returns(T.nilable(::RBI::Node)) }
1195
+ def previous_node; end
1196
+
1197
+ # Print a string without indentation nor `\n` at the end.
1198
+ sig { params(string: ::String).void }
1199
+ def print(string); end
1200
+
1201
+ sig { returns(T::Boolean) }
1202
+ def print_locs; end
1203
+
1204
+ # @return [Boolean]
1205
+ def print_locs=(_arg0); end
1206
+
1207
+ # Print a string with indentation and `\n` at the end.
1208
+ sig { params(string: ::String).void }
1209
+ def printl(string); end
1210
+
1211
+ # Print a string without indentation but with a `\n` at the end.
1212
+ sig { params(string: T.nilable(::String)).void }
1213
+ def printn(string = T.unsafe(nil)); end
1214
+
1215
+ # Print a string with indentation but without a `\n` at the end.
1216
+ sig { params(string: T.nilable(::String)).void }
1217
+ def printt(string = T.unsafe(nil)); end
1218
+
1219
+ sig { override.params(nodes: T::Array[::RBI::Node]).void }
1220
+ def visit_all(nodes); end
1221
+
1222
+ sig { override.params(file: ::RBI::File).void }
1223
+ def visit_file(file); end
1224
+
1225
+ private
1226
+
1227
+ sig { params(node: ::RBI::Node).returns(T::Boolean) }
1228
+ def oneline?(node); end
1229
+
1230
+ sig { params(node: ::RBI::Node).void }
1231
+ def print_blank_line_before(node); end
1232
+
1233
+ sig { params(node: ::RBI::Node).void }
1234
+ def print_loc(node); end
1235
+
1236
+ sig { params(node: ::RBI::Param, last: T::Boolean).void }
1237
+ def print_param_comment_leading_space(node, last:); end
1238
+
1239
+ sig { params(node: ::RBI::Sig).void }
1240
+ def print_sig_as_block(node); end
1241
+
1242
+ sig { params(node: ::RBI::Sig).void }
1243
+ def print_sig_as_line(node); end
1244
+
1245
+ sig { params(node: ::RBI::SigParam, last: T::Boolean).void }
1246
+ def print_sig_param_comment_leading_space(node, last:); end
1247
+
1248
+ sig { params(node: ::RBI::Sig).returns(T::Array[::String]) }
1249
+ def sig_modifiers(node); end
1250
+
1251
+ sig { override.params(node: ::RBI::Arg).void }
1252
+ def visit_arg(node); end
1253
+
1254
+ sig { params(node: ::RBI::Attr).void }
1255
+ def visit_attr(node); end
1256
+
1257
+ sig { override.params(node: ::RBI::AttrAccessor).void }
1258
+ def visit_attr_accessor(node); end
1259
+
1260
+ sig { override.params(node: ::RBI::AttrReader).void }
1261
+ def visit_attr_reader(node); end
1262
+
1263
+ sig { override.params(node: ::RBI::AttrWriter).void }
1264
+ def visit_attr_writer(node); end
1265
+
1266
+ sig { override.params(node: ::RBI::BlankLine).void }
1267
+ def visit_blank_line(node); end
1268
+
1269
+ sig { override.params(node: ::RBI::BlockParam).void }
1270
+ def visit_block_param(node); end
1271
+
1272
+ sig { override.params(node: ::RBI::Class).void }
1273
+ def visit_class(node); end
1274
+
1275
+ sig { override.params(node: ::RBI::Comment).void }
1276
+ def visit_comment(node); end
1277
+
1278
+ sig { override.params(node: ::RBI::ConflictTree).void }
1279
+ def visit_conflict_tree(node); end
1280
+
1281
+ sig { override.params(node: ::RBI::Const).void }
1282
+ def visit_const(node); end
1283
+
1284
+ sig { override.params(node: ::RBI::Extend).void }
1285
+ def visit_extend(node); end
1286
+
1287
+ sig { override.params(node: ::RBI::Group).void }
1288
+ def visit_group(node); end
1289
+
1290
+ sig { override.params(node: ::RBI::Helper).void }
1291
+ def visit_helper(node); end
1292
+
1293
+ sig { override.params(node: ::RBI::Include).void }
1294
+ def visit_include(node); end
1295
+
1296
+ sig { override.params(node: ::RBI::KwArg).void }
1297
+ def visit_kw_arg(node); end
1298
+
1299
+ sig { override.params(node: ::RBI::KwOptParam).void }
1300
+ def visit_kw_opt_param(node); end
1301
+
1302
+ sig { override.params(node: ::RBI::KwParam).void }
1303
+ def visit_kw_param(node); end
1304
+
1305
+ sig { override.params(node: ::RBI::KwRestParam).void }
1306
+ def visit_kw_rest_param(node); end
1307
+
1308
+ sig { override.params(node: ::RBI::Method).void }
1309
+ def visit_method(node); end
1310
+
1311
+ sig { override.params(node: ::RBI::MixesInClassMethods).void }
1312
+ def visit_mixes_in_class_methods(node); end
1313
+
1314
+ sig { params(node: ::RBI::Mixin).void }
1315
+ def visit_mixin(node); end
1316
+
1317
+ sig { override.params(node: ::RBI::Module).void }
1318
+ def visit_module(node); end
1319
+
1320
+ sig { override.params(node: ::RBI::OptParam).void }
1321
+ def visit_opt_param(node); end
1322
+
1323
+ sig { override.params(node: ::RBI::Private).void }
1324
+ def visit_private(node); end
1325
+
1326
+ sig { override.params(node: ::RBI::Protected).void }
1327
+ def visit_protected(node); end
1328
+
1329
+ sig { override.params(node: ::RBI::Public).void }
1330
+ def visit_public(node); end
1331
+
1332
+ sig { override.params(node: ::RBI::RBSComment).void }
1333
+ def visit_rbs_comment(node); end
1334
+
1335
+ sig { override.params(node: ::RBI::ReqParam).void }
1336
+ def visit_req_param(node); end
1337
+
1338
+ sig { override.params(node: ::RBI::RequiresAncestor).void }
1339
+ def visit_requires_ancestor(node); end
1340
+
1341
+ sig { override.params(node: ::RBI::RestParam).void }
1342
+ def visit_rest_param(node); end
1343
+
1344
+ sig { params(node: ::RBI::Scope).void }
1345
+ def visit_scope(node); end
1346
+
1347
+ sig { params(node: ::RBI::Scope).void }
1348
+ def visit_scope_body(node); end
1349
+
1350
+ sig { override.params(node: ::RBI::ScopeConflict).void }
1351
+ def visit_scope_conflict(node); end
1352
+
1353
+ sig { params(node: ::RBI::Scope).void }
1354
+ def visit_scope_header(node); end
1355
+
1356
+ sig { override.params(node: ::RBI::Send).void }
1357
+ def visit_send(node); end
1358
+
1359
+ sig { override.params(node: ::RBI::Sig).void }
1360
+ def visit_sig(node); end
1361
+
1362
+ sig { override.params(node: ::RBI::SigParam).void }
1363
+ def visit_sig_param(node); end
1364
+
1365
+ sig { override.params(node: ::RBI::SingletonClass).void }
1366
+ def visit_singleton_class(node); end
1367
+
1368
+ sig { override.params(node: ::RBI::Struct).void }
1369
+ def visit_struct(node); end
1370
+
1371
+ sig { params(node: ::RBI::TStructField).void }
1372
+ def visit_t_struct_field(node); end
1373
+
1374
+ sig { override.params(node: ::RBI::TEnum).void }
1375
+ def visit_tenum(node); end
1376
+
1377
+ sig { override.params(node: ::RBI::TEnumBlock).void }
1378
+ def visit_tenum_block(node); end
1379
+
1380
+ sig { override.params(node: ::RBI::TEnumValue).void }
1381
+ def visit_tenum_value(node); end
1382
+
1383
+ sig { override.params(node: ::RBI::Tree).void }
1384
+ def visit_tree(node); end
1385
+
1386
+ sig { override.params(node: ::RBI::TStruct).void }
1387
+ def visit_tstruct(node); end
1388
+
1389
+ sig { override.params(node: ::RBI::TStructConst).void }
1390
+ def visit_tstruct_const(node); end
1391
+
1392
+ sig { override.params(node: ::RBI::TStructProp).void }
1393
+ def visit_tstruct_prop(node); end
1394
+
1395
+ sig { override.params(node: ::RBI::TypeMember).void }
1396
+ def visit_type_member(node); end
1397
+
1398
+ sig { params(node: ::RBI::Visibility).void }
1399
+ def visit_visibility(node); end
1400
+
1401
+ sig { override.params(node: ::RBI::VisibilityGroup).void }
1402
+ def visit_visibility_group(node); end
1403
+ end
1404
+
1405
+ class RBI::PrinterError < ::RBI::Error; end
1406
+
1407
+ class RBI::Private < ::RBI::Visibility
1408
+ sig do
1409
+ params(
1410
+ loc: T.nilable(::RBI::Loc),
1411
+ comments: T::Array[::RBI::Comment],
1412
+ block: T.nilable(T.proc.params(node: ::RBI::Private).void)
1413
+ ).void
1414
+ end
1415
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1416
+ end
1417
+
1418
+ class RBI::Protected < ::RBI::Visibility
1419
+ sig do
1420
+ params(
1421
+ loc: T.nilable(::RBI::Loc),
1422
+ comments: T::Array[::RBI::Comment],
1423
+ block: T.nilable(T.proc.params(node: ::RBI::Protected).void)
1424
+ ).void
1425
+ end
1426
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1427
+ end
1428
+
1429
+ class RBI::Public < ::RBI::Visibility
1430
+ sig do
1431
+ params(
1432
+ loc: T.nilable(::RBI::Loc),
1433
+ comments: T::Array[::RBI::Comment],
1434
+ block: T.nilable(T.proc.params(node: ::RBI::Public).void)
1435
+ ).void
1436
+ end
1437
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1438
+ end
1439
+
1440
+ module RBI::RBS; end
1441
+
1442
+ class RBI::RBS::MethodTypeTranslator
1443
+ sig { params(method: ::RBI::Method).void }
1444
+ def initialize(method); end
1445
+
1446
+ sig { returns(::RBI::Sig) }
1447
+ def result; end
1448
+
1449
+ sig { params(type: ::RBS::MethodType).void }
1450
+ def visit(type); end
1451
+
1452
+ private
1453
+
1454
+ sig { params(param: ::RBS::Types::Function::Param, index: ::Integer).returns(::RBI::SigParam) }
1455
+ def translate_function_param(param, index); end
1456
+
1457
+ sig { params(type: T.untyped).returns(::RBI::Type) }
1458
+ def translate_type(type); end
1459
+
1460
+ # @raise [Error]
1461
+ sig { params(type: ::RBS::Types::Block).void }
1462
+ def visit_block_type(type); end
1463
+
1464
+ sig { params(type: ::RBS::Types::Function).void }
1465
+ def visit_function_type(type); end
1466
+
1467
+ class << self
1468
+ sig { params(method: ::RBI::Method, type: ::RBS::MethodType).returns(::RBI::Sig) }
1469
+ def translate(method, type); end
1470
+ end
1471
+ end
1472
+
1473
+ class RBI::RBS::MethodTypeTranslator::Error < ::RBI::Error; end
1474
+
1475
+ class RBI::RBS::TypeTranslator
1476
+ class << self
1477
+ sig do
1478
+ params(
1479
+ type: T.any(::RBS::Types::Alias, ::RBS::Types::Bases::Any, ::RBS::Types::Bases::Bool, ::RBS::Types::Bases::Bottom, ::RBS::Types::Bases::Class, ::RBS::Types::Bases::Instance, ::RBS::Types::Bases::Nil, ::RBS::Types::Bases::Self, ::RBS::Types::Bases::Top, ::RBS::Types::Bases::Void, ::RBS::Types::ClassInstance, ::RBS::Types::ClassSingleton, ::RBS::Types::Function, ::RBS::Types::Interface, ::RBS::Types::Intersection, ::RBS::Types::Literal, ::RBS::Types::Optional, ::RBS::Types::Proc, ::RBS::Types::Record, ::RBS::Types::Tuple, ::RBS::Types::Union, ::RBS::Types::UntypedFunction, ::RBS::Types::Variable)
1480
+ ).returns(::RBI::Type)
1481
+ end
1482
+ def translate(type); end
1483
+
1484
+ private
1485
+
1486
+ sig { params(type: ::RBS::Types::ClassInstance).returns(::RBI::Type) }
1487
+ def translate_class_instance(type); end
1488
+
1489
+ sig { params(type: ::RBS::Types::Function).returns(::RBI::Type) }
1490
+ def translate_function(type); end
1491
+
1492
+ sig { params(type_name: ::String).returns(::String) }
1493
+ def translate_t_generic_type(type_name); end
1494
+ end
1495
+ end
1496
+
1497
+ # A comment representing a RBS type prefixed with `#:`
1498
+ class RBI::RBSComment < ::RBI::Comment
1499
+ sig { params(other: ::Object).returns(T::Boolean) }
1500
+ def ==(other); end
1501
+ end
1502
+
1503
+ class RBI::RBSPrinter < ::RBI::Visitor
1504
+ sig do
1505
+ params(
1506
+ out: T.any(::IO, ::StringIO),
1507
+ indent: ::Integer,
1508
+ print_locs: T::Boolean,
1509
+ positional_names: T::Boolean
1510
+ ).void
1511
+ end
1512
+ def initialize(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil), positional_names: T.unsafe(nil)); end
1513
+
1514
+ sig { returns(::Integer) }
1515
+ def current_indent; end
1516
+
1517
+ sig { void }
1518
+ def dedent; end
1519
+
1520
+ # @return [Boolean]
1521
+ def in_visibility_group; end
1522
+
1523
+ # @return [Boolean]
1524
+ def in_visibility_group=(_arg0); end
1525
+
1526
+ # Printing
1527
+ sig { void }
1528
+ def indent; end
1529
+
1530
+ sig { returns(T::Boolean) }
1531
+ def positional_names; end
1532
+
1533
+ # @return [Boolean]
1534
+ def positional_names=(_arg0); end
1535
+
1536
+ sig { returns(T.nilable(::RBI::Node)) }
1537
+ def previous_node; end
1538
+
1539
+ # Print a string without indentation nor `\n` at the end.
1540
+ sig { params(string: ::String).void }
1541
+ def print(string); end
1542
+
1543
+ sig { params(node: ::RBI::Attr, sig: ::RBI::Sig).void }
1544
+ def print_attr_sig(node, sig); end
1545
+
1546
+ sig { returns(T::Boolean) }
1547
+ def print_locs; end
1548
+
1549
+ # @return [Boolean]
1550
+ def print_locs=(_arg0); end
1551
+
1552
+ sig { params(node: ::RBI::Method, sig: ::RBI::Sig).void }
1553
+ def print_method_sig(node, sig); end
1554
+
1555
+ # Print a string with indentation and `\n` at the end.
1556
+ sig { params(string: ::String).void }
1557
+ def printl(string); end
1558
+
1559
+ # Print a string without indentation but with a `\n` at the end.
1560
+ sig { params(string: T.nilable(::String)).void }
1561
+ def printn(string = T.unsafe(nil)); end
1562
+
1563
+ # Print a string with indentation but without a `\n` at the end.
1564
+ sig { params(string: T.nilable(::String)).void }
1565
+ def printt(string = T.unsafe(nil)); end
1566
+
1567
+ sig { override.params(nodes: T::Array[::RBI::Node]).void }
1568
+ def visit_all(nodes); end
1569
+
1570
+ sig { override.params(node: ::RBI::Arg).void }
1571
+ def visit_arg(node); end
1572
+
1573
+ sig { params(node: ::RBI::Attr).void }
1574
+ def visit_attr(node); end
1575
+
1576
+ sig { override.params(node: ::RBI::AttrAccessor).void }
1577
+ def visit_attr_accessor(node); end
1578
+
1579
+ sig { override.params(node: ::RBI::AttrReader).void }
1580
+ def visit_attr_reader(node); end
1581
+
1582
+ sig { override.params(node: ::RBI::AttrWriter).void }
1583
+ def visit_attr_writer(node); end
1584
+
1585
+ sig { override.params(node: ::RBI::BlankLine).void }
1586
+ def visit_blank_line(node); end
1587
+
1588
+ sig { override.params(node: ::RBI::BlockParam).void }
1589
+ def visit_block_param(node); end
1590
+
1591
+ sig { override.params(node: ::RBI::Class).void }
1592
+ def visit_class(node); end
1593
+
1594
+ sig { override.params(node: ::RBI::Comment).void }
1595
+ def visit_comment(node); end
1596
+
1597
+ sig { override.params(node: ::RBI::ConflictTree).void }
1598
+ def visit_conflict_tree(node); end
1599
+
1600
+ sig { override.params(node: ::RBI::Const).void }
1601
+ def visit_const(node); end
1602
+
1603
+ sig { override.params(node: ::RBI::Extend).void }
1604
+ def visit_extend(node); end
1605
+
1606
+ sig { override.params(file: ::RBI::File).void }
1607
+ def visit_file(file); end
1608
+
1609
+ sig { override.params(node: ::RBI::Group).void }
1610
+ def visit_group(node); end
1611
+
1612
+ sig { override.params(node: ::RBI::Helper).void }
1613
+ def visit_helper(node); end
1614
+
1615
+ sig { override.params(node: ::RBI::Include).void }
1616
+ def visit_include(node); end
1617
+
1618
+ sig { override.params(node: ::RBI::KwArg).void }
1619
+ def visit_kw_arg(node); end
1620
+
1621
+ sig { override.params(node: ::RBI::KwOptParam).void }
1622
+ def visit_kw_opt_param(node); end
1623
+
1624
+ sig { override.params(node: ::RBI::KwParam).void }
1625
+ def visit_kw_param(node); end
1626
+
1627
+ sig { override.params(node: ::RBI::KwRestParam).void }
1628
+ def visit_kw_rest_param(node); end
1629
+
1630
+ sig { override.params(node: ::RBI::Method).void }
1631
+ def visit_method(node); end
1632
+
1633
+ sig { override.params(node: ::RBI::MixesInClassMethods).void }
1634
+ def visit_mixes_in_class_methods(node); end
1635
+
1636
+ sig { params(node: ::RBI::Mixin).void }
1637
+ def visit_mixin(node); end
1638
+
1639
+ sig { override.params(node: ::RBI::Module).void }
1640
+ def visit_module(node); end
1641
+
1642
+ sig { override.params(node: ::RBI::OptParam).void }
1643
+ def visit_opt_param(node); end
1644
+
1645
+ sig { override.params(node: ::RBI::Private).void }
1646
+ def visit_private(node); end
1647
+
1648
+ sig { override.params(node: ::RBI::Protected).void }
1649
+ def visit_protected(node); end
1650
+
1651
+ sig { override.params(node: ::RBI::Public).void }
1652
+ def visit_public(node); end
1653
+
1654
+ sig { override.params(node: ::RBI::ReqParam).void }
1655
+ def visit_req_param(node); end
1656
+
1657
+ sig { override.params(node: ::RBI::RequiresAncestor).void }
1658
+ def visit_requires_ancestor(node); end
1659
+
1660
+ sig { override.params(node: ::RBI::RestParam).void }
1661
+ def visit_rest_param(node); end
1662
+
1663
+ sig { params(node: ::RBI::Scope).void }
1664
+ def visit_scope(node); end
1665
+
1666
+ sig { params(node: ::RBI::Scope).void }
1667
+ def visit_scope_body(node); end
1668
+
1669
+ sig { override.params(node: ::RBI::ScopeConflict).void }
1670
+ def visit_scope_conflict(node); end
1671
+
1672
+ sig { params(node: ::RBI::Scope).void }
1673
+ def visit_scope_header(node); end
1674
+
1675
+ sig { override.params(node: ::RBI::Send).void }
1676
+ def visit_send(node); end
1677
+
1678
+ sig { params(node: ::RBI::Sig).void }
1679
+ def visit_sig(node); end
1680
+
1681
+ sig { params(node: ::RBI::SigParam).void }
1682
+ def visit_sig_param(node); end
1683
+
1684
+ sig { override.params(node: ::RBI::SingletonClass).void }
1685
+ def visit_singleton_class(node); end
1686
+
1687
+ sig { override.params(node: ::RBI::Struct).void }
1688
+ def visit_struct(node); end
1689
+
1690
+ sig { override.params(node: ::RBI::TEnum).void }
1691
+ def visit_tenum(node); end
1692
+
1693
+ sig { override.params(node: ::RBI::TEnumBlock).void }
1694
+ def visit_tenum_block(node); end
1695
+
1696
+ sig { override.params(node: ::RBI::TEnumValue).void }
1697
+ def visit_tenum_value(node); end
1698
+
1699
+ sig { override.params(node: ::RBI::Tree).void }
1700
+ def visit_tree(node); end
1701
+
1702
+ sig { override.params(node: ::RBI::TStruct).void }
1703
+ def visit_tstruct(node); end
1704
+
1705
+ sig { override.params(node: ::RBI::TStructConst).void }
1706
+ def visit_tstruct_const(node); end
1707
+
1708
+ sig { override.params(node: ::RBI::TStructProp).void }
1709
+ def visit_tstruct_prop(node); end
1710
+
1711
+ sig { override.params(node: ::RBI::TypeMember).void }
1712
+ def visit_type_member(node); end
1713
+
1714
+ sig { params(node: ::RBI::Visibility).void }
1715
+ def visit_visibility(node); end
1716
+
1717
+ sig { override.params(node: ::RBI::VisibilityGroup).void }
1718
+ def visit_visibility_group(node); end
1719
+
1720
+ private
1721
+
1722
+ sig { params(node: ::RBI::Node).returns(T::Boolean) }
1723
+ def oneline?(node); end
1724
+
1725
+ # Parse a string containing a `T.let(x, X)` and extract the type
1726
+ #
1727
+ # Returns `nil` is the string is not a `T.let`.
1728
+ sig { params(code: T.nilable(::String)).returns(T.nilable(::String)) }
1729
+ def parse_t_let(code); end
1730
+
1731
+ sig { params(type: T.any(::RBI::Type, ::String)).returns(::RBI::Type) }
1732
+ def parse_type(type); end
1733
+
1734
+ sig { params(node: ::RBI::Node).void }
1735
+ def print_blank_line_before(node); end
1736
+
1737
+ sig { params(node: ::RBI::Node).void }
1738
+ def print_loc(node); end
1739
+
1740
+ sig { params(node: ::RBI::Param, last: T::Boolean).void }
1741
+ def print_param_comment_leading_space(node, last:); end
1742
+
1743
+ sig { params(node: ::RBI::Method, param: ::RBI::SigParam).void }
1744
+ def print_sig_param(node, param); end
1745
+
1746
+ sig { params(node: ::RBI::SigParam, last: T::Boolean).void }
1747
+ def print_sig_param_comment_leading_space(node, last:); end
1748
+ end
1749
+
1750
+ class RBI::RBSPrinter::Error < ::RBI::Error; end
1751
+ class RBI::ReplaceNodeError < ::RBI::Error; end
1752
+
1753
+ class RBI::ReqParam < ::RBI::Param
1754
+ sig do
1755
+ params(
1756
+ name: ::String,
1757
+ loc: T.nilable(::RBI::Loc),
1758
+ comments: T::Array[::RBI::Comment],
1759
+ block: T.nilable(T.proc.params(node: ::RBI::ReqParam).void)
1760
+ ).void
1761
+ end
1762
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1763
+
1764
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
1765
+ def ==(other); end
1766
+ end
1767
+
1768
+ class RBI::RequiresAncestor < ::RBI::NodeWithComments
1769
+ include ::RBI::Indexable
1770
+
1771
+ sig { params(name: ::String, loc: T.nilable(::RBI::Loc), comments: T::Array[::RBI::Comment]).void }
1772
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil)); end
1773
+
1774
+ sig { override.returns(T::Array[::String]) }
1775
+ def index_ids; end
1776
+
1777
+ sig { returns(::String) }
1778
+ def name; end
1779
+
1780
+ sig { override.returns(::String) }
1781
+ def to_s; end
1782
+ end
1783
+
1784
+ class RBI::RestParam < ::RBI::Param
1785
+ sig do
1786
+ params(
1787
+ name: ::String,
1788
+ loc: T.nilable(::RBI::Loc),
1789
+ comments: T::Array[::RBI::Comment],
1790
+ block: T.nilable(T.proc.params(node: ::RBI::RestParam).void)
1791
+ ).void
1792
+ end
1793
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
1794
+
1795
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
1796
+ def ==(other); end
1797
+
1798
+ sig { override.returns(::String) }
1799
+ def to_s; end
1800
+ end
1801
+
1802
+ module RBI::Rewriters; end
1803
+
1804
+ class RBI::Rewriters::AddSigTemplates < ::RBI::Visitor
1805
+ sig { params(with_todo_comment: T::Boolean).void }
1806
+ def initialize(with_todo_comment: T.unsafe(nil)); end
1807
+
1808
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1809
+ def visit(node); end
1810
+
1811
+ private
1812
+
1813
+ sig { params(attr: ::RBI::Attr).void }
1814
+ def add_attr_sig(attr); end
1815
+
1816
+ sig { params(method: ::RBI::Method).void }
1817
+ def add_method_sig(method); end
1818
+
1819
+ sig { params(node: ::RBI::NodeWithComments).void }
1820
+ def add_todo_comment(node); end
1821
+ end
1822
+
1823
+ class RBI::Rewriters::Annotate < ::RBI::Visitor
1824
+ sig { params(annotation: ::String, annotate_scopes: T::Boolean, annotate_properties: T::Boolean).void }
1825
+ def initialize(annotation, annotate_scopes: T.unsafe(nil), annotate_properties: T.unsafe(nil)); end
1826
+
1827
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1828
+ def visit(node); end
1829
+
1830
+ private
1831
+
1832
+ sig { params(node: ::RBI::NodeWithComments).void }
1833
+ def annotate_node(node); end
1834
+
1835
+ sig { params(node: ::RBI::Node).returns(T::Boolean) }
1836
+ def root?(node); end
1837
+ end
1838
+
1839
+ class RBI::Rewriters::AttrToMethods < ::RBI::Visitor
1840
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1841
+ def visit(node); end
1842
+
1843
+ private
1844
+
1845
+ # @raise [ReplaceNodeError]
1846
+ sig { params(node: ::RBI::Node, with: T::Array[::RBI::Node]).void }
1847
+ def replace(node, with:); end
1848
+ end
1849
+
1850
+ class RBI::Rewriters::Deannotate < ::RBI::Visitor
1851
+ sig { params(annotation: ::String).void }
1852
+ def initialize(annotation); end
1853
+
1854
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1855
+ def visit(node); end
1856
+
1857
+ private
1858
+
1859
+ sig { params(node: ::RBI::NodeWithComments).void }
1860
+ def deannotate_node(node); end
1861
+ end
1862
+
1863
+ # Take a gem version and filter out all RBI that is not relevant to that version based on @version annotations
1864
+ # in comments. As an example:
1865
+ #
1866
+ # ~~~rb
1867
+ # tree = Parser.parse_string(<<~RBI)
1868
+ # class Foo
1869
+ # # @version > 0.3.0
1870
+ # def bar
1871
+ # end
1872
+ #
1873
+ # # @version <= 0.3.0
1874
+ # def bar(arg1)
1875
+ # end
1876
+ # end
1877
+ # RBI
1878
+ #
1879
+ # Rewriters::FilterVersions.filter(tree, Gem::Version.new("0.3.1"))
1880
+ #
1881
+ # assert_equal(<<~RBI, tree.string)
1882
+ # class Foo
1883
+ # # @version > 0.3.0
1884
+ # def bar
1885
+ # end
1886
+ # end
1887
+ # RBI
1888
+ # ~~~
1889
+ #
1890
+ # Supported operators:
1891
+ # - equals `=`
1892
+ # - not equals `!=`
1893
+ # - greater than `>`
1894
+ # - greater than or equal to `>=`
1895
+ # - less than `<`
1896
+ # - less than or equal to `<=`
1897
+ # - pessimistic or twiddle-wakka`~>`
1898
+ #
1899
+ # And/or logic:
1900
+ # - "And" logic: put multiple versions on the same line
1901
+ # - e.g. `@version > 0.3.0, <1.0.0` means version must be greater than 0.3.0 AND less than 1.0.0
1902
+ # - "Or" logic: put multiple versions on subsequent lines
1903
+ # - e.g. the following means version must be less than 0.3.0 OR greater than 1.0.0
1904
+ # ```
1905
+ # # @version < 0.3.0
1906
+ # # @version > 1.0.0
1907
+ # ```
1908
+ # Prerelease versions:
1909
+ # - Prerelease versions are considered less than their non-prerelease counterparts
1910
+ # - e.g. `0.4.0-prerelease` is less than `0.4.0`
1911
+ #
1912
+ # RBI with no versions:
1913
+ # - RBI with no version annotations are automatically counted towards ALL versions
1914
+ class RBI::Rewriters::FilterVersions < ::RBI::Visitor
1915
+ sig { params(version: ::Gem::Version).void }
1916
+ def initialize(version); end
1917
+
1918
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1919
+ def visit(node); end
1920
+
1921
+ class << self
1922
+ sig { params(tree: ::RBI::Tree, version: ::Gem::Version).void }
1923
+ def filter(tree, version); end
1924
+ end
1925
+ end
1926
+
1927
+ RBI::Rewriters::FilterVersions::VERSION_PREFIX = T.let(T.unsafe(nil), String)
1928
+
1929
+ # Rewrite non-singleton methods inside singleton classes to singleton methods
1930
+ #
1931
+ # Example:
1932
+ # ~~~rb
1933
+ # class << self
1934
+ # def m1; end
1935
+ # def self.m2; end
1936
+ #
1937
+ # class << self
1938
+ # def m3; end
1939
+ # end
1940
+ # end
1941
+ # ~~~
1942
+ #
1943
+ # will be rewritten to:
1944
+ #
1945
+ # ~~~rb
1946
+ # def self.m1; end
1947
+ #
1948
+ # class << self
1949
+ # def self.m2; end
1950
+ # def self.m3; end
1951
+ # end
1952
+ # ~~~
1953
+ class RBI::Rewriters::FlattenSingletonMethods < ::RBI::Visitor
1954
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1955
+ def visit(node); end
1956
+ end
1957
+
1958
+ # Flattens visibility nodes into method nodes
1959
+ #
1960
+ # Example:
1961
+ # ~~~rb
1962
+ # class A
1963
+ # def m1; end
1964
+ # private
1965
+ # def m2; end
1966
+ # def m3; end
1967
+ # end
1968
+ # ~~~
1969
+ #
1970
+ # will be transformed into:
1971
+ #
1972
+ # ~~~rb
1973
+ # class A
1974
+ # def m1; end
1975
+ # private def m2; end
1976
+ # private def m3; end
1977
+ # end
1978
+ # ~~~
1979
+ class RBI::Rewriters::FlattenVisibilities < ::RBI::Visitor
1980
+ sig { void }
1981
+ def initialize; end
1982
+
1983
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1984
+ def visit(node); end
1985
+ end
1986
+
1987
+ class RBI::Rewriters::GroupNodes < ::RBI::Visitor
1988
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
1989
+ def visit(node); end
1990
+
1991
+ private
1992
+
1993
+ sig { params(node: ::RBI::Node).returns(::RBI::Group::Kind) }
1994
+ def group_kind(node); end
1995
+ end
1996
+
1997
+ # Merge two RBI trees together
1998
+ #
1999
+ # Be this `Tree`:
2000
+ # ~~~rb
2001
+ # class Foo
2002
+ # attr_accessor :a
2003
+ # def m; end
2004
+ # C = 10
2005
+ # end
2006
+ # ~~~
2007
+ #
2008
+ # Merged with this one:
2009
+ # ~~~rb
2010
+ # class Foo
2011
+ # attr_reader :a
2012
+ # def m(x); end
2013
+ # C = 10
2014
+ # end
2015
+ # ~~~
2016
+ #
2017
+ # Compatible definitions are merged together while incompatible definitions are moved into a `ConflictTree`:
2018
+ # ~~~rb
2019
+ # class Foo
2020
+ # <<<<<<< left
2021
+ # attr_accessor :a
2022
+ # def m; end
2023
+ # =======
2024
+ # attr_reader :a
2025
+ # def m(x); end
2026
+ # >>>>>>> right
2027
+ # C = 10
2028
+ # end
2029
+ # ~~~
2030
+ class RBI::Rewriters::Merge
2031
+ sig { params(left_name: ::String, right_name: ::String, keep: ::RBI::Rewriters::Merge::Keep).void }
2032
+ def initialize(left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end
2033
+
2034
+ sig { params(tree: ::RBI::Tree).void }
2035
+ def merge(tree); end
2036
+
2037
+ sig { returns(::RBI::MergeTree) }
2038
+ def tree; end
2039
+
2040
+ class << self
2041
+ sig do
2042
+ params(
2043
+ left: ::RBI::Tree,
2044
+ right: ::RBI::Tree,
2045
+ left_name: ::String,
2046
+ right_name: ::String,
2047
+ keep: ::RBI::Rewriters::Merge::Keep
2048
+ ).returns(::RBI::MergeTree)
2049
+ end
2050
+ def merge_trees(left, right, left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end
2051
+ end
2052
+ end
2053
+
2054
+ # Used for logging / error displaying purpose
2055
+ class RBI::Rewriters::Merge::Conflict < ::T::Struct
2056
+ const :left, ::RBI::Node
2057
+ const :right, ::RBI::Node
2058
+ const :left_name, ::String
2059
+ const :right_name, ::String
2060
+
2061
+ sig { returns(::String) }
2062
+ def to_s; end
2063
+
2064
+ class << self
2065
+ def inherited(s); end
2066
+ end
2067
+ end
2068
+
2069
+ # Merge adjacent conflict trees
2070
+ #
2071
+ # Transform this:
2072
+ # ~~~rb
2073
+ # class Foo
2074
+ # <<<<<<< left
2075
+ # def m1; end
2076
+ # =======
2077
+ # def m1(a); end
2078
+ # >>>>>>> right
2079
+ # <<<<<<< left
2080
+ # def m2(a); end
2081
+ # =======
2082
+ # def m2; end
2083
+ # >>>>>>> right
2084
+ # end
2085
+ # ~~~
2086
+ #
2087
+ # Into this:
2088
+ # ~~~rb
2089
+ # class Foo
2090
+ # <<<<<<< left
2091
+ # def m1; end
2092
+ # def m2(a); end
2093
+ # =======
2094
+ # def m1(a); end
2095
+ # def m2; end
2096
+ # >>>>>>> right
2097
+ # end
2098
+ # ~~~
2099
+ class RBI::Rewriters::Merge::ConflictTreeMerger < ::RBI::Visitor
2100
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
2101
+ def visit(node); end
2102
+
2103
+ sig { override.params(nodes: T::Array[::RBI::Node]).void }
2104
+ def visit_all(nodes); end
2105
+
2106
+ private
2107
+
2108
+ sig { params(left: ::RBI::Tree, right: ::RBI::Tree).void }
2109
+ def merge_conflict_trees(left, right); end
2110
+ end
2111
+
2112
+ class RBI::Rewriters::Merge::Keep < ::T::Enum
2113
+ enums do
2114
+ LEFT = new
2115
+ NONE = new
2116
+ RIGHT = new
2117
+ end
2118
+ end
2119
+
2120
+ class RBI::Rewriters::Merge::TreeMerger < ::RBI::Visitor
2121
+ sig do
2122
+ params(
2123
+ output: ::RBI::Tree,
2124
+ left_name: ::String,
2125
+ right_name: ::String,
2126
+ keep: ::RBI::Rewriters::Merge::Keep
2127
+ ).void
2128
+ end
2129
+ def initialize(output, left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end
2130
+
2131
+ sig { returns(T::Array[::RBI::Rewriters::Merge::Conflict]) }
2132
+ def conflicts; end
2133
+
2134
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
2135
+ def visit(node); end
2136
+
2137
+ private
2138
+
2139
+ sig { returns(::RBI::Tree) }
2140
+ def current_scope; end
2141
+
2142
+ sig { params(left: ::RBI::Scope, right: ::RBI::Scope).void }
2143
+ def make_conflict_scope(left, right); end
2144
+
2145
+ sig { params(left: ::RBI::Node, right: ::RBI::Node).void }
2146
+ def make_conflict_tree(left, right); end
2147
+
2148
+ sig { params(node: ::RBI::Node).returns(T.nilable(::RBI::Node)) }
2149
+ def previous_definition(node); end
2150
+
2151
+ sig { params(left: ::RBI::Scope, right: ::RBI::Scope).returns(::RBI::Scope) }
2152
+ def replace_scope_header(left, right); end
2153
+ end
2154
+
2155
+ class RBI::Rewriters::NestNonPublicMembers < ::RBI::Visitor
2156
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
2157
+ def visit(node); end
2158
+ end
2159
+
2160
+ class RBI::Rewriters::NestSingletonMethods < ::RBI::Visitor
2161
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
2162
+ def visit(node); end
2163
+ end
2164
+
2165
+ # This rewriter moves top-level members into a top-level Object class
2166
+ #
2167
+ # Example:
2168
+ # ~~~rb
2169
+ # def foo; end
2170
+ # attr_reader :bar
2171
+ # ~~~
2172
+ #
2173
+ # will be rewritten to:
2174
+ #
2175
+ # ~~~rb
2176
+ # class Object
2177
+ # def foo; end
2178
+ # attr_reader :bar
2179
+ # end
2180
+ # ~~~
2181
+ class RBI::Rewriters::NestTopLevelMembers < ::RBI::Visitor
2182
+ sig { void }
2183
+ def initialize; end
2184
+
2185
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
2186
+ def visit(node); end
2187
+ end
2188
+
2189
+ # Remove all definitions existing in the index from the current tree
2190
+ #
2191
+ # Let's create an `Index` from two different `Tree`s:
2192
+ # ~~~rb
2193
+ # tree1 = Parse.parse_string(<<~RBI)
2194
+ # class Foo
2195
+ # def foo; end
2196
+ # end
2197
+ # RBI
2198
+ #
2199
+ # tree2 = Parse.parse_string(<<~RBI)
2200
+ # FOO = 10
2201
+ # RBI
2202
+ #
2203
+ # index = Index.index(tree1, tree2)
2204
+ # ~~~
2205
+ #
2206
+ # We can use `RemoveKnownDefinitions` to remove the definitions found in the `index` from the `Tree` to clean:
2207
+ # ~~~rb
2208
+ # tree_to_clean = Parser.parse_string(<<~RBI)
2209
+ # class Foo
2210
+ # def foo; end
2211
+ # def bar; end
2212
+ # end
2213
+ # FOO = 10
2214
+ # BAR = 42
2215
+ # RBI
2216
+ #
2217
+ # cleaned_tree, operations = RemoveKnownDefinitions.remove(tree_to_clean, index)
2218
+ #
2219
+ # assert_equal(<<~RBI, cleaned_tree)
2220
+ # class Foo
2221
+ # def bar; end
2222
+ # end
2223
+ # BAR = 42
2224
+ # RBI
2225
+ #
2226
+ # assert_equal(<<~OPERATIONS, operations.join("\n"))
2227
+ # Deleted ::Foo#foo at -:2:2-2-16 (duplicate from -:2:2-2:16)
2228
+ # Deleted ::FOO at -:5:0-5:8 (duplicate from -:1:0-1:8)
2229
+ # OPERATIONS
2230
+ # ~~~
2231
+ class RBI::Rewriters::RemoveKnownDefinitions < ::RBI::Visitor
2232
+ sig { params(index: ::RBI::Index).void }
2233
+ def initialize(index); end
2234
+
2235
+ sig { returns(T::Array[::RBI::Rewriters::RemoveKnownDefinitions::Operation]) }
2236
+ def operations; end
2237
+
2238
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
2239
+ def visit(node); end
2240
+
2241
+ sig { params(nodes: T::Array[::RBI::Node]).void }
2242
+ def visit_all(nodes); end
2243
+
2244
+ private
2245
+
2246
+ sig { params(node: ::RBI::Node, previous: ::RBI::Node).returns(T::Boolean) }
2247
+ def can_delete_node?(node, previous); end
2248
+
2249
+ sig { params(node: ::RBI::Node, previous: ::RBI::Node).void }
2250
+ def delete_node(node, previous); end
2251
+
2252
+ sig { params(node: ::RBI::Indexable).returns(T.nilable(::RBI::Node)) }
2253
+ def previous_definition_for(node); end
2254
+
2255
+ class << self
2256
+ sig do
2257
+ params(
2258
+ tree: ::RBI::Tree,
2259
+ index: ::RBI::Index
2260
+ ).returns([::RBI::Tree, T::Array[::RBI::Rewriters::RemoveKnownDefinitions::Operation]])
2261
+ end
2262
+ def remove(tree, index); end
2263
+ end
2264
+ end
2265
+
2266
+ class RBI::Rewriters::RemoveKnownDefinitions::Operation < ::T::Struct
2267
+ const :deleted_node, ::RBI::Node
2268
+ const :duplicate_of, ::RBI::Node
2269
+
2270
+ sig { returns(::String) }
2271
+ def to_s; end
2272
+
2273
+ class << self
2274
+ def inherited(s); end
2275
+ end
2276
+ end
2277
+
2278
+ class RBI::Rewriters::SortNodes < ::RBI::Visitor
2279
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
2280
+ def visit(node); end
2281
+
2282
+ private
2283
+
2284
+ sig { params(kind: ::RBI::Group::Kind).returns(::Integer) }
2285
+ def group_rank(kind); end
2286
+
2287
+ sig { params(node: ::RBI::Node).returns(T.nilable(::String)) }
2288
+ def node_name(node); end
2289
+
2290
+ sig { params(node: ::RBI::Node).returns(::Integer) }
2291
+ def node_rank(node); end
2292
+
2293
+ sig { params(node: ::RBI::Node).void }
2294
+ def sort_node_names!(node); end
2295
+ end
2296
+
2297
+ # Translate all RBS signature comments to Sorbet RBI signatures
2298
+ class RBI::Rewriters::TranslateRBSSigs < ::RBI::Visitor
2299
+ sig { override.params(node: T.nilable(::RBI::Node)).void }
2300
+ def visit(node); end
2301
+
2302
+ private
2303
+
2304
+ sig { params(node: T.any(::RBI::Attr, ::RBI::Method)).returns(T::Array[::RBI::RBSComment]) }
2305
+ def extract_rbs_comments(node); end
2306
+
2307
+ sig { params(node: ::RBI::Attr, comment: ::RBI::RBSComment).returns(::RBI::Sig) }
2308
+ def translate_rbs_attr_type(node, comment); end
2309
+
2310
+ sig { params(node: ::RBI::Method, comment: ::RBI::RBSComment).returns(::RBI::Sig) }
2311
+ def translate_rbs_method_type(node, comment); end
2312
+ end
2313
+
2314
+ class RBI::Rewriters::TranslateRBSSigs::Error < ::RBI::Error; end
2315
+
2316
+ # Scopes
2317
+ #
2318
+ # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
2319
+ class RBI::Scope < ::RBI::Tree
2320
+ include ::RBI::Indexable
2321
+
2322
+ abstract!
2323
+
2324
+ # Duplicate `self` scope without its body
2325
+ sig { returns(T.self_type) }
2326
+ def dup_empty; end
2327
+
2328
+ # @abstract
2329
+ sig { abstract.returns(::String) }
2330
+ def fully_qualified_name; end
2331
+
2332
+ sig { override.returns(T::Array[::String]) }
2333
+ def index_ids; end
2334
+
2335
+ sig { override.returns(::String) }
2336
+ def to_s; end
2337
+ end
2338
+
2339
+ # A conflict between two scope headers
2340
+ #
2341
+ # Is rendered as a merge conflict between `left` and` right` for scope definitions:
2342
+ # ~~~rb
2343
+ # <<<<<<< left
2344
+ # class Foo
2345
+ # =======
2346
+ # module Foo
2347
+ # >>>>>>> right
2348
+ # def m1; end
2349
+ # end
2350
+ # ~~~
2351
+ class RBI::ScopeConflict < ::RBI::Tree
2352
+ sig { params(left: ::RBI::Scope, right: ::RBI::Scope, left_name: ::String, right_name: ::String).void }
2353
+ def initialize(left:, right:, left_name: T.unsafe(nil), right_name: T.unsafe(nil)); end
2354
+
2355
+ sig { returns(::RBI::Scope) }
2356
+ def left; end
2357
+
2358
+ sig { returns(::String) }
2359
+ def left_name; end
2360
+
2361
+ # @return [Scope]
2362
+ def right; end
2363
+
2364
+ # @return [String]
2365
+ def right_name; end
2366
+ end
2367
+
2368
+ # Sends
2369
+ class RBI::Send < ::RBI::NodeWithComments
2370
+ include ::RBI::Indexable
2371
+
2372
+ sig do
2373
+ params(
2374
+ method: ::String,
2375
+ args: T::Array[::RBI::Arg],
2376
+ loc: T.nilable(::RBI::Loc),
2377
+ comments: T::Array[::RBI::Comment],
2378
+ block: T.nilable(T.proc.params(node: ::RBI::Send).void)
2379
+ ).void
2380
+ end
2381
+ def initialize(method, args = T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2382
+
2383
+ sig { params(arg: ::RBI::Arg).void }
2384
+ def <<(arg); end
2385
+
2386
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
2387
+ def ==(other); end
2388
+
2389
+ sig { returns(T::Array[::RBI::Arg]) }
2390
+ def args; end
2391
+
2392
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
2393
+ def compatible_with?(other); end
2394
+
2395
+ sig { override.returns(T::Array[::String]) }
2396
+ def index_ids; end
2397
+
2398
+ sig { returns(::String) }
2399
+ def method; end
2400
+
2401
+ sig { returns(::String) }
2402
+ def to_s; end
2403
+ end
2404
+
2405
+ # Sorbet's sigs
2406
+ class RBI::Sig < ::RBI::NodeWithComments
2407
+ sig do
2408
+ params(
2409
+ params: T::Array[::RBI::SigParam],
2410
+ return_type: T.any(::RBI::Type, ::String),
2411
+ is_abstract: T::Boolean,
2412
+ is_override: T::Boolean,
2413
+ is_overridable: T::Boolean,
2414
+ is_final: T::Boolean,
2415
+ allow_incompatible_override: T::Boolean,
2416
+ without_runtime: T::Boolean,
2417
+ type_params: T::Array[::String],
2418
+ checked: T.nilable(::Symbol),
2419
+ loc: T.nilable(::RBI::Loc),
2420
+ comments: T::Array[::RBI::Comment],
2421
+ block: T.nilable(T.proc.params(node: ::RBI::Sig).void)
2422
+ ).void
2423
+ end
2424
+ 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), allow_incompatible_override: T.unsafe(nil), without_runtime: T.unsafe(nil), type_params: T.unsafe(nil), checked: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2425
+
2426
+ sig { params(param: ::RBI::SigParam).void }
2427
+ def <<(param); end
2428
+
2429
+ sig { params(other: ::Object).returns(T::Boolean) }
2430
+ def ==(other); end
2431
+
2432
+ sig { params(name: ::String, type: T.any(::RBI::Type, ::String)).void }
2433
+ def add_param(name, type); end
2434
+
2435
+ # @return [Boolean]
2436
+ def allow_incompatible_override; end
2437
+
2438
+ # @return [Boolean]
2439
+ def allow_incompatible_override=(_arg0); end
2440
+
2441
+ sig { returns(T.nilable(::Symbol)) }
2442
+ def checked; end
2443
+
2444
+ # @return [Symbol, nil]
2445
+ def checked=(_arg0); end
2446
+
2447
+ sig { returns(T::Boolean) }
2448
+ def is_abstract; end
2449
+
2450
+ # @return [Boolean]
2451
+ def is_abstract=(_arg0); end
2452
+
2453
+ # @return [Boolean]
2454
+ def is_final; end
2455
+
2456
+ # @return [Boolean]
2457
+ def is_final=(_arg0); end
2458
+
2459
+ # @return [Boolean]
2460
+ def is_overridable; end
2461
+
2462
+ # @return [Boolean]
2463
+ def is_overridable=(_arg0); end
2464
+
2465
+ # @return [Boolean]
2466
+ def is_override; end
2467
+
2468
+ # @return [Boolean]
2469
+ def is_override=(_arg0); end
2470
+
2471
+ sig { returns(T::Array[::RBI::SigParam]) }
2472
+ def params; end
2473
+
2474
+ sig { returns(T.any(::RBI::Type, ::String)) }
2475
+ def return_type; end
2476
+
2477
+ # @return [Type, String]
2478
+ def return_type=(_arg0); end
2479
+
2480
+ sig { returns(T::Array[::String]) }
2481
+ def type_params; end
2482
+
2483
+ # @return [Boolean]
2484
+ def without_runtime; end
2485
+
2486
+ # @return [Boolean]
2487
+ def without_runtime=(_arg0); end
2488
+ end
2489
+
2490
+ class RBI::SigParam < ::RBI::NodeWithComments
2491
+ sig do
2492
+ params(
2493
+ name: ::String,
2494
+ type: T.any(::RBI::Type, ::String),
2495
+ loc: T.nilable(::RBI::Loc),
2496
+ comments: T::Array[::RBI::Comment],
2497
+ block: T.nilable(T.proc.params(node: ::RBI::SigParam).void)
2498
+ ).void
2499
+ end
2500
+ def initialize(name, type, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2501
+
2502
+ sig { params(other: ::Object).returns(T::Boolean) }
2503
+ def ==(other); end
2504
+
2505
+ sig { returns(::String) }
2506
+ def name; end
2507
+
2508
+ sig { returns(T.any(::RBI::Type, ::String)) }
2509
+ def type; end
2510
+ end
2511
+
2512
+ class RBI::SingletonClass < ::RBI::Scope
2513
+ sig do
2514
+ params(
2515
+ loc: T.nilable(::RBI::Loc),
2516
+ comments: T::Array[::RBI::Comment],
2517
+ block: T.nilable(T.proc.params(node: ::RBI::SingletonClass).void)
2518
+ ).void
2519
+ end
2520
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2521
+
2522
+ sig { override.returns(::String) }
2523
+ def fully_qualified_name; end
2524
+ end
2525
+
2526
+ class RBI::Struct < ::RBI::Scope
2527
+ sig do
2528
+ params(
2529
+ name: ::String,
2530
+ members: T::Array[::Symbol],
2531
+ keyword_init: T::Boolean,
2532
+ loc: T.nilable(::RBI::Loc),
2533
+ comments: T::Array[::RBI::Comment],
2534
+ block: T.nilable(T.proc.params(struct: ::RBI::Struct).void)
2535
+ ).void
2536
+ end
2537
+ def initialize(name, members: T.unsafe(nil), keyword_init: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2538
+
2539
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
2540
+ def compatible_with?(other); end
2541
+
2542
+ sig { override.returns(::String) }
2543
+ def fully_qualified_name; end
2544
+
2545
+ sig { returns(T::Boolean) }
2546
+ def keyword_init; end
2547
+
2548
+ # @return [Boolean]
2549
+ def keyword_init=(_arg0); end
2550
+
2551
+ sig { returns(T::Array[::Symbol]) }
2552
+ def members; end
2553
+
2554
+ # @return [Array<Symbol>]
2555
+ def members=(_arg0); end
2556
+
2557
+ sig { returns(::String) }
2558
+ def name; end
2559
+
2560
+ # @return [String]
2561
+ def name=(_arg0); end
2562
+ end
2563
+
2564
+ # Sorbet's T::Enum
2565
+ class RBI::TEnum < ::RBI::Class
2566
+ sig do
2567
+ params(
2568
+ name: ::String,
2569
+ loc: T.nilable(::RBI::Loc),
2570
+ comments: T::Array[::RBI::Comment],
2571
+ block: T.nilable(T.proc.params(klass: ::RBI::TEnum).void)
2572
+ ).void
2573
+ end
2574
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2575
+ end
2576
+
2577
+ class RBI::TEnumBlock < ::RBI::Scope
2578
+ sig do
2579
+ params(
2580
+ loc: T.nilable(::RBI::Loc),
2581
+ comments: T::Array[::RBI::Comment],
2582
+ block: T.nilable(T.proc.params(node: ::RBI::TEnumBlock).void)
2583
+ ).void
2584
+ end
2585
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2586
+
2587
+ sig { override.returns(::String) }
2588
+ def fully_qualified_name; end
2589
+
2590
+ sig { override.returns(T::Array[::String]) }
2591
+ def index_ids; end
2592
+
2593
+ sig { override.returns(::String) }
2594
+ def to_s; end
2595
+ end
2596
+
2597
+ class RBI::TEnumValue < ::RBI::NodeWithComments
2598
+ include ::RBI::Indexable
2599
+
2600
+ sig do
2601
+ params(
2602
+ name: ::String,
2603
+ loc: T.nilable(::RBI::Loc),
2604
+ comments: T::Array[::RBI::Comment],
2605
+ block: T.nilable(T.proc.params(node: ::RBI::TEnumValue).void)
2606
+ ).void
2607
+ end
2608
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2609
+
2610
+ sig { returns(::String) }
2611
+ def fully_qualified_name; end
2612
+
2613
+ sig { override.returns(T::Array[::String]) }
2614
+ def index_ids; end
2615
+
2616
+ sig { returns(::String) }
2617
+ def name; end
2618
+
2619
+ sig { override.returns(::String) }
2620
+ def to_s; end
2621
+ end
2622
+
2623
+ # Sorbet's T::Struct
2624
+ class RBI::TStruct < ::RBI::Class
2625
+ sig do
2626
+ params(
2627
+ name: ::String,
2628
+ loc: T.nilable(::RBI::Loc),
2629
+ comments: T::Array[::RBI::Comment],
2630
+ block: T.nilable(T.proc.params(klass: ::RBI::TStruct).void)
2631
+ ).void
2632
+ end
2633
+ def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2634
+ end
2635
+
2636
+ class RBI::TStructConst < ::RBI::TStructField
2637
+ include ::RBI::Indexable
2638
+
2639
+ sig do
2640
+ params(
2641
+ name: ::String,
2642
+ type: T.any(::RBI::Type, ::String),
2643
+ default: T.nilable(::String),
2644
+ loc: T.nilable(::RBI::Loc),
2645
+ comments: T::Array[::RBI::Comment],
2646
+ block: T.nilable(T.proc.params(node: ::RBI::TStructConst).void)
2647
+ ).void
2648
+ end
2649
+ def initialize(name, type, default: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2650
+
2651
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
2652
+ def compatible_with?(other); end
2653
+
2654
+ sig { override.returns(T::Array[::String]) }
2655
+ def fully_qualified_names; end
2656
+
2657
+ sig { override.returns(T::Array[::String]) }
2658
+ def index_ids; end
2659
+
2660
+ sig { override.returns(::String) }
2661
+ def to_s; end
2662
+ end
2663
+
2664
+ # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
2665
+ class RBI::TStructField < ::RBI::NodeWithComments
2666
+ abstract!
2667
+
2668
+ sig do
2669
+ params(
2670
+ name: ::String,
2671
+ type: T.any(::RBI::Type, ::String),
2672
+ default: T.nilable(::String),
2673
+ loc: T.nilable(::RBI::Loc),
2674
+ comments: T::Array[::RBI::Comment]
2675
+ ).void
2676
+ end
2677
+ def initialize(name, type, default: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil)); end
2678
+
2679
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
2680
+ def compatible_with?(other); end
2681
+
2682
+ sig { returns(T.nilable(::String)) }
2683
+ def default; end
2684
+
2685
+ # @return [String, nil]
2686
+ def default=(_arg0); end
2687
+
2688
+ # @abstract
2689
+ sig { abstract.returns(T::Array[::String]) }
2690
+ def fully_qualified_names; end
2691
+
2692
+ sig { returns(::String) }
2693
+ def name; end
2694
+
2695
+ # @return [String]
2696
+ def name=(_arg0); end
2697
+
2698
+ sig { returns(T.any(::RBI::Type, ::String)) }
2699
+ def type; end
2700
+
2701
+ # @return [Type, String]
2702
+ def type=(_arg0); end
2703
+ end
2704
+
2705
+ class RBI::TStructProp < ::RBI::TStructField
2706
+ include ::RBI::Indexable
2707
+
2708
+ sig do
2709
+ params(
2710
+ name: ::String,
2711
+ type: T.any(::RBI::Type, ::String),
2712
+ default: T.nilable(::String),
2713
+ loc: T.nilable(::RBI::Loc),
2714
+ comments: T::Array[::RBI::Comment],
2715
+ block: T.nilable(T.proc.params(node: ::RBI::TStructProp).void)
2716
+ ).void
2717
+ end
2718
+ def initialize(name, type, default: T.unsafe(nil), loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2719
+
2720
+ sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
2721
+ def compatible_with?(other); end
2722
+
2723
+ sig { override.returns(T::Array[::String]) }
2724
+ def fully_qualified_names; end
2725
+
2726
+ sig { override.returns(T::Array[::String]) }
2727
+ def index_ids; end
2728
+
2729
+ sig { override.returns(::String) }
2730
+ def to_s; end
2731
+ end
2732
+
2733
+ class RBI::Tree < ::RBI::NodeWithComments
2734
+ sig do
2735
+ params(
2736
+ loc: T.nilable(::RBI::Loc),
2737
+ comments: T::Array[::RBI::Comment],
2738
+ block: T.nilable(T.proc.params(node: ::RBI::Tree).void)
2739
+ ).void
2740
+ end
2741
+ def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2742
+
2743
+ sig { params(node: ::RBI::Node).void }
2744
+ def <<(node); end
2745
+
2746
+ sig { params(with_todo_comment: T::Boolean).void }
2747
+ def add_sig_templates!(with_todo_comment: T.unsafe(nil)); end
2748
+
2749
+ sig { params(annotation: ::String, annotate_scopes: T::Boolean, annotate_properties: T::Boolean).void }
2750
+ def annotate!(annotation, annotate_scopes: T.unsafe(nil), annotate_properties: T.unsafe(nil)); end
2751
+
2752
+ sig do
2753
+ params(
2754
+ name: ::String,
2755
+ superclass_name: T.nilable(::String),
2756
+ block: T.nilable(T.proc.params(scope: ::RBI::Scope).void)
2757
+ ).returns(::RBI::Scope)
2758
+ end
2759
+ def create_class(name, superclass_name: T.unsafe(nil), &block); end
2760
+
2761
+ sig { params(name: ::String, value: ::String).void }
2762
+ def create_constant(name, value:); end
2763
+
2764
+ sig { params(name: ::String).void }
2765
+ def create_extend(name); end
2766
+
2767
+ sig { params(name: ::String).void }
2768
+ def create_include(name); end
2769
+
2770
+ sig do
2771
+ params(
2772
+ name: ::String,
2773
+ parameters: T::Array[::RBI::TypedParam],
2774
+ return_type: T.nilable(::String),
2775
+ class_method: T::Boolean,
2776
+ visibility: ::RBI::Visibility,
2777
+ comments: T::Array[::RBI::Comment],
2778
+ block: T.nilable(T.proc.params(node: ::RBI::Method).void)
2779
+ ).void
2780
+ end
2781
+ def create_method(name, parameters: T.unsafe(nil), return_type: T.unsafe(nil), class_method: T.unsafe(nil), visibility: T.unsafe(nil), comments: T.unsafe(nil), &block); end
2782
+
2783
+ sig { params(name: ::String).void }
2784
+ def create_mixes_in_class_methods(name); end
2785
+
2786
+ sig { params(name: ::String, block: T.nilable(T.proc.params(scope: ::RBI::Scope).void)).returns(::RBI::Scope) }
2787
+ def create_module(name, &block); end
2788
+
2789
+ sig { params(constant: ::Module, block: T.nilable(T.proc.params(scope: ::RBI::Scope).void)).returns(::RBI::Scope) }
2790
+ def create_path(constant, &block); end
2791
+
2792
+ sig do
2793
+ params(
2794
+ name: ::String,
2795
+ type: ::String,
2796
+ variance: ::Symbol,
2797
+ fixed: T.nilable(::String),
2798
+ upper: T.nilable(::String),
2799
+ lower: T.nilable(::String)
2800
+ ).void
2801
+ end
2802
+ def create_type_variable(name, type:, variance: T.unsafe(nil), fixed: T.unsafe(nil), upper: T.unsafe(nil), lower: T.unsafe(nil)); end
2803
+
2804
+ sig { params(annotation: ::String).void }
2805
+ def deannotate!(annotation); end
2806
+
2807
+ sig { returns(T::Boolean) }
2808
+ def empty?; end
2809
+
2810
+ sig { params(version: ::Gem::Version).void }
2811
+ def filter_versions!(version); end
2812
+
2813
+ sig { void }
2814
+ def flatten_singleton_methods!; end
2815
+
2816
+ sig { void }
2817
+ def flatten_visibilities!; end
2818
+
2819
+ sig { void }
2820
+ def group_nodes!; end
2821
+
2822
+ sig { returns(::RBI::Index) }
2823
+ def index; end
2824
+
2825
+ sig do
2826
+ params(
2827
+ other: ::RBI::Tree,
2828
+ left_name: ::String,
2829
+ right_name: ::String,
2830
+ keep: ::RBI::Rewriters::Merge::Keep
2831
+ ).returns(::RBI::MergeTree)
2832
+ end
2833
+ def merge(other, left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end
2834
+
2835
+ sig { void }
2836
+ def nest_non_public_members!; end
2837
+
2838
+ sig { void }
2839
+ def nest_singleton_methods!; end
2840
+
2841
+ sig { void }
2842
+ def nest_top_level_members!; end
2843
+
2844
+ sig { returns(T::Array[::RBI::Node]) }
2845
+ def nodes; end
2846
+
2847
+ sig { void }
2848
+ def replace_attributes_with_methods!; end
2849
+
2850
+ sig { void }
2851
+ def sort_nodes!; end
2852
+
2853
+ sig { void }
2854
+ def translate_rbs_sigs!; end
2855
+
2856
+ private
2857
+
2858
+ sig { params(node: ::RBI::Node).returns(::RBI::Node) }
2859
+ def create_node(node); end
2860
+
2861
+ sig { returns(T::Hash[::String, ::RBI::Node]) }
2862
+ def nodes_cache; end
2863
+ end
2864
+
2865
+ # The base class for all RBI types.
2866
+ #
2867
+ # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
2868
+ class RBI::Type
2869
+ abstract!
2870
+
2871
+ sig { void }
2872
+ def initialize; end
2873
+
2874
+ # @abstract
2875
+ sig { abstract.params(other: ::BasicObject).returns(T::Boolean) }
2876
+ def ==(other); end
2877
+
2878
+ sig { params(other: ::BasicObject).returns(T::Boolean) }
2879
+ def eql?(other); end
2880
+
2881
+ sig { override.returns(::Integer) }
2882
+ def hash; end
2883
+
2884
+ # Returns a new type that is `nilable` if it is not already.
2885
+ #
2886
+ # If the type is already nilable, it returns itself.
2887
+ # ```ruby
2888
+ # type = RBI::Type.simple("String")
2889
+ # type.to_rbi # => "String"
2890
+ # type.nilable.to_rbi # => "T.nilable(String)"
2891
+ # type.nilable.nilable.to_rbi # => "T.nilable(String)"
2892
+ # ```
2893
+ sig { returns(::RBI::Type) }
2894
+ def nilable; end
2895
+
2896
+ # Returns whether the type is nilable.
2897
+ sig { returns(T::Boolean) }
2898
+ def nilable?; end
2899
+
2900
+ # Returns the non-nilable version of the type.
2901
+ # If the type is already non-nilable, it returns itself.
2902
+ # If the type is nilable, it returns the inner type.
2903
+ #
2904
+ # ```ruby
2905
+ # type = RBI::Type.nilable(RBI::Type.simple("String"))
2906
+ # type.to_rbi # => "T.nilable(String)"
2907
+ # type.non_nilable.to_rbi # => "String"
2908
+ # type.non_nilable.non_nilable.to_rbi # => "String"
2909
+ # ```
2910
+ sig { returns(::RBI::Type) }
2911
+ def non_nilable; end
2912
+
2913
+ sig { returns(::String) }
2914
+ def rbs_string; end
2915
+
2916
+ # @abstract
2917
+ sig { abstract.returns(::String) }
2918
+ def to_rbi; end
2919
+
2920
+ sig { override.returns(::String) }
2921
+ def to_s; end
2922
+
2923
+ class << self
2924
+ # Builds a type that represents an intersection of multiple types like `T.all(String, Integer)`.
2925
+ #
2926
+ # Note that this method transforms types such as `T.all(String, String)` into `String`, so
2927
+ # it may return something other than a `All`.
2928
+ sig { params(type1: ::RBI::Type, type2: ::RBI::Type, types: ::RBI::Type).returns(::RBI::Type) }
2929
+ def all(type1, type2, *types); end
2930
+
2931
+ # Builds a type that represents a union of multiple types like `T.any(String, Integer)`.
2932
+ #
2933
+ # Note that this method transforms types such as `T.any(String, NilClass)` into `T.nilable(String)`, so
2934
+ # it may return something other than a `Any`.
2935
+ sig { params(type1: ::RBI::Type, type2: ::RBI::Type, types: ::RBI::Type).returns(::RBI::Type) }
2936
+ def any(type1, type2, *types); end
2937
+
2938
+ # Builds a type that represents `T.anything`.
2939
+ sig { returns(::RBI::Type::Anything) }
2940
+ def anything; end
2941
+
2942
+ # Builds a type that represents `T.attached_class`.
2943
+ sig { returns(::RBI::Type::AttachedClass) }
2944
+ def attached_class; end
2945
+
2946
+ # Builds a type that represents `T::Boolean`.
2947
+ sig { returns(::RBI::Type::Boolean) }
2948
+ def boolean; end
2949
+
2950
+ # Builds a type that represents the singleton class of another type like `T.class_of(Foo)`.
2951
+ sig { params(type: ::RBI::Type::Simple, type_parameter: T.nilable(::RBI::Type)).returns(::RBI::Type::ClassOf) }
2952
+ def class_of(type, type_parameter = T.unsafe(nil)); end
2953
+
2954
+ # Builds a type that represents a generic type like `T::Array[String]` or `T::Hash[Symbol, Integer]`.
2955
+ sig { params(name: ::String, params: T.any(::RBI::Type, T::Array[::RBI::Type])).returns(::RBI::Type::Generic) }
2956
+ def generic(name, *params); end
2957
+
2958
+ # Builds a type that represents a nilable of another type like `T.nilable(String)`.
2959
+ #
2960
+ # Note that this method transforms types such as `T.nilable(T.untyped)` into `T.untyped`, so
2961
+ # it may return something other than a `RBI::Type::Nilable`.
2962
+ sig { params(type: ::RBI::Type).returns(::RBI::Type) }
2963
+ def nilable(type); end
2964
+
2965
+ # Builds a type that represents `T.noreturn`.
2966
+ sig { returns(::RBI::Type::NoReturn) }
2967
+ def noreturn; end
2968
+
2969
+ sig { params(node: ::Prism::Node).returns(::RBI::Type) }
2970
+ def parse_node(node); end
2971
+
2972
+ # @raise [Error]
2973
+ sig { params(string: ::String).returns(::RBI::Type) }
2974
+ def parse_string(string); end
2975
+
2976
+ # Builds a type that represents a proc type like `T.proc.void`.
2977
+ sig { returns(::RBI::Type::Proc) }
2978
+ def proc; end
2979
+
2980
+ # Builds a type that represents `T.self_type`.
2981
+ sig { returns(::RBI::Type::SelfType) }
2982
+ def self_type; end
2983
+
2984
+ # Builds a type that represents a shape type like `{name: String, age: Integer}`.
2985
+ sig { params(types: T::Hash[T.any(::String, ::Symbol), ::RBI::Type]).returns(::RBI::Type::Shape) }
2986
+ def shape(types = T.unsafe(nil)); end
2987
+
2988
+ # Builds a simple type like `String` or `::Foo::Bar`.
2989
+ #
2990
+ # It raises a `NameError` if the name is not a valid Ruby class identifier.
2991
+ #
2992
+ # @raise [NameError]
2993
+ sig { params(name: ::String).returns(::RBI::Type::Simple) }
2994
+ def simple(name); end
2995
+
2996
+ # Builds a type that represents the class of another type like `T::Class[Foo]`.
2997
+ sig { params(type: ::RBI::Type).returns(::RBI::Type::Class) }
2998
+ def t_class(type); end
2999
+
3000
+ # Builds a type that represents a tuple type like `[String, Integer]`.
3001
+ sig { params(types: T.any(::RBI::Type, T::Array[::RBI::Type])).returns(::RBI::Type::Tuple) }
3002
+ def tuple(*types); end
3003
+
3004
+ # Builds a type that represents a type parameter like `T.type_parameter(:U)`.
3005
+ sig { params(name: ::Symbol).returns(::RBI::Type::TypeParameter) }
3006
+ def type_parameter(name); end
3007
+
3008
+ # Builds a type that represents `T.untyped`.
3009
+ sig { returns(::RBI::Type::Untyped) }
3010
+ def untyped; end
3011
+
3012
+ # Builds a type that represents `void`.
3013
+ sig { returns(::RBI::Type::Void) }
3014
+ def void; end
3015
+
3016
+ private
3017
+
3018
+ sig { params(node: ::Prism::CallNode).returns(T::Array[::Prism::Node]) }
3019
+ def call_chain(node); end
3020
+
3021
+ sig { params(node: ::Prism::CallNode, count: ::Integer).returns(T::Array[::Prism::Node]) }
3022
+ def check_arguments_at_least!(node, count); end
3023
+
3024
+ sig { params(node: ::Prism::CallNode, count: ::Integer).returns(T::Array[::Prism::Node]) }
3025
+ def check_arguments_exactly!(node, count); end
3026
+
3027
+ # @raise [Error]
3028
+ sig { params(node: ::Prism::CallNode).returns(::RBI::Type) }
3029
+ def parse_call(node); end
3030
+
3031
+ sig { params(node: T.any(::Prism::ConstantPathNode, ::Prism::ConstantReadNode)).returns(::RBI::Type) }
3032
+ def parse_constant(node); end
3033
+
3034
+ # @raise [Error]
3035
+ sig { params(node: ::Prism::CallNode).returns(::RBI::Type) }
3036
+ def parse_proc(node); end
3037
+
3038
+ sig { params(node: T.any(::Prism::HashNode, ::Prism::KeywordHashNode)).returns(::RBI::Type) }
3039
+ def parse_shape(node); end
3040
+
3041
+ sig { params(node: ::Prism::ArrayNode).returns(::RBI::Type) }
3042
+ def parse_tuple(node); end
3043
+
3044
+ sig { params(node: T.nilable(::Prism::Node)).returns(T::Boolean) }
3045
+ def t?(node); end
3046
+
3047
+ sig { params(node: T.nilable(::Prism::Node)).returns(T::Boolean) }
3048
+ def t_boolean?(node); end
3049
+
3050
+ sig { params(node: ::Prism::ConstantPathNode).returns(T::Boolean) }
3051
+ def t_class?(node); end
3052
+
3053
+ sig { params(node: T.nilable(::Prism::Node)).returns(T::Boolean) }
3054
+ def t_class_of?(node); end
3055
+
3056
+ sig { params(node: ::Prism::CallNode).returns(T::Boolean) }
3057
+ def t_proc?(node); end
3058
+
3059
+ sig { params(name: ::String).returns(T::Boolean) }
3060
+ def valid_identifier?(name); end
3061
+ end
3062
+ end
3063
+
3064
+ # A type that is intersection of multiple types like `T.all(String, Integer)`.
3065
+ class RBI::Type::All < ::RBI::Type::Composite
3066
+ sig { override.returns(::String) }
3067
+ def to_rbi; end
3068
+ end
3069
+
3070
+ # A type that is union of multiple types like `T.any(String, Integer)`.
3071
+ class RBI::Type::Any < ::RBI::Type::Composite
3072
+ sig { returns(T::Boolean) }
3073
+ def nilable?; end
3074
+
3075
+ sig { override.returns(::String) }
3076
+ def to_rbi; end
3077
+ end
3078
+
3079
+ # `T.anything`.
3080
+ class RBI::Type::Anything < ::RBI::Type
3081
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3082
+ def ==(other); end
3083
+
3084
+ sig { override.returns(::String) }
3085
+ def to_rbi; end
3086
+ end
3087
+
3088
+ # `T.attached_class`.
3089
+ class RBI::Type::AttachedClass < ::RBI::Type
3090
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3091
+ def ==(other); end
3092
+
3093
+ sig { override.returns(::String) }
3094
+ def to_rbi; end
3095
+ end
3096
+
3097
+ # `T::Boolean`.
3098
+ class RBI::Type::Boolean < ::RBI::Type
3099
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3100
+ def ==(other); end
3101
+
3102
+ sig { override.returns(::String) }
3103
+ def to_rbi; end
3104
+ end
3105
+
3106
+ # The class of another type like `T::Class[Foo]`.
3107
+ class RBI::Type::Class < ::RBI::Type
3108
+ sig { params(type: ::RBI::Type).void }
3109
+ def initialize(type); end
3110
+
3111
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3112
+ def ==(other); end
3113
+
3114
+ sig { override.returns(::String) }
3115
+ def to_rbi; end
3116
+
3117
+ sig { returns(::RBI::Type) }
3118
+ def type; end
3119
+ end
3120
+
3121
+ # The singleton class of another type like `T.class_of(Foo)`.
3122
+ class RBI::Type::ClassOf < ::RBI::Type
3123
+ sig { params(type: ::RBI::Type::Simple, type_parameter: T.nilable(::RBI::Type)).void }
3124
+ def initialize(type, type_parameter = T.unsafe(nil)); end
3125
+
3126
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3127
+ def ==(other); end
3128
+
3129
+ sig { override.returns(::String) }
3130
+ def to_rbi; end
3131
+
3132
+ sig { returns(::RBI::Type::Simple) }
3133
+ def type; end
3134
+
3135
+ sig { returns(T.nilable(::RBI::Type)) }
3136
+ def type_parameter; end
3137
+ end
3138
+
3139
+ # A type that is composed of multiple types like `T.all(String, Integer)`.
3140
+ #
3141
+ # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
3142
+ class RBI::Type::Composite < ::RBI::Type
3143
+ abstract!
3144
+
3145
+ sig { params(types: T::Array[::RBI::Type]).void }
3146
+ def initialize(types); end
3147
+
3148
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3149
+ def ==(other); end
3150
+
3151
+ sig { returns(T::Array[::RBI::Type]) }
3152
+ def types; end
3153
+ end
3154
+
3155
+ class RBI::Type::Error < ::RBI::Error; end
3156
+
3157
+ # A generic type like `T::Array[String]` or `T::Hash[Symbol, Integer]`.
3158
+ class RBI::Type::Generic < ::RBI::Type
3159
+ sig { params(name: ::String, params: ::RBI::Type).void }
3160
+ def initialize(name, *params); end
3161
+
3162
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3163
+ def ==(other); end
3164
+
3165
+ sig { returns(::String) }
3166
+ def name; end
3167
+
3168
+ sig { returns(T::Array[::RBI::Type]) }
3169
+ def params; end
3170
+
3171
+ sig { override.returns(::String) }
3172
+ def to_rbi; end
3173
+ end
3174
+
3175
+ # A type that can be `nil` like `T.nilable(String)`.
3176
+ class RBI::Type::Nilable < ::RBI::Type
3177
+ sig { params(type: ::RBI::Type).void }
3178
+ def initialize(type); end
3179
+
3180
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3181
+ def ==(other); end
3182
+
3183
+ sig { override.returns(::String) }
3184
+ def to_rbi; end
3185
+
3186
+ sig { returns(::RBI::Type) }
3187
+ def type; end
3188
+ end
3189
+
3190
+ # `T.noreturn`.
3191
+ class RBI::Type::NoReturn < ::RBI::Type
3192
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3193
+ def ==(other); end
3194
+
3195
+ sig { override.returns(::String) }
3196
+ def to_rbi; end
3197
+ end
3198
+
3199
+ # A proc type like `T.proc.void`.
3200
+ class RBI::Type::Proc < ::RBI::Type
3201
+ sig { void }
3202
+ def initialize; end
3203
+
3204
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3205
+ def ==(other); end
3206
+
3207
+ sig { params(type: T.untyped).returns(T.self_type) }
3208
+ def bind(type); end
3209
+
3210
+ sig { params(params: ::RBI::Type).returns(T.self_type) }
3211
+ def params(**params); end
3212
+
3213
+ sig { returns(T.nilable(::RBI::Type)) }
3214
+ def proc_bind; end
3215
+
3216
+ sig { returns(T::Hash[::Symbol, ::RBI::Type]) }
3217
+ def proc_params; end
3218
+
3219
+ sig { returns(::RBI::Type) }
3220
+ def proc_returns; end
3221
+
3222
+ sig { params(type: T.untyped).returns(T.self_type) }
3223
+ def returns(type); end
3224
+
3225
+ sig { override.returns(::String) }
3226
+ def to_rbi; end
3227
+
3228
+ sig { returns(T.self_type) }
3229
+ def void; end
3230
+ end
3231
+
3232
+ # `T.self_type`.
3233
+ class RBI::Type::SelfType < ::RBI::Type
3234
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3235
+ def ==(other); end
3236
+
3237
+ sig { override.returns(::String) }
3238
+ def to_rbi; end
3239
+ end
3240
+
3241
+ # A shape type like `{name: String, age: Integer}`.
3242
+ class RBI::Type::Shape < ::RBI::Type
3243
+ sig { params(types: T::Hash[T.any(::String, ::Symbol), ::RBI::Type]).void }
3244
+ def initialize(types); end
3245
+
3246
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3247
+ def ==(other); end
3248
+
3249
+ sig { override.returns(::String) }
3250
+ def to_rbi; end
3251
+
3252
+ sig { returns(T::Hash[T.any(::String, ::Symbol), ::RBI::Type]) }
3253
+ def types; end
3254
+ end
3255
+
3256
+ # A type that represents a simple class name like `String` or `Foo`.
3257
+ #
3258
+ # It can also be a qualified name like `::Foo` or `Foo::Bar`.
3259
+ class RBI::Type::Simple < ::RBI::Type
3260
+ sig { params(name: ::String).void }
3261
+ def initialize(name); end
3262
+
3263
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3264
+ def ==(other); end
3265
+
3266
+ sig { returns(::String) }
3267
+ def name; end
3268
+
3269
+ sig { override.returns(::String) }
3270
+ def to_rbi; end
3271
+ end
3272
+
3273
+ # A tuple type like `[String, Integer]`.
3274
+ class RBI::Type::Tuple < ::RBI::Type
3275
+ sig { params(types: T::Array[::RBI::Type]).void }
3276
+ def initialize(types); end
3277
+
3278
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3279
+ def ==(other); end
3280
+
3281
+ sig { override.returns(::String) }
3282
+ def to_rbi; end
3283
+
3284
+ sig { returns(T::Array[::RBI::Type]) }
3285
+ def types; end
3286
+ end
3287
+
3288
+ # A type parameter like `T.type_parameter(:U)`.
3289
+ class RBI::Type::TypeParameter < ::RBI::Type
3290
+ sig { params(name: ::Symbol).void }
3291
+ def initialize(name); end
3292
+
3293
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3294
+ def ==(other); end
3295
+
3296
+ sig { returns(::Symbol) }
3297
+ def name; end
3298
+
3299
+ sig { override.returns(::String) }
3300
+ def to_rbi; end
3301
+ end
3302
+
3303
+ # `T.untyped`.
3304
+ class RBI::Type::Untyped < ::RBI::Type
3305
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3306
+ def ==(other); end
3307
+
3308
+ sig { override.returns(::String) }
3309
+ def to_rbi; end
3310
+ end
3311
+
3312
+ class RBI::Type::Visitor
3313
+ sig { params(node: ::RBI::Type).void }
3314
+ def visit(node); end
3315
+
3316
+ private
3317
+
3318
+ sig { params(type: ::RBI::Type::All).void }
3319
+ def visit_all(type); end
3320
+
3321
+ sig { params(type: ::RBI::Type::Any).void }
3322
+ def visit_any(type); end
3323
+
3324
+ sig { params(type: ::RBI::Type::Anything).void }
3325
+ def visit_anything(type); end
3326
+
3327
+ sig { params(type: ::RBI::Type::AttachedClass).void }
3328
+ def visit_attached_class(type); end
3329
+
3330
+ sig { params(type: ::RBI::Type::Boolean).void }
3331
+ def visit_boolean(type); end
3332
+
3333
+ sig { params(type: ::RBI::Type::Class).void }
3334
+ def visit_class(type); end
3335
+
3336
+ sig { params(type: ::RBI::Type::ClassOf).void }
3337
+ def visit_class_of(type); end
3338
+
3339
+ sig { params(type: ::RBI::Type::Generic).void }
3340
+ def visit_generic(type); end
3341
+
3342
+ sig { params(type: ::RBI::Type::Nilable).void }
3343
+ def visit_nilable(type); end
3344
+
3345
+ sig { params(type: ::RBI::Type::NoReturn).void }
3346
+ def visit_no_return(type); end
3347
+
3348
+ sig { params(type: ::RBI::Type::Proc).void }
3349
+ def visit_proc(type); end
3350
+
3351
+ sig { params(type: ::RBI::Type::SelfType).void }
3352
+ def visit_self_type(type); end
3353
+
3354
+ sig { params(type: ::RBI::Type::Shape).void }
3355
+ def visit_shape(type); end
3356
+
3357
+ sig { params(type: ::RBI::Type::Simple).void }
3358
+ def visit_simple(type); end
3359
+
3360
+ sig { params(type: ::RBI::Type::Tuple).void }
3361
+ def visit_tuple(type); end
3362
+
3363
+ sig { params(type: ::RBI::Type::TypeParameter).void }
3364
+ def visit_type_parameter(type); end
3365
+
3366
+ sig { params(type: ::RBI::Type::Untyped).void }
3367
+ def visit_untyped(type); end
3368
+
3369
+ sig { params(type: ::RBI::Type::Void).void }
3370
+ def visit_void(type); end
3371
+ end
3372
+
3373
+ class RBI::Type::Visitor::Error < ::RBI::Error; end
3374
+
3375
+ # `void`.
3376
+ class RBI::Type::Void < ::RBI::Type
3377
+ sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3378
+ def ==(other); end
3379
+
3380
+ sig { override.returns(::String) }
3381
+ def to_rbi; end
3382
+ end
3383
+
3384
+ class RBI::TypeMember < ::RBI::NodeWithComments
3385
+ include ::RBI::Indexable
3386
+
3387
+ sig do
3388
+ params(
3389
+ name: ::String,
3390
+ value: ::String,
3391
+ loc: T.nilable(::RBI::Loc),
3392
+ comments: T::Array[::RBI::Comment],
3393
+ block: T.nilable(T.proc.params(node: ::RBI::TypeMember).void)
3394
+ ).void
3395
+ end
3396
+ def initialize(name, value, loc: T.unsafe(nil), comments: T.unsafe(nil), &block); end
3397
+
3398
+ sig { returns(::String) }
3399
+ def fully_qualified_name; end
3400
+
3401
+ sig { override.returns(T::Array[::String]) }
3402
+ def index_ids; end
3403
+
3404
+ sig { returns(::String) }
3405
+ def name; end
3406
+
3407
+ sig { override.returns(::String) }
3408
+ def to_s; end
3409
+
3410
+ # @return [String]
3411
+ def value; end
3412
+ end
3413
+
3414
+ class RBI::TypePrinter
3415
+ sig { void }
3416
+ def initialize; end
3417
+
3418
+ sig { returns(::String) }
3419
+ def string; end
3420
+
3421
+ sig { params(node: ::RBI::Type).void }
3422
+ def visit(node); end
3423
+
3424
+ sig { params(type: ::RBI::Type::All).void }
3425
+ def visit_all(type); end
3426
+
3427
+ sig { params(type: ::RBI::Type::Any).void }
3428
+ def visit_any(type); end
3429
+
3430
+ sig { params(type: ::RBI::Type::Anything).void }
3431
+ def visit_anything(type); end
3432
+
3433
+ sig { params(type: ::RBI::Type::AttachedClass).void }
3434
+ def visit_attached_class(type); end
3435
+
3436
+ sig { params(type: ::RBI::Type::Boolean).void }
3437
+ def visit_boolean(type); end
3438
+
3439
+ sig { params(type: ::RBI::Type::Class).void }
3440
+ def visit_class(type); end
3441
+
3442
+ sig { params(type: ::RBI::Type::ClassOf).void }
3443
+ def visit_class_of(type); end
3444
+
3445
+ sig { params(type: ::RBI::Type::Generic).void }
3446
+ def visit_generic(type); end
3447
+
3448
+ sig { params(type: ::RBI::Type::Nilable).void }
3449
+ def visit_nilable(type); end
3450
+
3451
+ sig { params(type: ::RBI::Type::NoReturn).void }
3452
+ def visit_no_return(type); end
3453
+
3454
+ sig { params(type: ::RBI::Type::Proc).void }
3455
+ def visit_proc(type); end
3456
+
3457
+ sig { params(type: ::RBI::Type::SelfType).void }
3458
+ def visit_self_type(type); end
3459
+
3460
+ sig { params(type: ::RBI::Type::Shape).void }
3461
+ def visit_shape(type); end
3462
+
3463
+ sig { params(type: ::RBI::Type::Simple).void }
3464
+ def visit_simple(type); end
3465
+
3466
+ sig { params(type: ::RBI::Type::Tuple).void }
3467
+ def visit_tuple(type); end
3468
+
3469
+ sig { params(type: ::RBI::Type::TypeParameter).void }
3470
+ def visit_type_parameter(type); end
3471
+
3472
+ sig { params(type: ::RBI::Type::Untyped).void }
3473
+ def visit_untyped(type); end
3474
+
3475
+ sig { params(type: ::RBI::Type::Void).void }
3476
+ def visit_void(type); end
3477
+
3478
+ private
3479
+
3480
+ sig { params(type_name: ::String).returns(::String) }
3481
+ def translate_t_type(type_name); end
3482
+ end
3483
+
3484
+ class RBI::UnexpectedMultipleSigsError < ::RBI::Error
3485
+ sig { params(node: ::RBI::Node).void }
3486
+ def initialize(node); end
3487
+
3488
+ sig { returns(::RBI::Node) }
3489
+ def node; end
3490
+ end
3491
+
3492
+ class RBI::UnexpectedParserError < ::RBI::Error
3493
+ sig { params(parent_exception: ::Exception, last_location: ::RBI::Loc).void }
3494
+ def initialize(parent_exception, last_location); end
3495
+
3496
+ sig { returns(::RBI::Loc) }
3497
+ def last_location; end
3498
+
3499
+ sig { params(io: T.any(::IO, ::StringIO)).void }
3500
+ def print_debug(io: T.unsafe(nil)); end
3501
+ end
3502
+
3503
+ RBI::VERSION = T.let(T.unsafe(nil), String)
3504
+
3505
+ # Visibility
3506
+ #
3507
+ # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
3508
+ class RBI::Visibility < ::RBI::NodeWithComments
3509
+ abstract!
3510
+
3511
+ sig { params(visibility: ::Symbol, loc: T.nilable(::RBI::Loc), comments: T::Array[::RBI::Comment]).void }
3512
+ def initialize(visibility, loc: T.unsafe(nil), comments: T.unsafe(nil)); end
3513
+
3514
+ sig { params(other: T.nilable(::Object)).returns(T::Boolean) }
3515
+ def ==(other); end
3516
+
3517
+ sig { returns(T::Boolean) }
3518
+ def private?; end
3519
+
3520
+ sig { returns(T::Boolean) }
3521
+ def protected?; end
3522
+
3523
+ sig { returns(T::Boolean) }
3524
+ def public?; end
3525
+
3526
+ sig { returns(::Symbol) }
3527
+ def visibility; end
3528
+ end
3529
+
3530
+ class RBI::VisibilityGroup < ::RBI::Tree
3531
+ sig { params(visibility: ::RBI::Visibility).void }
3532
+ def initialize(visibility); end
3533
+
3534
+ sig { returns(::RBI::Visibility) }
3535
+ def visibility; end
3536
+ end
3537
+
3538
+ # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
3539
+ class RBI::Visitor
3540
+ abstract!
3541
+
3542
+ sig { params(node: T.nilable(::RBI::Node)).void }
3543
+ def visit(node); end
3544
+
3545
+ sig { params(nodes: T::Array[::RBI::Node]).void }
3546
+ def visit_all(nodes); end
3547
+
3548
+ sig { params(file: ::RBI::File).void }
3549
+ def visit_file(file); end
3550
+
3551
+ private
3552
+
3553
+ sig { params(node: ::RBI::Arg).void }
3554
+ def visit_arg(node); end
3555
+
3556
+ sig { params(node: ::RBI::AttrAccessor).void }
3557
+ def visit_attr_accessor(node); end
3558
+
3559
+ sig { params(node: ::RBI::AttrReader).void }
3560
+ def visit_attr_reader(node); end
3561
+
3562
+ sig { params(node: ::RBI::AttrWriter).void }
3563
+ def visit_attr_writer(node); end
3564
+
3565
+ sig { params(node: ::RBI::BlankLine).void }
3566
+ def visit_blank_line(node); end
3567
+
3568
+ sig { params(node: ::RBI::BlockParam).void }
3569
+ def visit_block_param(node); end
3570
+
3571
+ sig { params(node: ::RBI::Class).void }
3572
+ def visit_class(node); end
3573
+
3574
+ sig { params(node: ::RBI::Comment).void }
3575
+ def visit_comment(node); end
3576
+
3577
+ sig { params(node: ::RBI::ConflictTree).void }
3578
+ def visit_conflict_tree(node); end
3579
+
3580
+ sig { params(node: ::RBI::Const).void }
3581
+ def visit_const(node); end
3582
+
3583
+ sig { params(node: ::RBI::Extend).void }
3584
+ def visit_extend(node); end
3585
+
3586
+ sig { params(node: ::RBI::Group).void }
3587
+ def visit_group(node); end
3588
+
3589
+ sig { params(node: ::RBI::Helper).void }
3590
+ def visit_helper(node); end
3591
+
3592
+ sig { params(node: ::RBI::Include).void }
3593
+ def visit_include(node); end
3594
+
3595
+ sig { params(node: ::RBI::KwArg).void }
3596
+ def visit_kw_arg(node); end
3597
+
3598
+ sig { params(node: ::RBI::KwOptParam).void }
3599
+ def visit_kw_opt_param(node); end
3600
+
3601
+ sig { params(node: ::RBI::KwParam).void }
3602
+ def visit_kw_param(node); end
3603
+
3604
+ sig { params(node: ::RBI::KwRestParam).void }
3605
+ def visit_kw_rest_param(node); end
3606
+
3607
+ sig { params(node: ::RBI::Method).void }
3608
+ def visit_method(node); end
3609
+
3610
+ sig { params(node: ::RBI::MixesInClassMethods).void }
3611
+ def visit_mixes_in_class_methods(node); end
3612
+
3613
+ sig { params(node: ::RBI::Module).void }
3614
+ def visit_module(node); end
3615
+
3616
+ sig { params(node: ::RBI::OptParam).void }
3617
+ def visit_opt_param(node); end
3618
+
3619
+ sig { params(node: ::RBI::Private).void }
3620
+ def visit_private(node); end
3621
+
3622
+ sig { params(node: ::RBI::Protected).void }
3623
+ def visit_protected(node); end
3624
+
3625
+ sig { params(node: ::RBI::Public).void }
3626
+ def visit_public(node); end
3627
+
3628
+ sig { params(node: ::RBI::RBSComment).void }
3629
+ def visit_rbs_comment(node); end
3630
+
3631
+ sig { params(node: ::RBI::ReqParam).void }
3632
+ def visit_req_param(node); end
3633
+
3634
+ sig { params(node: ::RBI::RequiresAncestor).void }
3635
+ def visit_requires_ancestor(node); end
3636
+
3637
+ sig { params(node: ::RBI::RestParam).void }
3638
+ def visit_rest_param(node); end
3639
+
3640
+ sig { params(node: ::RBI::ScopeConflict).void }
3641
+ def visit_scope_conflict(node); end
3642
+
3643
+ sig { params(node: ::RBI::Send).void }
3644
+ def visit_send(node); end
3645
+
3646
+ sig { params(node: ::RBI::Sig).void }
3647
+ def visit_sig(node); end
3648
+
3649
+ sig { params(node: ::RBI::SigParam).void }
3650
+ def visit_sig_param(node); end
3651
+
3652
+ sig { params(node: ::RBI::SingletonClass).void }
3653
+ def visit_singleton_class(node); end
3654
+
3655
+ sig { params(node: ::RBI::Struct).void }
3656
+ def visit_struct(node); end
3657
+
3658
+ sig { params(node: ::RBI::TEnum).void }
3659
+ def visit_tenum(node); end
3660
+
3661
+ sig { params(node: ::RBI::TEnumBlock).void }
3662
+ def visit_tenum_block(node); end
3663
+
3664
+ sig { params(node: ::RBI::TEnumValue).void }
3665
+ def visit_tenum_value(node); end
3666
+
3667
+ sig { params(node: ::RBI::Tree).void }
3668
+ def visit_tree(node); end
3669
+
3670
+ sig { params(node: ::RBI::TStruct).void }
3671
+ def visit_tstruct(node); end
3672
+
3673
+ sig { params(node: ::RBI::TStructConst).void }
3674
+ def visit_tstruct_const(node); end
3675
+
3676
+ sig { params(node: ::RBI::TStructProp).void }
3677
+ def visit_tstruct_prop(node); end
3678
+
3679
+ sig { params(node: ::RBI::TypeMember).void }
3680
+ def visit_type_member(node); end
3681
+
3682
+ sig { params(node: ::RBI::VisibilityGroup).void }
3683
+ def visit_visibility_group(node); end
3684
+ end
3685
+
3686
+ class RBI::VisitorError < ::RBI::Error; end