rbi 0.2.4 → 0.3.1

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