rbi 0.3.3 → 0.3.6

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 CHANGED
@@ -20,9 +20,6 @@ class RBI::Arg < ::RBI::Node
20
20
  def value; end
21
21
  end
22
22
 
23
- # Attributes
24
- #
25
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
26
23
  class RBI::Attr < ::RBI::NodeWithComments
27
24
  include ::RBI::Indexable
28
25
 
@@ -43,11 +40,9 @@ class RBI::Attr < ::RBI::NodeWithComments
43
40
  sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
44
41
  def compatible_with?(other); end
45
42
 
46
- # @abstract
47
43
  sig { abstract.returns(T::Array[::RBI::Method]) }
48
44
  def convert_to_methods; end
49
45
 
50
- # @abstract
51
46
  sig { abstract.returns(T::Array[::String]) }
52
47
  def fully_qualified_names; end
53
48
 
@@ -66,7 +61,6 @@ class RBI::Attr < ::RBI::NodeWithComments
66
61
  sig { returns(::RBI::Visibility) }
67
62
  def visibility; end
68
63
 
69
- # @return [Visibility]
70
64
  def visibility=(_arg0); end
71
65
 
72
66
  private
@@ -94,7 +88,6 @@ class RBI::Attr < ::RBI::NodeWithComments
94
88
  end
95
89
  def create_setter_method(name, sig, attribute_type, visibility, loc, comments); end
96
90
 
97
- # @raise [UnexpectedMultipleSigsError]
98
91
  sig(:final) { returns([T.nilable(::RBI::Sig), T.nilable(T.any(::RBI::Type, ::String))]) }
99
92
  def parse_sig; end
100
93
  end
@@ -180,7 +173,6 @@ class RBI::AttrWriter < ::RBI::Attr
180
173
  def to_s; end
181
174
  end
182
175
 
183
- # An arbitrary blank line that can be added both in trees and comments
184
176
  class RBI::BlankLine < ::RBI::Comment
185
177
  sig { params(loc: T.nilable(::RBI::Loc)).void }
186
178
  def initialize(loc: T.unsafe(nil)); end
@@ -225,13 +217,11 @@ class RBI::Class < ::RBI::Scope
225
217
  sig { returns(::String) }
226
218
  def name; end
227
219
 
228
- # @return [String]
229
220
  def name=(_arg0); end
230
221
 
231
222
  sig { returns(T.nilable(::String)) }
232
223
  def superclass_name; end
233
224
 
234
- # @return [String, nil]
235
225
  def superclass_name=(_arg0); end
236
226
  end
237
227
 
@@ -245,24 +235,9 @@ class RBI::Comment < ::RBI::Node
245
235
  sig { returns(::String) }
246
236
  def text; end
247
237
 
248
- # @return [String]
249
238
  def text=(_arg0); end
250
239
  end
251
240
 
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
241
  class RBI::ConflictTree < ::RBI::Tree
267
242
  sig { params(left_name: ::String, right_name: ::String).void }
268
243
  def initialize(left_name: T.unsafe(nil), right_name: T.unsafe(nil)); end
@@ -273,14 +248,10 @@ class RBI::ConflictTree < ::RBI::Tree
273
248
  sig { returns(::String) }
274
249
  def left_name; end
275
250
 
276
- # @return [Tree]
277
251
  def right; end
278
-
279
- # @return [String]
280
252
  def right_name; end
281
253
  end
282
254
 
283
- # Consts
284
255
  class RBI::Const < ::RBI::NodeWithComments
285
256
  include ::RBI::Indexable
286
257
 
@@ -310,7 +281,6 @@ class RBI::Const < ::RBI::NodeWithComments
310
281
  sig { override.returns(::String) }
311
282
  def to_s; end
312
283
 
313
- # @return [String]
314
284
  def value; end
315
285
  end
316
286
 
@@ -357,7 +327,6 @@ class RBI::File
357
327
  sig { returns(T::Array[::RBI::Comment]) }
358
328
  def comments; end
359
329
 
360
- # @return [Array<Comment>]
361
330
  def comments=(_arg0); end
362
331
 
363
332
  sig { returns(T::Boolean) }
@@ -382,13 +351,11 @@ class RBI::File
382
351
  sig { returns(::RBI::Tree) }
383
352
  def root; end
384
353
 
385
- # @return [Tree]
386
354
  def root=(_arg0); end
387
355
 
388
356
  sig { returns(T.nilable(::String)) }
389
357
  def strictness; end
390
358
 
391
- # @return [String, nil]
392
359
  def strictness=(_arg0); end
393
360
 
394
361
  sig { params(indent: ::Integer, print_locs: T::Boolean, max_line_length: T.nilable(::Integer)).returns(::String) }
@@ -418,7 +385,6 @@ class RBI::Formatter
418
385
  sig { returns(T.nilable(::Integer)) }
419
386
  def max_line_length; end
420
387
 
421
- # @return [Integer, nil]
422
388
  def max_line_length=(_arg0); end
423
389
 
424
390
  sig { params(file: ::RBI::File).returns(::String) }
@@ -433,27 +399,29 @@ class RBI::Group < ::RBI::Tree
433
399
  def kind; end
434
400
  end
435
401
 
436
- class RBI::Group::Kind < ::T::Enum
437
- enums do
438
- Attrs = new
439
- Consts = new
440
- Helpers = new
441
- Inits = new
442
- Methods = new
443
- MixesInClassMethods = new
444
- Mixins = new
445
- RequiredAncestors = new
446
- Sends = new
447
- SingletonClasses = new
448
- TEnums = new
449
- TStructFields = new
450
- TypeMembers = new
402
+ class RBI::Group::Kind
403
+ class << self
404
+ private
405
+
406
+ def new(*_arg0); end
451
407
  end
452
408
  end
453
409
 
410
+ RBI::Group::Kind::Attrs = T.let(T.unsafe(nil), RBI::Group::Kind)
411
+ RBI::Group::Kind::Consts = T.let(T.unsafe(nil), RBI::Group::Kind)
412
+ RBI::Group::Kind::Helpers = T.let(T.unsafe(nil), RBI::Group::Kind)
413
+ RBI::Group::Kind::Inits = T.let(T.unsafe(nil), RBI::Group::Kind)
414
+ RBI::Group::Kind::Methods = T.let(T.unsafe(nil), RBI::Group::Kind)
415
+ RBI::Group::Kind::MixesInClassMethods = T.let(T.unsafe(nil), RBI::Group::Kind)
416
+ RBI::Group::Kind::Mixins = T.let(T.unsafe(nil), RBI::Group::Kind)
417
+ RBI::Group::Kind::RequiredAncestors = T.let(T.unsafe(nil), RBI::Group::Kind)
418
+ RBI::Group::Kind::Sends = T.let(T.unsafe(nil), RBI::Group::Kind)
419
+ RBI::Group::Kind::SingletonClasses = T.let(T.unsafe(nil), RBI::Group::Kind)
420
+ RBI::Group::Kind::TEnums = T.let(T.unsafe(nil), RBI::Group::Kind)
421
+ RBI::Group::Kind::TStructFields = T.let(T.unsafe(nil), RBI::Group::Kind)
422
+ RBI::Group::Kind::TypeMembers = T.let(T.unsafe(nil), RBI::Group::Kind)
454
423
  class RBI::GroupNodesError < ::RBI::Error; end
455
424
 
456
- # Sorbet's misc.
457
425
  class RBI::Helper < ::RBI::NodeWithComments
458
426
  include ::RBI::Indexable
459
427
 
@@ -531,18 +499,9 @@ class RBI::Index < ::RBI::Visitor
531
499
  end
532
500
  end
533
501
 
534
- # A Node that can be referred to by a unique ID inside an index
535
- #
536
- # @abstract Subclasses must implement the `abstract` methods below.
537
502
  module RBI::Indexable
538
503
  interface!
539
504
 
540
- # Unique IDs that refer to this node.
541
- #
542
- # Some nodes can have multiple ids, for example an attribute accessor matches the ID of the
543
- # getter and the setter.
544
- #
545
- # @abstract
546
505
  sig { abstract.returns(T::Array[::String]) }
547
506
  def index_ids; end
548
507
  end
@@ -631,21 +590,20 @@ class RBI::Loc
631
590
  end
632
591
  def initialize(file: T.unsafe(nil), begin_line: T.unsafe(nil), end_line: T.unsafe(nil), begin_column: T.unsafe(nil), end_column: T.unsafe(nil)); end
633
592
 
634
- # @return [Integer, nil]
635
593
  def begin_column; end
636
594
 
637
595
  sig { returns(T.nilable(::Integer)) }
638
596
  def begin_line; end
639
597
 
640
- # @return [Integer, nil]
641
598
  def end_column; end
642
-
643
- # @return [Integer, nil]
644
599
  def end_line; end
645
600
 
646
601
  sig { returns(T.nilable(::String)) }
647
602
  def file; end
648
603
 
604
+ sig { params(other: ::RBI::Loc).returns(::RBI::Loc) }
605
+ def join(other); end
606
+
649
607
  sig { returns(T.nilable(::String)) }
650
608
  def source; end
651
609
 
@@ -658,7 +616,6 @@ class RBI::Loc
658
616
  end
659
617
  end
660
618
 
661
- # A tree that _might_ contain conflicts
662
619
  class RBI::MergeTree < ::RBI::Tree
663
620
  sig do
664
621
  params(
@@ -674,7 +631,6 @@ class RBI::MergeTree < ::RBI::Tree
674
631
  def conflicts; end
675
632
  end
676
633
 
677
- # Methods and args
678
634
  class RBI::Method < ::RBI::NodeWithComments
679
635
  include ::RBI::Indexable
680
636
 
@@ -743,7 +699,6 @@ class RBI::Method < ::RBI::NodeWithComments
743
699
  sig { returns(T::Boolean) }
744
700
  def is_singleton; end
745
701
 
746
- # @return [Boolean]
747
702
  def is_singleton=(_arg0); end
748
703
 
749
704
  sig { override.params(other: ::RBI::Node).void }
@@ -752,7 +707,6 @@ class RBI::Method < ::RBI::NodeWithComments
752
707
  sig { returns(::String) }
753
708
  def name; end
754
709
 
755
- # @return [String]
756
710
  def name=(_arg0); end
757
711
 
758
712
  sig { returns(T::Array[::RBI::Param]) }
@@ -761,7 +715,6 @@ class RBI::Method < ::RBI::NodeWithComments
761
715
  sig { returns(T::Array[::RBI::Sig]) }
762
716
  def sigs; end
763
717
 
764
- # @return [Array<Sig>]
765
718
  def sigs=(_arg0); end
766
719
 
767
720
  sig { override.returns(::String) }
@@ -770,7 +723,6 @@ class RBI::Method < ::RBI::NodeWithComments
770
723
  sig { returns(::RBI::Visibility) }
771
724
  def visibility; end
772
725
 
773
- # @return [Visibility]
774
726
  def visibility=(_arg0); end
775
727
  end
776
728
 
@@ -798,9 +750,6 @@ class RBI::MixesInClassMethods < ::RBI::Mixin
798
750
  def to_s; end
799
751
  end
800
752
 
801
- # Mixins
802
- #
803
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
804
753
  class RBI::Mixin < ::RBI::NodeWithComments
805
754
  abstract!
806
755
 
@@ -841,18 +790,15 @@ class RBI::Module < ::RBI::Scope
841
790
  sig { returns(::String) }
842
791
  def name; end
843
792
 
844
- # @return [String]
845
793
  def name=(_arg0); end
846
794
  end
847
795
 
848
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
849
796
  class RBI::Node
850
797
  abstract!
851
798
 
852
799
  sig { params(loc: T.nilable(::RBI::Loc)).void }
853
800
  def initialize(loc: T.unsafe(nil)); end
854
801
 
855
- # Can `self` and `_other` be merged into a single definition?
856
802
  sig { params(_other: ::RBI::Node).returns(T::Boolean) }
857
803
  def compatible_with?(_other); end
858
804
 
@@ -862,10 +808,8 @@ class RBI::Node
862
808
  sig { returns(T.nilable(::RBI::Loc)) }
863
809
  def loc; end
864
810
 
865
- # @return [Loc, nil]
866
811
  def loc=(_arg0); end
867
812
 
868
- # Merge `self` and `other` into a single definition
869
813
  sig { params(other: ::RBI::Node).void }
870
814
  def merge_with(other); end
871
815
 
@@ -878,7 +822,6 @@ class RBI::Node
878
822
  sig { returns(T.nilable(::RBI::Tree)) }
879
823
  def parent_tree; end
880
824
 
881
- # @return [Tree, nil]
882
825
  def parent_tree=(_arg0); end
883
826
 
884
827
  sig do
@@ -904,7 +847,6 @@ class RBI::Node
904
847
  sig { params(indent: ::Integer, print_locs: T::Boolean, positional_names: T::Boolean).returns(::String) }
905
848
  def rbs_string(indent: T.unsafe(nil), print_locs: T.unsafe(nil), positional_names: T.unsafe(nil)); end
906
849
 
907
- # @raise [ReplaceNodeError]
908
850
  sig { params(node: ::RBI::Node).void }
909
851
  def replace(node); end
910
852
 
@@ -915,7 +857,6 @@ class RBI::Node
915
857
  def string(indent: T.unsafe(nil), print_locs: T.unsafe(nil), max_line_length: T.unsafe(nil)); end
916
858
  end
917
859
 
918
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
919
860
  class RBI::NodeWithComments < ::RBI::Node
920
861
  abstract!
921
862
 
@@ -928,7 +869,6 @@ class RBI::NodeWithComments < ::RBI::Node
928
869
  sig { returns(T::Array[::RBI::Comment]) }
929
870
  def comments; end
930
871
 
931
- # @return [Array<Comment>]
932
872
  def comments=(_arg0); end
933
873
 
934
874
  sig { override.params(other: ::RBI::Node).void }
@@ -957,7 +897,6 @@ class RBI::OptParam < ::RBI::Param
957
897
  def value; end
958
898
  end
959
899
 
960
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
961
900
  class RBI::Param < ::RBI::NodeWithComments
962
901
  abstract!
963
902
 
@@ -1078,11 +1017,9 @@ class RBI::Parser::TreeBuilder < ::RBI::Parser::Visitor
1078
1017
 
1079
1018
  private
1080
1019
 
1081
- # Collect all the remaining comments within a node
1082
1020
  sig { params(node: ::Prism::Node).void }
1083
1021
  def collect_dangling_comments(node); end
1084
1022
 
1085
- # Collect all the remaining comments after visiting the tree
1086
1023
  sig { void }
1087
1024
  def collect_orphan_comments; end
1088
1025
 
@@ -1178,13 +1115,9 @@ class RBI::Printer < ::RBI::Visitor
1178
1115
  sig { void }
1179
1116
  def dedent; end
1180
1117
 
1181
- # @return [Boolean]
1182
1118
  def in_visibility_group; end
1183
-
1184
- # @return [Boolean]
1185
1119
  def in_visibility_group=(_arg0); end
1186
1120
 
1187
- # Printing
1188
1121
  sig { void }
1189
1122
  def indent; end
1190
1123
 
@@ -1194,25 +1127,20 @@ class RBI::Printer < ::RBI::Visitor
1194
1127
  sig { returns(T.nilable(::RBI::Node)) }
1195
1128
  def previous_node; end
1196
1129
 
1197
- # Print a string without indentation nor `\n` at the end.
1198
1130
  sig { params(string: ::String).void }
1199
1131
  def print(string); end
1200
1132
 
1201
1133
  sig { returns(T::Boolean) }
1202
1134
  def print_locs; end
1203
1135
 
1204
- # @return [Boolean]
1205
1136
  def print_locs=(_arg0); end
1206
1137
 
1207
- # Print a string with indentation and `\n` at the end.
1208
1138
  sig { params(string: ::String).void }
1209
1139
  def printl(string); end
1210
1140
 
1211
- # Print a string without indentation but with a `\n` at the end.
1212
1141
  sig { params(string: T.nilable(::String)).void }
1213
1142
  def printn(string = T.unsafe(nil)); end
1214
1143
 
1215
- # Print a string with indentation but without a `\n` at the end.
1216
1144
  sig { params(string: T.nilable(::String)).void }
1217
1145
  def printt(string = T.unsafe(nil)); end
1218
1146
 
@@ -1457,7 +1385,6 @@ class RBI::RBS::MethodTypeTranslator
1457
1385
  sig { params(type: T.untyped).returns(::RBI::Type) }
1458
1386
  def translate_type(type); end
1459
1387
 
1460
- # @raise [Error]
1461
1388
  sig { params(type: ::RBS::Types::Block).void }
1462
1389
  def visit_block_type(type); end
1463
1390
 
@@ -1494,7 +1421,6 @@ class RBI::RBS::TypeTranslator
1494
1421
  end
1495
1422
  end
1496
1423
 
1497
- # A comment representing a RBS type prefixed with `#:`
1498
1424
  class RBI::RBSComment < ::RBI::Comment
1499
1425
  sig { params(other: ::Object).returns(T::Boolean) }
1500
1426
  def ==(other); end
@@ -1506,10 +1432,11 @@ class RBI::RBSPrinter < ::RBI::Visitor
1506
1432
  out: T.any(::IO, ::StringIO),
1507
1433
  indent: ::Integer,
1508
1434
  print_locs: T::Boolean,
1509
- positional_names: T::Boolean
1435
+ positional_names: T::Boolean,
1436
+ max_line_length: T.nilable(::Integer)
1510
1437
  ).void
1511
1438
  end
1512
- def initialize(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil), positional_names: T.unsafe(nil)); end
1439
+ def initialize(out: T.unsafe(nil), indent: T.unsafe(nil), print_locs: T.unsafe(nil), positional_names: T.unsafe(nil), max_line_length: T.unsafe(nil)); end
1513
1440
 
1514
1441
  sig { returns(::Integer) }
1515
1442
  def current_indent; end
@@ -1517,26 +1444,23 @@ class RBI::RBSPrinter < ::RBI::Visitor
1517
1444
  sig { void }
1518
1445
  def dedent; end
1519
1446
 
1520
- # @return [Boolean]
1521
1447
  def in_visibility_group; end
1522
-
1523
- # @return [Boolean]
1524
1448
  def in_visibility_group=(_arg0); end
1525
1449
 
1526
- # Printing
1527
1450
  sig { void }
1528
1451
  def indent; end
1529
1452
 
1453
+ sig { returns(T.nilable(::Integer)) }
1454
+ def max_line_length; end
1455
+
1530
1456
  sig { returns(T::Boolean) }
1531
1457
  def positional_names; end
1532
1458
 
1533
- # @return [Boolean]
1534
1459
  def positional_names=(_arg0); end
1535
1460
 
1536
1461
  sig { returns(T.nilable(::RBI::Node)) }
1537
1462
  def previous_node; end
1538
1463
 
1539
- # Print a string without indentation nor `\n` at the end.
1540
1464
  sig { params(string: ::String).void }
1541
1465
  def print(string); end
1542
1466
 
@@ -1546,21 +1470,23 @@ class RBI::RBSPrinter < ::RBI::Visitor
1546
1470
  sig { returns(T::Boolean) }
1547
1471
  def print_locs; end
1548
1472
 
1549
- # @return [Boolean]
1550
1473
  def print_locs=(_arg0); end
1551
1474
 
1552
1475
  sig { params(node: ::RBI::Method, sig: ::RBI::Sig).void }
1553
1476
  def print_method_sig(node, sig); end
1554
1477
 
1555
- # Print a string with indentation and `\n` at the end.
1478
+ sig { params(node: ::RBI::Method, sig: ::RBI::Sig).void }
1479
+ def print_method_sig_inline(node, sig); end
1480
+
1481
+ sig { params(node: ::RBI::Method, sig: ::RBI::Sig).void }
1482
+ def print_method_sig_multiline(node, sig); end
1483
+
1556
1484
  sig { params(string: ::String).void }
1557
1485
  def printl(string); end
1558
1486
 
1559
- # Print a string without indentation but with a `\n` at the end.
1560
1487
  sig { params(string: T.nilable(::String)).void }
1561
1488
  def printn(string = T.unsafe(nil)); end
1562
1489
 
1563
- # Print a string with indentation but without a `\n` at the end.
1564
1490
  sig { params(string: T.nilable(::String)).void }
1565
1491
  def printt(string = T.unsafe(nil)); end
1566
1492
 
@@ -1722,9 +1648,6 @@ class RBI::RBSPrinter < ::RBI::Visitor
1722
1648
  sig { params(node: ::RBI::Node).returns(T::Boolean) }
1723
1649
  def oneline?(node); end
1724
1650
 
1725
- # Parse a string containing a `T.let(x, X)` and extract the type
1726
- #
1727
- # Returns `nil` is the string is not a `T.let`.
1728
1651
  sig { params(code: T.nilable(::String)).returns(T.nilable(::String)) }
1729
1652
  def parse_t_let(code); end
1730
1653
 
@@ -1842,7 +1765,6 @@ class RBI::Rewriters::AttrToMethods < ::RBI::Visitor
1842
1765
 
1843
1766
  private
1844
1767
 
1845
- # @raise [ReplaceNodeError]
1846
1768
  sig { params(node: ::RBI::Node, with: T::Array[::RBI::Node]).void }
1847
1769
  def replace(node, with:); end
1848
1770
  end
@@ -1860,57 +1782,6 @@ class RBI::Rewriters::Deannotate < ::RBI::Visitor
1860
1782
  def deannotate_node(node); end
1861
1783
  end
1862
1784
 
1863
- # Take a gem version and filter out all RBI that is not relevant to that version based on @version annotations
1864
- # in comments. As an example:
1865
- #
1866
- # ~~~rb
1867
- # tree = Parser.parse_string(<<~RBI)
1868
- # class Foo
1869
- # # @version > 0.3.0
1870
- # def bar
1871
- # end
1872
- #
1873
- # # @version <= 0.3.0
1874
- # def bar(arg1)
1875
- # end
1876
- # end
1877
- # RBI
1878
- #
1879
- # Rewriters::FilterVersions.filter(tree, Gem::Version.new("0.3.1"))
1880
- #
1881
- # assert_equal(<<~RBI, tree.string)
1882
- # class Foo
1883
- # # @version > 0.3.0
1884
- # def bar
1885
- # end
1886
- # end
1887
- # RBI
1888
- # ~~~
1889
- #
1890
- # Supported operators:
1891
- # - equals `=`
1892
- # - not equals `!=`
1893
- # - greater than `>`
1894
- # - greater than or equal to `>=`
1895
- # - less than `<`
1896
- # - less than or equal to `<=`
1897
- # - pessimistic or twiddle-wakka`~>`
1898
- #
1899
- # And/or logic:
1900
- # - "And" logic: put multiple versions on the same line
1901
- # - e.g. `@version > 0.3.0, <1.0.0` means version must be greater than 0.3.0 AND less than 1.0.0
1902
- # - "Or" logic: put multiple versions on subsequent lines
1903
- # - e.g. the following means version must be less than 0.3.0 OR greater than 1.0.0
1904
- # ```
1905
- # # @version < 0.3.0
1906
- # # @version > 1.0.0
1907
- # ```
1908
- # Prerelease versions:
1909
- # - Prerelease versions are considered less than their non-prerelease counterparts
1910
- # - e.g. `0.4.0-prerelease` is less than `0.4.0`
1911
- #
1912
- # RBI with no versions:
1913
- # - RBI with no version annotations are automatically counted towards ALL versions
1914
1785
  class RBI::Rewriters::FilterVersions < ::RBI::Visitor
1915
1786
  sig { params(version: ::Gem::Version).void }
1916
1787
  def initialize(version); end
@@ -1926,56 +1797,11 @@ end
1926
1797
 
1927
1798
  RBI::Rewriters::FilterVersions::VERSION_PREFIX = T.let(T.unsafe(nil), String)
1928
1799
 
1929
- # Rewrite non-singleton methods inside singleton classes to singleton methods
1930
- #
1931
- # Example:
1932
- # ~~~rb
1933
- # class << self
1934
- # def m1; end
1935
- # def self.m2; end
1936
- #
1937
- # class << self
1938
- # def m3; end
1939
- # end
1940
- # end
1941
- # ~~~
1942
- #
1943
- # will be rewritten to:
1944
- #
1945
- # ~~~rb
1946
- # def self.m1; end
1947
- #
1948
- # class << self
1949
- # def self.m2; end
1950
- # def self.m3; end
1951
- # end
1952
- # ~~~
1953
1800
  class RBI::Rewriters::FlattenSingletonMethods < ::RBI::Visitor
1954
1801
  sig { override.params(node: T.nilable(::RBI::Node)).void }
1955
1802
  def visit(node); end
1956
1803
  end
1957
1804
 
1958
- # Flattens visibility nodes into method nodes
1959
- #
1960
- # Example:
1961
- # ~~~rb
1962
- # class A
1963
- # def m1; end
1964
- # private
1965
- # def m2; end
1966
- # def m3; end
1967
- # end
1968
- # ~~~
1969
- #
1970
- # will be transformed into:
1971
- #
1972
- # ~~~rb
1973
- # class A
1974
- # def m1; end
1975
- # private def m2; end
1976
- # private def m3; end
1977
- # end
1978
- # ~~~
1979
1805
  class RBI::Rewriters::FlattenVisibilities < ::RBI::Visitor
1980
1806
  sig { void }
1981
1807
  def initialize; end
@@ -1994,39 +1820,6 @@ class RBI::Rewriters::GroupNodes < ::RBI::Visitor
1994
1820
  def group_kind(node); end
1995
1821
  end
1996
1822
 
1997
- # Merge two RBI trees together
1998
- #
1999
- # Be this `Tree`:
2000
- # ~~~rb
2001
- # class Foo
2002
- # attr_accessor :a
2003
- # def m; end
2004
- # C = 10
2005
- # end
2006
- # ~~~
2007
- #
2008
- # Merged with this one:
2009
- # ~~~rb
2010
- # class Foo
2011
- # attr_reader :a
2012
- # def m(x); end
2013
- # C = 10
2014
- # end
2015
- # ~~~
2016
- #
2017
- # Compatible definitions are merged together while incompatible definitions are moved into a `ConflictTree`:
2018
- # ~~~rb
2019
- # class Foo
2020
- # <<<<<<< left
2021
- # attr_accessor :a
2022
- # def m; end
2023
- # =======
2024
- # attr_reader :a
2025
- # def m(x); end
2026
- # >>>>>>> right
2027
- # C = 10
2028
- # end
2029
- # ~~~
2030
1823
  class RBI::Rewriters::Merge
2031
1824
  sig { params(left_name: ::String, right_name: ::String, keep: ::RBI::Rewriters::Merge::Keep).void }
2032
1825
  def initialize(left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end
@@ -2051,51 +1844,23 @@ class RBI::Rewriters::Merge
2051
1844
  end
2052
1845
  end
2053
1846
 
2054
- # Used for logging / error displaying purpose
2055
- class RBI::Rewriters::Merge::Conflict < ::T::Struct
2056
- const :left, ::RBI::Node
2057
- const :right, ::RBI::Node
2058
- const :left_name, ::String
2059
- const :right_name, ::String
1847
+ class RBI::Rewriters::Merge::Conflict
1848
+ sig { params(left: ::RBI::Node, right: ::RBI::Node, left_name: ::String, right_name: ::String).void }
1849
+ def initialize(left:, right:, left_name:, right_name:); end
1850
+
1851
+ sig { returns(::RBI::Node) }
1852
+ def left; end
1853
+
1854
+ sig { returns(::String) }
1855
+ def left_name; end
1856
+
1857
+ def right; end
1858
+ def right_name; end
2060
1859
 
2061
1860
  sig { returns(::String) }
2062
1861
  def to_s; end
1862
+ end
2063
1863
 
2064
- class << self
2065
- def inherited(s); end
2066
- end
2067
- end
2068
-
2069
- # Merge adjacent conflict trees
2070
- #
2071
- # Transform this:
2072
- # ~~~rb
2073
- # class Foo
2074
- # <<<<<<< left
2075
- # def m1; end
2076
- # =======
2077
- # def m1(a); end
2078
- # >>>>>>> right
2079
- # <<<<<<< left
2080
- # def m2(a); end
2081
- # =======
2082
- # def m2; end
2083
- # >>>>>>> right
2084
- # end
2085
- # ~~~
2086
- #
2087
- # Into this:
2088
- # ~~~rb
2089
- # class Foo
2090
- # <<<<<<< left
2091
- # def m1; end
2092
- # def m2(a); end
2093
- # =======
2094
- # def m1(a); end
2095
- # def m2; end
2096
- # >>>>>>> right
2097
- # end
2098
- # ~~~
2099
1864
  class RBI::Rewriters::Merge::ConflictTreeMerger < ::RBI::Visitor
2100
1865
  sig { override.params(node: T.nilable(::RBI::Node)).void }
2101
1866
  def visit(node); end
@@ -2109,14 +1874,18 @@ class RBI::Rewriters::Merge::ConflictTreeMerger < ::RBI::Visitor
2109
1874
  def merge_conflict_trees(left, right); end
2110
1875
  end
2111
1876
 
2112
- class RBI::Rewriters::Merge::Keep < ::T::Enum
2113
- enums do
2114
- LEFT = new
2115
- NONE = new
2116
- RIGHT = new
1877
+ class RBI::Rewriters::Merge::Keep
1878
+ class << self
1879
+ private
1880
+
1881
+ def new(*_arg0); end
2117
1882
  end
2118
1883
  end
2119
1884
 
1885
+ RBI::Rewriters::Merge::Keep::LEFT = T.let(T.unsafe(nil), RBI::Rewriters::Merge::Keep)
1886
+ RBI::Rewriters::Merge::Keep::NONE = T.let(T.unsafe(nil), RBI::Rewriters::Merge::Keep)
1887
+ RBI::Rewriters::Merge::Keep::RIGHT = T.let(T.unsafe(nil), RBI::Rewriters::Merge::Keep)
1888
+
2120
1889
  class RBI::Rewriters::Merge::TreeMerger < ::RBI::Visitor
2121
1890
  sig do
2122
1891
  params(
@@ -2162,22 +1931,6 @@ class RBI::Rewriters::NestSingletonMethods < ::RBI::Visitor
2162
1931
  def visit(node); end
2163
1932
  end
2164
1933
 
2165
- # This rewriter moves top-level members into a top-level Object class
2166
- #
2167
- # Example:
2168
- # ~~~rb
2169
- # def foo; end
2170
- # attr_reader :bar
2171
- # ~~~
2172
- #
2173
- # will be rewritten to:
2174
- #
2175
- # ~~~rb
2176
- # class Object
2177
- # def foo; end
2178
- # attr_reader :bar
2179
- # end
2180
- # ~~~
2181
1934
  class RBI::Rewriters::NestTopLevelMembers < ::RBI::Visitor
2182
1935
  sig { void }
2183
1936
  def initialize; end
@@ -2186,48 +1939,6 @@ class RBI::Rewriters::NestTopLevelMembers < ::RBI::Visitor
2186
1939
  def visit(node); end
2187
1940
  end
2188
1941
 
2189
- # Remove all definitions existing in the index from the current tree
2190
- #
2191
- # Let's create an `Index` from two different `Tree`s:
2192
- # ~~~rb
2193
- # tree1 = Parse.parse_string(<<~RBI)
2194
- # class Foo
2195
- # def foo; end
2196
- # end
2197
- # RBI
2198
- #
2199
- # tree2 = Parse.parse_string(<<~RBI)
2200
- # FOO = 10
2201
- # RBI
2202
- #
2203
- # index = Index.index(tree1, tree2)
2204
- # ~~~
2205
- #
2206
- # We can use `RemoveKnownDefinitions` to remove the definitions found in the `index` from the `Tree` to clean:
2207
- # ~~~rb
2208
- # tree_to_clean = Parser.parse_string(<<~RBI)
2209
- # class Foo
2210
- # def foo; end
2211
- # def bar; end
2212
- # end
2213
- # FOO = 10
2214
- # BAR = 42
2215
- # RBI
2216
- #
2217
- # cleaned_tree, operations = RemoveKnownDefinitions.remove(tree_to_clean, index)
2218
- #
2219
- # assert_equal(<<~RBI, cleaned_tree)
2220
- # class Foo
2221
- # def bar; end
2222
- # end
2223
- # BAR = 42
2224
- # RBI
2225
- #
2226
- # assert_equal(<<~OPERATIONS, operations.join("\n"))
2227
- # Deleted ::Foo#foo at -:2:2-2-16 (duplicate from -:2:2-2:16)
2228
- # Deleted ::FOO at -:5:0-5:8 (duplicate from -:1:0-1:8)
2229
- # OPERATIONS
2230
- # ~~~
2231
1942
  class RBI::Rewriters::RemoveKnownDefinitions < ::RBI::Visitor
2232
1943
  sig { params(index: ::RBI::Index).void }
2233
1944
  def initialize(index); end
@@ -2263,16 +1974,17 @@ class RBI::Rewriters::RemoveKnownDefinitions < ::RBI::Visitor
2263
1974
  end
2264
1975
  end
2265
1976
 
2266
- class RBI::Rewriters::RemoveKnownDefinitions::Operation < ::T::Struct
2267
- const :deleted_node, ::RBI::Node
2268
- const :duplicate_of, ::RBI::Node
1977
+ class RBI::Rewriters::RemoveKnownDefinitions::Operation
1978
+ sig { params(deleted_node: ::RBI::Node, duplicate_of: ::RBI::Node).void }
1979
+ def initialize(deleted_node:, duplicate_of:); end
1980
+
1981
+ sig { returns(::RBI::Node) }
1982
+ def deleted_node; end
1983
+
1984
+ def duplicate_of; end
2269
1985
 
2270
1986
  sig { returns(::String) }
2271
1987
  def to_s; end
2272
-
2273
- class << self
2274
- def inherited(s); end
2275
- end
2276
1988
  end
2277
1989
 
2278
1990
  class RBI::Rewriters::SortNodes < ::RBI::Visitor
@@ -2294,7 +2006,6 @@ class RBI::Rewriters::SortNodes < ::RBI::Visitor
2294
2006
  def sort_node_names!(node); end
2295
2007
  end
2296
2008
 
2297
- # Translate all RBS signature comments to Sorbet RBI signatures
2298
2009
  class RBI::Rewriters::TranslateRBSSigs < ::RBI::Visitor
2299
2010
  sig { override.params(node: T.nilable(::RBI::Node)).void }
2300
2011
  def visit(node); end
@@ -2313,19 +2024,14 @@ end
2313
2024
 
2314
2025
  class RBI::Rewriters::TranslateRBSSigs::Error < ::RBI::Error; end
2315
2026
 
2316
- # Scopes
2317
- #
2318
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
2319
2027
  class RBI::Scope < ::RBI::Tree
2320
2028
  include ::RBI::Indexable
2321
2029
 
2322
2030
  abstract!
2323
2031
 
2324
- # Duplicate `self` scope without its body
2325
2032
  sig { returns(T.self_type) }
2326
2033
  def dup_empty; end
2327
2034
 
2328
- # @abstract
2329
2035
  sig { abstract.returns(::String) }
2330
2036
  def fully_qualified_name; end
2331
2037
 
@@ -2336,18 +2042,6 @@ class RBI::Scope < ::RBI::Tree
2336
2042
  def to_s; end
2337
2043
  end
2338
2044
 
2339
- # A conflict between two scope headers
2340
- #
2341
- # Is rendered as a merge conflict between `left` and` right` for scope definitions:
2342
- # ~~~rb
2343
- # <<<<<<< left
2344
- # class Foo
2345
- # =======
2346
- # module Foo
2347
- # >>>>>>> right
2348
- # def m1; end
2349
- # end
2350
- # ~~~
2351
2045
  class RBI::ScopeConflict < ::RBI::Tree
2352
2046
  sig { params(left: ::RBI::Scope, right: ::RBI::Scope, left_name: ::String, right_name: ::String).void }
2353
2047
  def initialize(left:, right:, left_name: T.unsafe(nil), right_name: T.unsafe(nil)); end
@@ -2358,14 +2052,10 @@ class RBI::ScopeConflict < ::RBI::Tree
2358
2052
  sig { returns(::String) }
2359
2053
  def left_name; end
2360
2054
 
2361
- # @return [Scope]
2362
2055
  def right; end
2363
-
2364
- # @return [String]
2365
2056
  def right_name; end
2366
2057
  end
2367
2058
 
2368
- # Sends
2369
2059
  class RBI::Send < ::RBI::NodeWithComments
2370
2060
  include ::RBI::Indexable
2371
2061
 
@@ -2402,7 +2092,6 @@ class RBI::Send < ::RBI::NodeWithComments
2402
2092
  def to_s; end
2403
2093
  end
2404
2094
 
2405
- # Sorbet's sigs
2406
2095
  class RBI::Sig < ::RBI::NodeWithComments
2407
2096
  sig do
2408
2097
  params(
@@ -2432,40 +2121,23 @@ class RBI::Sig < ::RBI::NodeWithComments
2432
2121
  sig { params(name: ::String, type: T.any(::RBI::Type, ::String)).void }
2433
2122
  def add_param(name, type); end
2434
2123
 
2435
- # @return [Boolean]
2436
2124
  def allow_incompatible_override; end
2437
-
2438
- # @return [Boolean]
2439
2125
  def allow_incompatible_override=(_arg0); end
2440
2126
 
2441
2127
  sig { returns(T.nilable(::Symbol)) }
2442
2128
  def checked; end
2443
2129
 
2444
- # @return [Symbol, nil]
2445
2130
  def checked=(_arg0); end
2446
2131
 
2447
2132
  sig { returns(T::Boolean) }
2448
2133
  def is_abstract; end
2449
2134
 
2450
- # @return [Boolean]
2451
2135
  def is_abstract=(_arg0); end
2452
-
2453
- # @return [Boolean]
2454
2136
  def is_final; end
2455
-
2456
- # @return [Boolean]
2457
2137
  def is_final=(_arg0); end
2458
-
2459
- # @return [Boolean]
2460
2138
  def is_overridable; end
2461
-
2462
- # @return [Boolean]
2463
2139
  def is_overridable=(_arg0); end
2464
-
2465
- # @return [Boolean]
2466
2140
  def is_override; end
2467
-
2468
- # @return [Boolean]
2469
2141
  def is_override=(_arg0); end
2470
2142
 
2471
2143
  sig { returns(T::Array[::RBI::SigParam]) }
@@ -2474,16 +2146,12 @@ class RBI::Sig < ::RBI::NodeWithComments
2474
2146
  sig { returns(T.any(::RBI::Type, ::String)) }
2475
2147
  def return_type; end
2476
2148
 
2477
- # @return [Type, String]
2478
2149
  def return_type=(_arg0); end
2479
2150
 
2480
2151
  sig { returns(T::Array[::String]) }
2481
2152
  def type_params; end
2482
2153
 
2483
- # @return [Boolean]
2484
2154
  def without_runtime; end
2485
-
2486
- # @return [Boolean]
2487
2155
  def without_runtime=(_arg0); end
2488
2156
  end
2489
2157
 
@@ -2545,23 +2213,19 @@ class RBI::Struct < ::RBI::Scope
2545
2213
  sig { returns(T::Boolean) }
2546
2214
  def keyword_init; end
2547
2215
 
2548
- # @return [Boolean]
2549
2216
  def keyword_init=(_arg0); end
2550
2217
 
2551
2218
  sig { returns(T::Array[::Symbol]) }
2552
2219
  def members; end
2553
2220
 
2554
- # @return [Array<Symbol>]
2555
2221
  def members=(_arg0); end
2556
2222
 
2557
2223
  sig { returns(::String) }
2558
2224
  def name; end
2559
2225
 
2560
- # @return [String]
2561
2226
  def name=(_arg0); end
2562
2227
  end
2563
2228
 
2564
- # Sorbet's T::Enum
2565
2229
  class RBI::TEnum < ::RBI::Class
2566
2230
  sig do
2567
2231
  params(
@@ -2620,7 +2284,6 @@ class RBI::TEnumValue < ::RBI::NodeWithComments
2620
2284
  def to_s; end
2621
2285
  end
2622
2286
 
2623
- # Sorbet's T::Struct
2624
2287
  class RBI::TStruct < ::RBI::Class
2625
2288
  sig do
2626
2289
  params(
@@ -2661,7 +2324,6 @@ class RBI::TStructConst < ::RBI::TStructField
2661
2324
  def to_s; end
2662
2325
  end
2663
2326
 
2664
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
2665
2327
  class RBI::TStructField < ::RBI::NodeWithComments
2666
2328
  abstract!
2667
2329
 
@@ -2682,23 +2344,19 @@ class RBI::TStructField < ::RBI::NodeWithComments
2682
2344
  sig { returns(T.nilable(::String)) }
2683
2345
  def default; end
2684
2346
 
2685
- # @return [String, nil]
2686
2347
  def default=(_arg0); end
2687
2348
 
2688
- # @abstract
2689
2349
  sig { abstract.returns(T::Array[::String]) }
2690
2350
  def fully_qualified_names; end
2691
2351
 
2692
2352
  sig { returns(::String) }
2693
2353
  def name; end
2694
2354
 
2695
- # @return [String]
2696
2355
  def name=(_arg0); end
2697
2356
 
2698
2357
  sig { returns(T.any(::RBI::Type, ::String)) }
2699
2358
  def type; end
2700
2359
 
2701
- # @return [Type, String]
2702
2360
  def type=(_arg0); end
2703
2361
  end
2704
2362
 
@@ -2862,16 +2520,12 @@ class RBI::Tree < ::RBI::NodeWithComments
2862
2520
  def nodes_cache; end
2863
2521
  end
2864
2522
 
2865
- # The base class for all RBI types.
2866
- #
2867
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
2868
2523
  class RBI::Type
2869
2524
  abstract!
2870
2525
 
2871
2526
  sig { void }
2872
2527
  def initialize; end
2873
2528
 
2874
- # @abstract
2875
2529
  sig { abstract.params(other: ::BasicObject).returns(T::Boolean) }
2876
2530
  def ==(other); end
2877
2531
 
@@ -2881,39 +2535,24 @@ class RBI::Type
2881
2535
  sig { override.returns(::Integer) }
2882
2536
  def hash; end
2883
2537
 
2884
- # Returns a new type that is `nilable` if it is not already.
2885
- #
2886
- # If the type is already nilable, it returns itself.
2887
- # ```ruby
2888
- # type = RBI::Type.simple("String")
2889
- # type.to_rbi # => "String"
2890
- # type.nilable.to_rbi # => "T.nilable(String)"
2891
- # type.nilable.nilable.to_rbi # => "T.nilable(String)"
2892
- # ```
2893
2538
  sig { returns(::RBI::Type) }
2894
2539
  def nilable; end
2895
2540
 
2896
- # Returns whether the type is nilable.
2897
2541
  sig { returns(T::Boolean) }
2898
2542
  def nilable?; end
2899
2543
 
2900
- # Returns the non-nilable version of the type.
2901
- # If the type is already non-nilable, it returns itself.
2902
- # If the type is nilable, it returns the inner type.
2903
- #
2904
- # ```ruby
2905
- # type = RBI::Type.nilable(RBI::Type.simple("String"))
2906
- # type.to_rbi # => "T.nilable(String)"
2907
- # type.non_nilable.to_rbi # => "String"
2908
- # type.non_nilable.non_nilable.to_rbi # => "String"
2909
- # ```
2910
2544
  sig { returns(::RBI::Type) }
2911
2545
  def non_nilable; end
2912
2546
 
2547
+ sig { abstract.returns(::RBI::Type) }
2548
+ def normalize; end
2549
+
2913
2550
  sig { returns(::String) }
2914
2551
  def rbs_string; end
2915
2552
 
2916
- # @abstract
2553
+ sig { abstract.returns(::RBI::Type) }
2554
+ def simplify; end
2555
+
2917
2556
  sig { abstract.returns(::String) }
2918
2557
  def to_rbi; end
2919
2558
 
@@ -2921,95 +2560,63 @@ class RBI::Type
2921
2560
  def to_s; end
2922
2561
 
2923
2562
  class << self
2924
- # Builds a type that represents an intersection of multiple types like `T.all(String, Integer)`.
2925
- #
2926
- # Note that this method transforms types such as `T.all(String, String)` into `String`, so
2927
- # it may return something other than a `All`.
2928
2563
  sig { params(type1: ::RBI::Type, type2: ::RBI::Type, types: ::RBI::Type).returns(::RBI::Type) }
2929
2564
  def all(type1, type2, *types); end
2930
2565
 
2931
- # Builds a type that represents a union of multiple types like `T.any(String, Integer)`.
2932
- #
2933
- # Note that this method transforms types such as `T.any(String, NilClass)` into `T.nilable(String)`, so
2934
- # it may return something other than a `Any`.
2935
2566
  sig { params(type1: ::RBI::Type, type2: ::RBI::Type, types: ::RBI::Type).returns(::RBI::Type) }
2936
2567
  def any(type1, type2, *types); end
2937
2568
 
2938
- # Builds a type that represents `T.anything`.
2939
2569
  sig { returns(::RBI::Type::Anything) }
2940
2570
  def anything; end
2941
2571
 
2942
- # Builds a type that represents `T.attached_class`.
2943
2572
  sig { returns(::RBI::Type::AttachedClass) }
2944
2573
  def attached_class; end
2945
2574
 
2946
- # Builds a type that represents `T::Boolean`.
2947
2575
  sig { returns(::RBI::Type::Boolean) }
2948
2576
  def boolean; end
2949
2577
 
2950
- # Builds a type that represents the singleton class of another type like `T.class_of(Foo)`.
2951
2578
  sig { params(type: ::RBI::Type::Simple, type_parameter: T.nilable(::RBI::Type)).returns(::RBI::Type::ClassOf) }
2952
2579
  def class_of(type, type_parameter = T.unsafe(nil)); end
2953
2580
 
2954
- # Builds a type that represents a generic type like `T::Array[String]` or `T::Hash[Symbol, Integer]`.
2955
2581
  sig { params(name: ::String, params: T.any(::RBI::Type, T::Array[::RBI::Type])).returns(::RBI::Type::Generic) }
2956
2582
  def generic(name, *params); end
2957
2583
 
2958
- # Builds a type that represents a nilable of another type like `T.nilable(String)`.
2959
- #
2960
- # Note that this method transforms types such as `T.nilable(T.untyped)` into `T.untyped`, so
2961
- # it may return something other than a `RBI::Type::Nilable`.
2962
2584
  sig { params(type: ::RBI::Type).returns(::RBI::Type) }
2963
2585
  def nilable(type); end
2964
2586
 
2965
- # Builds a type that represents `T.noreturn`.
2966
2587
  sig { returns(::RBI::Type::NoReturn) }
2967
2588
  def noreturn; end
2968
2589
 
2969
2590
  sig { params(node: ::Prism::Node).returns(::RBI::Type) }
2970
2591
  def parse_node(node); end
2971
2592
 
2972
- # @raise [Error]
2973
2593
  sig { params(string: ::String).returns(::RBI::Type) }
2974
2594
  def parse_string(string); end
2975
2595
 
2976
- # Builds a type that represents a proc type like `T.proc.void`.
2977
2596
  sig { returns(::RBI::Type::Proc) }
2978
2597
  def proc; end
2979
2598
 
2980
- # Builds a type that represents `T.self_type`.
2981
2599
  sig { returns(::RBI::Type::SelfType) }
2982
2600
  def self_type; end
2983
2601
 
2984
- # Builds a type that represents a shape type like `{name: String, age: Integer}`.
2985
2602
  sig { params(types: T::Hash[T.any(::String, ::Symbol), ::RBI::Type]).returns(::RBI::Type::Shape) }
2986
2603
  def shape(types = T.unsafe(nil)); end
2987
2604
 
2988
- # Builds a simple type like `String` or `::Foo::Bar`.
2989
- #
2990
- # It raises a `NameError` if the name is not a valid Ruby class identifier.
2991
- #
2992
- # @raise [NameError]
2993
2605
  sig { params(name: ::String).returns(::RBI::Type::Simple) }
2994
2606
  def simple(name); end
2995
2607
 
2996
- # Builds a type that represents the class of another type like `T::Class[Foo]`.
2997
2608
  sig { params(type: ::RBI::Type).returns(::RBI::Type::Class) }
2998
2609
  def t_class(type); end
2999
2610
 
3000
- # Builds a type that represents a tuple type like `[String, Integer]`.
3001
2611
  sig { params(types: T.any(::RBI::Type, T::Array[::RBI::Type])).returns(::RBI::Type::Tuple) }
3002
2612
  def tuple(*types); end
3003
2613
 
3004
- # Builds a type that represents a type parameter like `T.type_parameter(:U)`.
3005
2614
  sig { params(name: ::Symbol).returns(::RBI::Type::TypeParameter) }
3006
2615
  def type_parameter(name); end
3007
2616
 
3008
- # Builds a type that represents `T.untyped`.
3009
2617
  sig { returns(::RBI::Type::Untyped) }
3010
2618
  def untyped; end
3011
2619
 
3012
- # Builds a type that represents `void`.
3013
2620
  sig { returns(::RBI::Type::Void) }
3014
2621
  def void; end
3015
2622
 
@@ -3024,14 +2631,12 @@ class RBI::Type
3024
2631
  sig { params(node: ::Prism::CallNode, count: ::Integer).returns(T::Array[::Prism::Node]) }
3025
2632
  def check_arguments_exactly!(node, count); end
3026
2633
 
3027
- # @raise [Error]
3028
2634
  sig { params(node: ::Prism::CallNode).returns(::RBI::Type) }
3029
2635
  def parse_call(node); end
3030
2636
 
3031
2637
  sig { params(node: T.any(::Prism::ConstantPathNode, ::Prism::ConstantReadNode)).returns(::RBI::Type) }
3032
2638
  def parse_constant(node); end
3033
2639
 
3034
- # @raise [Error]
3035
2640
  sig { params(node: ::Prism::CallNode).returns(::RBI::Type) }
3036
2641
  def parse_proc(node); end
3037
2642
 
@@ -3061,49 +2666,73 @@ class RBI::Type
3061
2666
  end
3062
2667
  end
3063
2668
 
3064
- # A type that is intersection of multiple types like `T.all(String, Integer)`.
3065
2669
  class RBI::Type::All < ::RBI::Type::Composite
2670
+ sig { override.returns(::RBI::Type) }
2671
+ def normalize; end
2672
+
2673
+ sig { override.returns(::RBI::Type) }
2674
+ def simplify; end
2675
+
3066
2676
  sig { override.returns(::String) }
3067
2677
  def to_rbi; end
3068
2678
  end
3069
2679
 
3070
- # A type that is union of multiple types like `T.any(String, Integer)`.
3071
2680
  class RBI::Type::Any < ::RBI::Type::Composite
3072
2681
  sig { returns(T::Boolean) }
3073
2682
  def nilable?; end
3074
2683
 
2684
+ sig { override.returns(::RBI::Type) }
2685
+ def normalize; end
2686
+
2687
+ sig { override.returns(::RBI::Type) }
2688
+ def simplify; end
2689
+
3075
2690
  sig { override.returns(::String) }
3076
2691
  def to_rbi; end
3077
2692
  end
3078
2693
 
3079
- # `T.anything`.
3080
2694
  class RBI::Type::Anything < ::RBI::Type
3081
2695
  sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3082
2696
  def ==(other); end
3083
2697
 
2698
+ sig { override.returns(::RBI::Type) }
2699
+ def normalize; end
2700
+
2701
+ sig { override.returns(::RBI::Type) }
2702
+ def simplify; end
2703
+
3084
2704
  sig { override.returns(::String) }
3085
2705
  def to_rbi; end
3086
2706
  end
3087
2707
 
3088
- # `T.attached_class`.
3089
2708
  class RBI::Type::AttachedClass < ::RBI::Type
3090
2709
  sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3091
2710
  def ==(other); end
3092
2711
 
2712
+ sig { override.returns(::RBI::Type) }
2713
+ def normalize; end
2714
+
2715
+ sig { override.returns(::RBI::Type) }
2716
+ def simplify; end
2717
+
3093
2718
  sig { override.returns(::String) }
3094
2719
  def to_rbi; end
3095
2720
  end
3096
2721
 
3097
- # `T::Boolean`.
3098
2722
  class RBI::Type::Boolean < ::RBI::Type
3099
2723
  sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3100
2724
  def ==(other); end
3101
2725
 
2726
+ sig { override.returns(::RBI::Type) }
2727
+ def normalize; end
2728
+
2729
+ sig { override.returns(::RBI::Type) }
2730
+ def simplify; end
2731
+
3102
2732
  sig { override.returns(::String) }
3103
2733
  def to_rbi; end
3104
2734
  end
3105
2735
 
3106
- # The class of another type like `T::Class[Foo]`.
3107
2736
  class RBI::Type::Class < ::RBI::Type
3108
2737
  sig { params(type: ::RBI::Type).void }
3109
2738
  def initialize(type); end
@@ -3111,6 +2740,12 @@ class RBI::Type::Class < ::RBI::Type
3111
2740
  sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3112
2741
  def ==(other); end
3113
2742
 
2743
+ sig { override.returns(::RBI::Type) }
2744
+ def normalize; end
2745
+
2746
+ sig { override.returns(::RBI::Type) }
2747
+ def simplify; end
2748
+
3114
2749
  sig { override.returns(::String) }
3115
2750
  def to_rbi; end
3116
2751
 
@@ -3118,7 +2753,6 @@ class RBI::Type::Class < ::RBI::Type
3118
2753
  def type; end
3119
2754
  end
3120
2755
 
3121
- # The singleton class of another type like `T.class_of(Foo)`.
3122
2756
  class RBI::Type::ClassOf < ::RBI::Type
3123
2757
  sig { params(type: ::RBI::Type::Simple, type_parameter: T.nilable(::RBI::Type)).void }
3124
2758
  def initialize(type, type_parameter = T.unsafe(nil)); end
@@ -3126,6 +2760,12 @@ class RBI::Type::ClassOf < ::RBI::Type
3126
2760
  sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3127
2761
  def ==(other); end
3128
2762
 
2763
+ sig { override.returns(::RBI::Type) }
2764
+ def normalize; end
2765
+
2766
+ sig { override.returns(::RBI::Type) }
2767
+ def simplify; end
2768
+
3129
2769
  sig { override.returns(::String) }
3130
2770
  def to_rbi; end
3131
2771
 
@@ -3136,9 +2776,6 @@ class RBI::Type::ClassOf < ::RBI::Type
3136
2776
  def type_parameter; end
3137
2777
  end
3138
2778
 
3139
- # A type that is composed of multiple types like `T.all(String, Integer)`.
3140
- #
3141
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
3142
2779
  class RBI::Type::Composite < ::RBI::Type
3143
2780
  abstract!
3144
2781
 
@@ -3154,7 +2791,6 @@ end
3154
2791
 
3155
2792
  class RBI::Type::Error < ::RBI::Error; end
3156
2793
 
3157
- # A generic type like `T::Array[String]` or `T::Hash[Symbol, Integer]`.
3158
2794
  class RBI::Type::Generic < ::RBI::Type
3159
2795
  sig { params(name: ::String, params: ::RBI::Type).void }
3160
2796
  def initialize(name, *params); end
@@ -3165,14 +2801,19 @@ class RBI::Type::Generic < ::RBI::Type
3165
2801
  sig { returns(::String) }
3166
2802
  def name; end
3167
2803
 
2804
+ sig { override.returns(::RBI::Type) }
2805
+ def normalize; end
2806
+
3168
2807
  sig { returns(T::Array[::RBI::Type]) }
3169
2808
  def params; end
3170
2809
 
2810
+ sig { override.returns(::RBI::Type) }
2811
+ def simplify; end
2812
+
3171
2813
  sig { override.returns(::String) }
3172
2814
  def to_rbi; end
3173
2815
  end
3174
2816
 
3175
- # A type that can be `nil` like `T.nilable(String)`.
3176
2817
  class RBI::Type::Nilable < ::RBI::Type
3177
2818
  sig { params(type: ::RBI::Type).void }
3178
2819
  def initialize(type); end
@@ -3180,6 +2821,12 @@ class RBI::Type::Nilable < ::RBI::Type
3180
2821
  sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3181
2822
  def ==(other); end
3182
2823
 
2824
+ sig { override.returns(::RBI::Type) }
2825
+ def normalize; end
2826
+
2827
+ sig { override.returns(::RBI::Type) }
2828
+ def simplify; end
2829
+
3183
2830
  sig { override.returns(::String) }
3184
2831
  def to_rbi; end
3185
2832
 
@@ -3187,16 +2834,20 @@ class RBI::Type::Nilable < ::RBI::Type
3187
2834
  def type; end
3188
2835
  end
3189
2836
 
3190
- # `T.noreturn`.
3191
2837
  class RBI::Type::NoReturn < ::RBI::Type
3192
2838
  sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3193
2839
  def ==(other); end
3194
2840
 
2841
+ sig { override.returns(::RBI::Type) }
2842
+ def normalize; end
2843
+
2844
+ sig { override.returns(::RBI::Type) }
2845
+ def simplify; end
2846
+
3195
2847
  sig { override.returns(::String) }
3196
2848
  def to_rbi; end
3197
2849
  end
3198
2850
 
3199
- # A proc type like `T.proc.void`.
3200
2851
  class RBI::Type::Proc < ::RBI::Type
3201
2852
  sig { void }
3202
2853
  def initialize; end
@@ -3207,6 +2858,9 @@ class RBI::Type::Proc < ::RBI::Type
3207
2858
  sig { params(type: T.untyped).returns(T.self_type) }
3208
2859
  def bind(type); end
3209
2860
 
2861
+ sig { override.returns(::RBI::Type) }
2862
+ def normalize; end
2863
+
3210
2864
  sig { params(params: ::RBI::Type).returns(T.self_type) }
3211
2865
  def params(**params); end
3212
2866
 
@@ -3222,6 +2876,9 @@ class RBI::Type::Proc < ::RBI::Type
3222
2876
  sig { params(type: T.untyped).returns(T.self_type) }
3223
2877
  def returns(type); end
3224
2878
 
2879
+ sig { override.returns(::RBI::Type) }
2880
+ def simplify; end
2881
+
3225
2882
  sig { override.returns(::String) }
3226
2883
  def to_rbi; end
3227
2884
 
@@ -3229,16 +2886,20 @@ class RBI::Type::Proc < ::RBI::Type
3229
2886
  def void; end
3230
2887
  end
3231
2888
 
3232
- # `T.self_type`.
3233
2889
  class RBI::Type::SelfType < ::RBI::Type
3234
2890
  sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3235
2891
  def ==(other); end
3236
2892
 
2893
+ sig { override.returns(::RBI::Type) }
2894
+ def normalize; end
2895
+
2896
+ sig { override.returns(::RBI::Type) }
2897
+ def simplify; end
2898
+
3237
2899
  sig { override.returns(::String) }
3238
2900
  def to_rbi; end
3239
2901
  end
3240
2902
 
3241
- # A shape type like `{name: String, age: Integer}`.
3242
2903
  class RBI::Type::Shape < ::RBI::Type
3243
2904
  sig { params(types: T::Hash[T.any(::String, ::Symbol), ::RBI::Type]).void }
3244
2905
  def initialize(types); end
@@ -3246,6 +2907,12 @@ class RBI::Type::Shape < ::RBI::Type
3246
2907
  sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3247
2908
  def ==(other); end
3248
2909
 
2910
+ sig { override.returns(::RBI::Type) }
2911
+ def normalize; end
2912
+
2913
+ sig { override.returns(::RBI::Type) }
2914
+ def simplify; end
2915
+
3249
2916
  sig { override.returns(::String) }
3250
2917
  def to_rbi; end
3251
2918
 
@@ -3253,9 +2920,6 @@ class RBI::Type::Shape < ::RBI::Type
3253
2920
  def types; end
3254
2921
  end
3255
2922
 
3256
- # A type that represents a simple class name like `String` or `Foo`.
3257
- #
3258
- # It can also be a qualified name like `::Foo` or `Foo::Bar`.
3259
2923
  class RBI::Type::Simple < ::RBI::Type
3260
2924
  sig { params(name: ::String).void }
3261
2925
  def initialize(name); end
@@ -3266,11 +2930,16 @@ class RBI::Type::Simple < ::RBI::Type
3266
2930
  sig { returns(::String) }
3267
2931
  def name; end
3268
2932
 
2933
+ sig { override.returns(::RBI::Type) }
2934
+ def normalize; end
2935
+
2936
+ sig { override.returns(::RBI::Type) }
2937
+ def simplify; end
2938
+
3269
2939
  sig { override.returns(::String) }
3270
2940
  def to_rbi; end
3271
2941
  end
3272
2942
 
3273
- # A tuple type like `[String, Integer]`.
3274
2943
  class RBI::Type::Tuple < ::RBI::Type
3275
2944
  sig { params(types: T::Array[::RBI::Type]).void }
3276
2945
  def initialize(types); end
@@ -3278,6 +2947,12 @@ class RBI::Type::Tuple < ::RBI::Type
3278
2947
  sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3279
2948
  def ==(other); end
3280
2949
 
2950
+ sig { override.returns(::RBI::Type) }
2951
+ def normalize; end
2952
+
2953
+ sig { override.returns(::RBI::Type) }
2954
+ def simplify; end
2955
+
3281
2956
  sig { override.returns(::String) }
3282
2957
  def to_rbi; end
3283
2958
 
@@ -3285,7 +2960,6 @@ class RBI::Type::Tuple < ::RBI::Type
3285
2960
  def types; end
3286
2961
  end
3287
2962
 
3288
- # A type parameter like `T.type_parameter(:U)`.
3289
2963
  class RBI::Type::TypeParameter < ::RBI::Type
3290
2964
  sig { params(name: ::Symbol).void }
3291
2965
  def initialize(name); end
@@ -3296,15 +2970,26 @@ class RBI::Type::TypeParameter < ::RBI::Type
3296
2970
  sig { returns(::Symbol) }
3297
2971
  def name; end
3298
2972
 
2973
+ sig { override.returns(::RBI::Type) }
2974
+ def normalize; end
2975
+
2976
+ sig { override.returns(::RBI::Type) }
2977
+ def simplify; end
2978
+
3299
2979
  sig { override.returns(::String) }
3300
2980
  def to_rbi; end
3301
2981
  end
3302
2982
 
3303
- # `T.untyped`.
3304
2983
  class RBI::Type::Untyped < ::RBI::Type
3305
2984
  sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3306
2985
  def ==(other); end
3307
2986
 
2987
+ sig { override.returns(::RBI::Type) }
2988
+ def normalize; end
2989
+
2990
+ sig { override.returns(::RBI::Type) }
2991
+ def simplify; end
2992
+
3308
2993
  sig { override.returns(::String) }
3309
2994
  def to_rbi; end
3310
2995
  end
@@ -3372,11 +3057,16 @@ end
3372
3057
 
3373
3058
  class RBI::Type::Visitor::Error < ::RBI::Error; end
3374
3059
 
3375
- # `void`.
3376
3060
  class RBI::Type::Void < ::RBI::Type
3377
3061
  sig { override.params(other: ::BasicObject).returns(T::Boolean) }
3378
3062
  def ==(other); end
3379
3063
 
3064
+ sig { override.returns(::RBI::Type) }
3065
+ def normalize; end
3066
+
3067
+ sig { override.returns(::RBI::Type) }
3068
+ def simplify; end
3069
+
3380
3070
  sig { override.returns(::String) }
3381
3071
  def to_rbi; end
3382
3072
  end
@@ -3407,13 +3097,12 @@ class RBI::TypeMember < ::RBI::NodeWithComments
3407
3097
  sig { override.returns(::String) }
3408
3098
  def to_s; end
3409
3099
 
3410
- # @return [String]
3411
3100
  def value; end
3412
3101
  end
3413
3102
 
3414
3103
  class RBI::TypePrinter
3415
- sig { void }
3416
- def initialize; end
3104
+ sig { params(max_line_length: T.nilable(::Integer)).void }
3105
+ def initialize(max_line_length: T.unsafe(nil)); end
3417
3106
 
3418
3107
  sig { returns(::String) }
3419
3108
  def string; end
@@ -3502,9 +3191,6 @@ end
3502
3191
 
3503
3192
  RBI::VERSION = T.let(T.unsafe(nil), String)
3504
3193
 
3505
- # Visibility
3506
- #
3507
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
3508
3194
  class RBI::Visibility < ::RBI::NodeWithComments
3509
3195
  abstract!
3510
3196
 
@@ -3535,7 +3221,6 @@ class RBI::VisibilityGroup < ::RBI::Tree
3535
3221
  def visibility; end
3536
3222
  end
3537
3223
 
3538
- # @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
3539
3224
  class RBI::Visitor
3540
3225
  abstract!
3541
3226