rbi 0.3.5 → 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.
- checksums.yaml +4 -4
- data/lib/rbi/version.rb +1 -1
- data/rbi/rbi.rbi +24 -496
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80df141e229452edf3fb51dc8933c130ce2a2f972ee6906be79680d79f33a720
|
4
|
+
data.tar.gz: '099a5b5fb43ccd50cf262bcdbc0d8fde6cd0aa14983851c9de14f488def2a56b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 791d993759d3e237a52d34be622c23eec92d1adb26b267aa47b3aa9e7ce1767b96fff75e02d895493fb63b84fe3f15cb1c37f880db1698e5a8b9e17cba77503e
|
7
|
+
data.tar.gz: cdf11ef801d7ac8a1329b39e095c4895d006ae46ad800d50d1d2cb52aa9c41fdb704557a8a660376b53e4bdb86a076bacde0a5a2c33d0031478dda36850297b1
|
data/lib/rbi/version.rb
CHANGED
data/rbi/rbi.rbi
CHANGED
@@ -20,10 +20,11 @@ class RBI::Arg < ::RBI::Node
|
|
20
20
|
def value; end
|
21
21
|
end
|
22
22
|
|
23
|
-
# @abstract
|
24
23
|
class RBI::Attr < ::RBI::NodeWithComments
|
25
24
|
include ::RBI::Indexable
|
26
25
|
|
26
|
+
abstract!
|
27
|
+
|
27
28
|
sig do
|
28
29
|
params(
|
29
30
|
name: ::Symbol,
|
@@ -39,11 +40,9 @@ class RBI::Attr < ::RBI::NodeWithComments
|
|
39
40
|
sig { override.params(other: ::RBI::Node).returns(T::Boolean) }
|
40
41
|
def compatible_with?(other); end
|
41
42
|
|
42
|
-
# @abstract
|
43
43
|
sig { abstract.returns(T::Array[::RBI::Method]) }
|
44
44
|
def convert_to_methods; end
|
45
45
|
|
46
|
-
# @abstract
|
47
46
|
sig { abstract.returns(T::Array[::String]) }
|
48
47
|
def fully_qualified_names; end
|
49
48
|
|
@@ -62,7 +61,6 @@ class RBI::Attr < ::RBI::NodeWithComments
|
|
62
61
|
sig { returns(::RBI::Visibility) }
|
63
62
|
def visibility; end
|
64
63
|
|
65
|
-
# @return [Visibility]
|
66
64
|
def visibility=(_arg0); end
|
67
65
|
|
68
66
|
private
|
@@ -90,7 +88,6 @@ class RBI::Attr < ::RBI::NodeWithComments
|
|
90
88
|
end
|
91
89
|
def create_setter_method(name, sig, attribute_type, visibility, loc, comments); end
|
92
90
|
|
93
|
-
# @raise [UnexpectedMultipleSigsError]
|
94
91
|
sig(:final) { returns([T.nilable(::RBI::Sig), T.nilable(T.any(::RBI::Type, ::String))]) }
|
95
92
|
def parse_sig; end
|
96
93
|
end
|
@@ -176,7 +173,6 @@ class RBI::AttrWriter < ::RBI::Attr
|
|
176
173
|
def to_s; end
|
177
174
|
end
|
178
175
|
|
179
|
-
# An arbitrary blank line that can be added both in trees and comments
|
180
176
|
class RBI::BlankLine < ::RBI::Comment
|
181
177
|
sig { params(loc: T.nilable(::RBI::Loc)).void }
|
182
178
|
def initialize(loc: T.unsafe(nil)); end
|
@@ -221,13 +217,11 @@ class RBI::Class < ::RBI::Scope
|
|
221
217
|
sig { returns(::String) }
|
222
218
|
def name; end
|
223
219
|
|
224
|
-
# @return [String]
|
225
220
|
def name=(_arg0); end
|
226
221
|
|
227
222
|
sig { returns(T.nilable(::String)) }
|
228
223
|
def superclass_name; end
|
229
224
|
|
230
|
-
# @return [String, nil]
|
231
225
|
def superclass_name=(_arg0); end
|
232
226
|
end
|
233
227
|
|
@@ -241,24 +235,9 @@ class RBI::Comment < ::RBI::Node
|
|
241
235
|
sig { returns(::String) }
|
242
236
|
def text; end
|
243
237
|
|
244
|
-
# @return [String]
|
245
238
|
def text=(_arg0); end
|
246
239
|
end
|
247
240
|
|
248
|
-
# A tree showing incompatibles nodes
|
249
|
-
#
|
250
|
-
# Is rendered as a merge conflict between `left` and` right`:
|
251
|
-
# ~~~rb
|
252
|
-
# class Foo
|
253
|
-
# <<<<<<< left
|
254
|
-
# def m1; end
|
255
|
-
# def m2(a); end
|
256
|
-
# =======
|
257
|
-
# def m1(a); end
|
258
|
-
# def m2; end
|
259
|
-
# >>>>>>> right
|
260
|
-
# end
|
261
|
-
# ~~~
|
262
241
|
class RBI::ConflictTree < ::RBI::Tree
|
263
242
|
sig { params(left_name: ::String, right_name: ::String).void }
|
264
243
|
def initialize(left_name: T.unsafe(nil), right_name: T.unsafe(nil)); end
|
@@ -269,14 +248,10 @@ class RBI::ConflictTree < ::RBI::Tree
|
|
269
248
|
sig { returns(::String) }
|
270
249
|
def left_name; end
|
271
250
|
|
272
|
-
# @return [Tree]
|
273
251
|
def right; end
|
274
|
-
|
275
|
-
# @return [String]
|
276
252
|
def right_name; end
|
277
253
|
end
|
278
254
|
|
279
|
-
# Consts
|
280
255
|
class RBI::Const < ::RBI::NodeWithComments
|
281
256
|
include ::RBI::Indexable
|
282
257
|
|
@@ -306,7 +281,6 @@ class RBI::Const < ::RBI::NodeWithComments
|
|
306
281
|
sig { override.returns(::String) }
|
307
282
|
def to_s; end
|
308
283
|
|
309
|
-
# @return [String]
|
310
284
|
def value; end
|
311
285
|
end
|
312
286
|
|
@@ -353,7 +327,6 @@ class RBI::File
|
|
353
327
|
sig { returns(T::Array[::RBI::Comment]) }
|
354
328
|
def comments; end
|
355
329
|
|
356
|
-
# @return [Array<Comment>]
|
357
330
|
def comments=(_arg0); end
|
358
331
|
|
359
332
|
sig { returns(T::Boolean) }
|
@@ -378,13 +351,11 @@ class RBI::File
|
|
378
351
|
sig { returns(::RBI::Tree) }
|
379
352
|
def root; end
|
380
353
|
|
381
|
-
# @return [Tree]
|
382
354
|
def root=(_arg0); end
|
383
355
|
|
384
356
|
sig { returns(T.nilable(::String)) }
|
385
357
|
def strictness; end
|
386
358
|
|
387
|
-
# @return [String, nil]
|
388
359
|
def strictness=(_arg0); end
|
389
360
|
|
390
361
|
sig { params(indent: ::Integer, print_locs: T::Boolean, max_line_length: T.nilable(::Integer)).returns(::String) }
|
@@ -414,7 +385,6 @@ class RBI::Formatter
|
|
414
385
|
sig { returns(T.nilable(::Integer)) }
|
415
386
|
def max_line_length; end
|
416
387
|
|
417
|
-
# @return [Integer, nil]
|
418
388
|
def max_line_length=(_arg0); end
|
419
389
|
|
420
390
|
sig { params(file: ::RBI::File).returns(::String) }
|
@@ -437,48 +407,21 @@ class RBI::Group::Kind
|
|
437
407
|
end
|
438
408
|
end
|
439
409
|
|
440
|
-
# : Kind
|
441
410
|
RBI::Group::Kind::Attrs = T.let(T.unsafe(nil), RBI::Group::Kind)
|
442
|
-
|
443
|
-
# : Kind
|
444
411
|
RBI::Group::Kind::Consts = T.let(T.unsafe(nil), RBI::Group::Kind)
|
445
|
-
|
446
|
-
# : Kind
|
447
412
|
RBI::Group::Kind::Helpers = T.let(T.unsafe(nil), RBI::Group::Kind)
|
448
|
-
|
449
|
-
# : Kind
|
450
413
|
RBI::Group::Kind::Inits = T.let(T.unsafe(nil), RBI::Group::Kind)
|
451
|
-
|
452
|
-
# : Kind
|
453
414
|
RBI::Group::Kind::Methods = T.let(T.unsafe(nil), RBI::Group::Kind)
|
454
|
-
|
455
|
-
# : Kind
|
456
415
|
RBI::Group::Kind::MixesInClassMethods = T.let(T.unsafe(nil), RBI::Group::Kind)
|
457
|
-
|
458
|
-
# : Kind
|
459
416
|
RBI::Group::Kind::Mixins = T.let(T.unsafe(nil), RBI::Group::Kind)
|
460
|
-
|
461
|
-
# : Kind
|
462
417
|
RBI::Group::Kind::RequiredAncestors = T.let(T.unsafe(nil), RBI::Group::Kind)
|
463
|
-
|
464
|
-
# : Kind
|
465
418
|
RBI::Group::Kind::Sends = T.let(T.unsafe(nil), RBI::Group::Kind)
|
466
|
-
|
467
|
-
# : Kind
|
468
419
|
RBI::Group::Kind::SingletonClasses = T.let(T.unsafe(nil), RBI::Group::Kind)
|
469
|
-
|
470
|
-
# : Kind
|
471
420
|
RBI::Group::Kind::TEnums = T.let(T.unsafe(nil), RBI::Group::Kind)
|
472
|
-
|
473
|
-
# : Kind
|
474
421
|
RBI::Group::Kind::TStructFields = T.let(T.unsafe(nil), RBI::Group::Kind)
|
475
|
-
|
476
|
-
# : Kind
|
477
422
|
RBI::Group::Kind::TypeMembers = T.let(T.unsafe(nil), RBI::Group::Kind)
|
478
|
-
|
479
423
|
class RBI::GroupNodesError < ::RBI::Error; end
|
480
424
|
|
481
|
-
# Sorbet's misc.
|
482
425
|
class RBI::Helper < ::RBI::NodeWithComments
|
483
426
|
include ::RBI::Indexable
|
484
427
|
|
@@ -556,14 +499,9 @@ class RBI::Index < ::RBI::Visitor
|
|
556
499
|
end
|
557
500
|
end
|
558
501
|
|
559
|
-
# A Node that can be referred to by a unique ID inside an index
|
560
502
|
module RBI::Indexable
|
561
|
-
|
562
|
-
|
563
|
-
# Some nodes can have multiple ids, for example an attribute accessor matches the ID of the
|
564
|
-
# getter and the setter.
|
565
|
-
#
|
566
|
-
# @abstract
|
503
|
+
interface!
|
504
|
+
|
567
505
|
sig { abstract.returns(T::Array[::String]) }
|
568
506
|
def index_ids; end
|
569
507
|
end
|
@@ -652,16 +590,12 @@ class RBI::Loc
|
|
652
590
|
end
|
653
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
|
654
592
|
|
655
|
-
# @return [Integer, nil]
|
656
593
|
def begin_column; end
|
657
594
|
|
658
595
|
sig { returns(T.nilable(::Integer)) }
|
659
596
|
def begin_line; end
|
660
597
|
|
661
|
-
# @return [Integer, nil]
|
662
598
|
def end_column; end
|
663
|
-
|
664
|
-
# @return [Integer, nil]
|
665
599
|
def end_line; end
|
666
600
|
|
667
601
|
sig { returns(T.nilable(::String)) }
|
@@ -682,7 +616,6 @@ class RBI::Loc
|
|
682
616
|
end
|
683
617
|
end
|
684
618
|
|
685
|
-
# A tree that _might_ contain conflicts
|
686
619
|
class RBI::MergeTree < ::RBI::Tree
|
687
620
|
sig do
|
688
621
|
params(
|
@@ -698,7 +631,6 @@ class RBI::MergeTree < ::RBI::Tree
|
|
698
631
|
def conflicts; end
|
699
632
|
end
|
700
633
|
|
701
|
-
# Methods and args
|
702
634
|
class RBI::Method < ::RBI::NodeWithComments
|
703
635
|
include ::RBI::Indexable
|
704
636
|
|
@@ -767,7 +699,6 @@ class RBI::Method < ::RBI::NodeWithComments
|
|
767
699
|
sig { returns(T::Boolean) }
|
768
700
|
def is_singleton; end
|
769
701
|
|
770
|
-
# @return [Boolean]
|
771
702
|
def is_singleton=(_arg0); end
|
772
703
|
|
773
704
|
sig { override.params(other: ::RBI::Node).void }
|
@@ -776,7 +707,6 @@ class RBI::Method < ::RBI::NodeWithComments
|
|
776
707
|
sig { returns(::String) }
|
777
708
|
def name; end
|
778
709
|
|
779
|
-
# @return [String]
|
780
710
|
def name=(_arg0); end
|
781
711
|
|
782
712
|
sig { returns(T::Array[::RBI::Param]) }
|
@@ -785,7 +715,6 @@ class RBI::Method < ::RBI::NodeWithComments
|
|
785
715
|
sig { returns(T::Array[::RBI::Sig]) }
|
786
716
|
def sigs; end
|
787
717
|
|
788
|
-
# @return [Array<Sig>]
|
789
718
|
def sigs=(_arg0); end
|
790
719
|
|
791
720
|
sig { override.returns(::String) }
|
@@ -794,7 +723,6 @@ class RBI::Method < ::RBI::NodeWithComments
|
|
794
723
|
sig { returns(::RBI::Visibility) }
|
795
724
|
def visibility; end
|
796
725
|
|
797
|
-
# @return [Visibility]
|
798
726
|
def visibility=(_arg0); end
|
799
727
|
end
|
800
728
|
|
@@ -822,8 +750,9 @@ class RBI::MixesInClassMethods < ::RBI::Mixin
|
|
822
750
|
def to_s; end
|
823
751
|
end
|
824
752
|
|
825
|
-
# @abstract
|
826
753
|
class RBI::Mixin < ::RBI::NodeWithComments
|
754
|
+
abstract!
|
755
|
+
|
827
756
|
sig do
|
828
757
|
params(
|
829
758
|
name: ::String,
|
@@ -861,16 +790,15 @@ class RBI::Module < ::RBI::Scope
|
|
861
790
|
sig { returns(::String) }
|
862
791
|
def name; end
|
863
792
|
|
864
|
-
# @return [String]
|
865
793
|
def name=(_arg0); end
|
866
794
|
end
|
867
795
|
|
868
|
-
# @abstract
|
869
796
|
class RBI::Node
|
797
|
+
abstract!
|
798
|
+
|
870
799
|
sig { params(loc: T.nilable(::RBI::Loc)).void }
|
871
800
|
def initialize(loc: T.unsafe(nil)); end
|
872
801
|
|
873
|
-
# Can `self` and `_other` be merged into a single definition?
|
874
802
|
sig { params(_other: ::RBI::Node).returns(T::Boolean) }
|
875
803
|
def compatible_with?(_other); end
|
876
804
|
|
@@ -880,10 +808,8 @@ class RBI::Node
|
|
880
808
|
sig { returns(T.nilable(::RBI::Loc)) }
|
881
809
|
def loc; end
|
882
810
|
|
883
|
-
# @return [Loc, nil]
|
884
811
|
def loc=(_arg0); end
|
885
812
|
|
886
|
-
# Merge `self` and `other` into a single definition
|
887
813
|
sig { params(other: ::RBI::Node).void }
|
888
814
|
def merge_with(other); end
|
889
815
|
|
@@ -896,7 +822,6 @@ class RBI::Node
|
|
896
822
|
sig { returns(T.nilable(::RBI::Tree)) }
|
897
823
|
def parent_tree; end
|
898
824
|
|
899
|
-
# @return [Tree, nil]
|
900
825
|
def parent_tree=(_arg0); end
|
901
826
|
|
902
827
|
sig do
|
@@ -922,7 +847,6 @@ class RBI::Node
|
|
922
847
|
sig { params(indent: ::Integer, print_locs: T::Boolean, positional_names: T::Boolean).returns(::String) }
|
923
848
|
def rbs_string(indent: T.unsafe(nil), print_locs: T.unsafe(nil), positional_names: T.unsafe(nil)); end
|
924
849
|
|
925
|
-
# @raise [ReplaceNodeError]
|
926
850
|
sig { params(node: ::RBI::Node).void }
|
927
851
|
def replace(node); end
|
928
852
|
|
@@ -933,8 +857,9 @@ class RBI::Node
|
|
933
857
|
def string(indent: T.unsafe(nil), print_locs: T.unsafe(nil), max_line_length: T.unsafe(nil)); end
|
934
858
|
end
|
935
859
|
|
936
|
-
# @abstract
|
937
860
|
class RBI::NodeWithComments < ::RBI::Node
|
861
|
+
abstract!
|
862
|
+
|
938
863
|
sig { params(loc: T.nilable(::RBI::Loc), comments: T::Array[::RBI::Comment]).void }
|
939
864
|
def initialize(loc: T.unsafe(nil), comments: T.unsafe(nil)); end
|
940
865
|
|
@@ -944,7 +869,6 @@ class RBI::NodeWithComments < ::RBI::Node
|
|
944
869
|
sig { returns(T::Array[::RBI::Comment]) }
|
945
870
|
def comments; end
|
946
871
|
|
947
|
-
# @return [Array<Comment>]
|
948
872
|
def comments=(_arg0); end
|
949
873
|
|
950
874
|
sig { override.params(other: ::RBI::Node).void }
|
@@ -973,8 +897,9 @@ class RBI::OptParam < ::RBI::Param
|
|
973
897
|
def value; end
|
974
898
|
end
|
975
899
|
|
976
|
-
# @abstract
|
977
900
|
class RBI::Param < ::RBI::NodeWithComments
|
901
|
+
abstract!
|
902
|
+
|
978
903
|
sig { params(name: ::String, loc: T.nilable(::RBI::Loc), comments: T::Array[::RBI::Comment]).void }
|
979
904
|
def initialize(name, loc: T.unsafe(nil), comments: T.unsafe(nil)); end
|
980
905
|
|
@@ -1092,11 +1017,9 @@ class RBI::Parser::TreeBuilder < ::RBI::Parser::Visitor
|
|
1092
1017
|
|
1093
1018
|
private
|
1094
1019
|
|
1095
|
-
# Collect all the remaining comments within a node
|
1096
1020
|
sig { params(node: ::Prism::Node).void }
|
1097
1021
|
def collect_dangling_comments(node); end
|
1098
1022
|
|
1099
|
-
# Collect all the remaining comments after visiting the tree
|
1100
1023
|
sig { void }
|
1101
1024
|
def collect_orphan_comments; end
|
1102
1025
|
|
@@ -1192,13 +1115,9 @@ class RBI::Printer < ::RBI::Visitor
|
|
1192
1115
|
sig { void }
|
1193
1116
|
def dedent; end
|
1194
1117
|
|
1195
|
-
# @return [Boolean]
|
1196
1118
|
def in_visibility_group; end
|
1197
|
-
|
1198
|
-
# @return [Boolean]
|
1199
1119
|
def in_visibility_group=(_arg0); end
|
1200
1120
|
|
1201
|
-
# Printing
|
1202
1121
|
sig { void }
|
1203
1122
|
def indent; end
|
1204
1123
|
|
@@ -1208,25 +1127,20 @@ class RBI::Printer < ::RBI::Visitor
|
|
1208
1127
|
sig { returns(T.nilable(::RBI::Node)) }
|
1209
1128
|
def previous_node; end
|
1210
1129
|
|
1211
|
-
# Print a string without indentation nor `\n` at the end.
|
1212
1130
|
sig { params(string: ::String).void }
|
1213
1131
|
def print(string); end
|
1214
1132
|
|
1215
1133
|
sig { returns(T::Boolean) }
|
1216
1134
|
def print_locs; end
|
1217
1135
|
|
1218
|
-
# @return [Boolean]
|
1219
1136
|
def print_locs=(_arg0); end
|
1220
1137
|
|
1221
|
-
# Print a string with indentation and `\n` at the end.
|
1222
1138
|
sig { params(string: ::String).void }
|
1223
1139
|
def printl(string); end
|
1224
1140
|
|
1225
|
-
# Print a string without indentation but with a `\n` at the end.
|
1226
1141
|
sig { params(string: T.nilable(::String)).void }
|
1227
1142
|
def printn(string = T.unsafe(nil)); end
|
1228
1143
|
|
1229
|
-
# Print a string with indentation but without a `\n` at the end.
|
1230
1144
|
sig { params(string: T.nilable(::String)).void }
|
1231
1145
|
def printt(string = T.unsafe(nil)); end
|
1232
1146
|
|
@@ -1471,7 +1385,6 @@ class RBI::RBS::MethodTypeTranslator
|
|
1471
1385
|
sig { params(type: T.untyped).returns(::RBI::Type) }
|
1472
1386
|
def translate_type(type); end
|
1473
1387
|
|
1474
|
-
# @raise [Error]
|
1475
1388
|
sig { params(type: ::RBS::Types::Block).void }
|
1476
1389
|
def visit_block_type(type); end
|
1477
1390
|
|
@@ -1508,7 +1421,6 @@ class RBI::RBS::TypeTranslator
|
|
1508
1421
|
end
|
1509
1422
|
end
|
1510
1423
|
|
1511
|
-
# A comment representing a RBS type prefixed with `#:`
|
1512
1424
|
class RBI::RBSComment < ::RBI::Comment
|
1513
1425
|
sig { params(other: ::Object).returns(T::Boolean) }
|
1514
1426
|
def ==(other); end
|
@@ -1532,13 +1444,9 @@ class RBI::RBSPrinter < ::RBI::Visitor
|
|
1532
1444
|
sig { void }
|
1533
1445
|
def dedent; end
|
1534
1446
|
|
1535
|
-
# @return [Boolean]
|
1536
1447
|
def in_visibility_group; end
|
1537
|
-
|
1538
|
-
# @return [Boolean]
|
1539
1448
|
def in_visibility_group=(_arg0); end
|
1540
1449
|
|
1541
|
-
# Printing
|
1542
1450
|
sig { void }
|
1543
1451
|
def indent; end
|
1544
1452
|
|
@@ -1548,13 +1456,11 @@ class RBI::RBSPrinter < ::RBI::Visitor
|
|
1548
1456
|
sig { returns(T::Boolean) }
|
1549
1457
|
def positional_names; end
|
1550
1458
|
|
1551
|
-
# @return [Boolean]
|
1552
1459
|
def positional_names=(_arg0); end
|
1553
1460
|
|
1554
1461
|
sig { returns(T.nilable(::RBI::Node)) }
|
1555
1462
|
def previous_node; end
|
1556
1463
|
|
1557
|
-
# Print a string without indentation nor `\n` at the end.
|
1558
1464
|
sig { params(string: ::String).void }
|
1559
1465
|
def print(string); end
|
1560
1466
|
|
@@ -1564,7 +1470,6 @@ class RBI::RBSPrinter < ::RBI::Visitor
|
|
1564
1470
|
sig { returns(T::Boolean) }
|
1565
1471
|
def print_locs; end
|
1566
1472
|
|
1567
|
-
# @return [Boolean]
|
1568
1473
|
def print_locs=(_arg0); end
|
1569
1474
|
|
1570
1475
|
sig { params(node: ::RBI::Method, sig: ::RBI::Sig).void }
|
@@ -1576,15 +1481,12 @@ class RBI::RBSPrinter < ::RBI::Visitor
|
|
1576
1481
|
sig { params(node: ::RBI::Method, sig: ::RBI::Sig).void }
|
1577
1482
|
def print_method_sig_multiline(node, sig); end
|
1578
1483
|
|
1579
|
-
# Print a string with indentation and `\n` at the end.
|
1580
1484
|
sig { params(string: ::String).void }
|
1581
1485
|
def printl(string); end
|
1582
1486
|
|
1583
|
-
# Print a string without indentation but with a `\n` at the end.
|
1584
1487
|
sig { params(string: T.nilable(::String)).void }
|
1585
1488
|
def printn(string = T.unsafe(nil)); end
|
1586
1489
|
|
1587
|
-
# Print a string with indentation but without a `\n` at the end.
|
1588
1490
|
sig { params(string: T.nilable(::String)).void }
|
1589
1491
|
def printt(string = T.unsafe(nil)); end
|
1590
1492
|
|
@@ -1746,9 +1648,6 @@ class RBI::RBSPrinter < ::RBI::Visitor
|
|
1746
1648
|
sig { params(node: ::RBI::Node).returns(T::Boolean) }
|
1747
1649
|
def oneline?(node); end
|
1748
1650
|
|
1749
|
-
# Parse a string containing a `T.let(x, X)` and extract the type
|
1750
|
-
#
|
1751
|
-
# Returns `nil` is the string is not a `T.let`.
|
1752
1651
|
sig { params(code: T.nilable(::String)).returns(T.nilable(::String)) }
|
1753
1652
|
def parse_t_let(code); end
|
1754
1653
|
|
@@ -1866,7 +1765,6 @@ class RBI::Rewriters::AttrToMethods < ::RBI::Visitor
|
|
1866
1765
|
|
1867
1766
|
private
|
1868
1767
|
|
1869
|
-
# @raise [ReplaceNodeError]
|
1870
1768
|
sig { params(node: ::RBI::Node, with: T::Array[::RBI::Node]).void }
|
1871
1769
|
def replace(node, with:); end
|
1872
1770
|
end
|
@@ -1884,57 +1782,6 @@ class RBI::Rewriters::Deannotate < ::RBI::Visitor
|
|
1884
1782
|
def deannotate_node(node); end
|
1885
1783
|
end
|
1886
1784
|
|
1887
|
-
# Take a gem version and filter out all RBI that is not relevant to that version based on @version annotations
|
1888
|
-
# in comments. As an example:
|
1889
|
-
#
|
1890
|
-
# ~~~rb
|
1891
|
-
# tree = Parser.parse_string(<<~RBI)
|
1892
|
-
# class Foo
|
1893
|
-
# # @version > 0.3.0
|
1894
|
-
# def bar
|
1895
|
-
# end
|
1896
|
-
#
|
1897
|
-
# # @version <= 0.3.0
|
1898
|
-
# def bar(arg1)
|
1899
|
-
# end
|
1900
|
-
# end
|
1901
|
-
# RBI
|
1902
|
-
#
|
1903
|
-
# Rewriters::FilterVersions.filter(tree, Gem::Version.new("0.3.1"))
|
1904
|
-
#
|
1905
|
-
# assert_equal(<<~RBI, tree.string)
|
1906
|
-
# class Foo
|
1907
|
-
# # @version > 0.3.0
|
1908
|
-
# def bar
|
1909
|
-
# end
|
1910
|
-
# end
|
1911
|
-
# RBI
|
1912
|
-
# ~~~
|
1913
|
-
#
|
1914
|
-
# Supported operators:
|
1915
|
-
# - equals `=`
|
1916
|
-
# - not equals `!=`
|
1917
|
-
# - greater than `>`
|
1918
|
-
# - greater than or equal to `>=`
|
1919
|
-
# - less than `<`
|
1920
|
-
# - less than or equal to `<=`
|
1921
|
-
# - pessimistic or twiddle-wakka`~>`
|
1922
|
-
#
|
1923
|
-
# And/or logic:
|
1924
|
-
# - "And" logic: put multiple versions on the same line
|
1925
|
-
# - e.g. `@version > 0.3.0, <1.0.0` means version must be greater than 0.3.0 AND less than 1.0.0
|
1926
|
-
# - "Or" logic: put multiple versions on subsequent lines
|
1927
|
-
# - e.g. the following means version must be less than 0.3.0 OR greater than 1.0.0
|
1928
|
-
# ```
|
1929
|
-
# # @version < 0.3.0
|
1930
|
-
# # @version > 1.0.0
|
1931
|
-
# ```
|
1932
|
-
# Prerelease versions:
|
1933
|
-
# - Prerelease versions are considered less than their non-prerelease counterparts
|
1934
|
-
# - e.g. `0.4.0-prerelease` is less than `0.4.0`
|
1935
|
-
#
|
1936
|
-
# RBI with no versions:
|
1937
|
-
# - RBI with no version annotations are automatically counted towards ALL versions
|
1938
1785
|
class RBI::Rewriters::FilterVersions < ::RBI::Visitor
|
1939
1786
|
sig { params(version: ::Gem::Version).void }
|
1940
1787
|
def initialize(version); end
|
@@ -1950,56 +1797,11 @@ end
|
|
1950
1797
|
|
1951
1798
|
RBI::Rewriters::FilterVersions::VERSION_PREFIX = T.let(T.unsafe(nil), String)
|
1952
1799
|
|
1953
|
-
# Rewrite non-singleton methods inside singleton classes to singleton methods
|
1954
|
-
#
|
1955
|
-
# Example:
|
1956
|
-
# ~~~rb
|
1957
|
-
# class << self
|
1958
|
-
# def m1; end
|
1959
|
-
# def self.m2; end
|
1960
|
-
#
|
1961
|
-
# class << self
|
1962
|
-
# def m3; end
|
1963
|
-
# end
|
1964
|
-
# end
|
1965
|
-
# ~~~
|
1966
|
-
#
|
1967
|
-
# will be rewritten to:
|
1968
|
-
#
|
1969
|
-
# ~~~rb
|
1970
|
-
# def self.m1; end
|
1971
|
-
#
|
1972
|
-
# class << self
|
1973
|
-
# def self.m2; end
|
1974
|
-
# def self.m3; end
|
1975
|
-
# end
|
1976
|
-
# ~~~
|
1977
1800
|
class RBI::Rewriters::FlattenSingletonMethods < ::RBI::Visitor
|
1978
1801
|
sig { override.params(node: T.nilable(::RBI::Node)).void }
|
1979
1802
|
def visit(node); end
|
1980
1803
|
end
|
1981
1804
|
|
1982
|
-
# Flattens visibility nodes into method nodes
|
1983
|
-
#
|
1984
|
-
# Example:
|
1985
|
-
# ~~~rb
|
1986
|
-
# class A
|
1987
|
-
# def m1; end
|
1988
|
-
# private
|
1989
|
-
# def m2; end
|
1990
|
-
# def m3; end
|
1991
|
-
# end
|
1992
|
-
# ~~~
|
1993
|
-
#
|
1994
|
-
# will be transformed into:
|
1995
|
-
#
|
1996
|
-
# ~~~rb
|
1997
|
-
# class A
|
1998
|
-
# def m1; end
|
1999
|
-
# private def m2; end
|
2000
|
-
# private def m3; end
|
2001
|
-
# end
|
2002
|
-
# ~~~
|
2003
1805
|
class RBI::Rewriters::FlattenVisibilities < ::RBI::Visitor
|
2004
1806
|
sig { void }
|
2005
1807
|
def initialize; end
|
@@ -2018,39 +1820,6 @@ class RBI::Rewriters::GroupNodes < ::RBI::Visitor
|
|
2018
1820
|
def group_kind(node); end
|
2019
1821
|
end
|
2020
1822
|
|
2021
|
-
# Merge two RBI trees together
|
2022
|
-
#
|
2023
|
-
# Be this `Tree`:
|
2024
|
-
# ~~~rb
|
2025
|
-
# class Foo
|
2026
|
-
# attr_accessor :a
|
2027
|
-
# def m; end
|
2028
|
-
# C = 10
|
2029
|
-
# end
|
2030
|
-
# ~~~
|
2031
|
-
#
|
2032
|
-
# Merged with this one:
|
2033
|
-
# ~~~rb
|
2034
|
-
# class Foo
|
2035
|
-
# attr_reader :a
|
2036
|
-
# def m(x); end
|
2037
|
-
# C = 10
|
2038
|
-
# end
|
2039
|
-
# ~~~
|
2040
|
-
#
|
2041
|
-
# Compatible definitions are merged together while incompatible definitions are moved into a `ConflictTree`:
|
2042
|
-
# ~~~rb
|
2043
|
-
# class Foo
|
2044
|
-
# <<<<<<< left
|
2045
|
-
# attr_accessor :a
|
2046
|
-
# def m; end
|
2047
|
-
# =======
|
2048
|
-
# attr_reader :a
|
2049
|
-
# def m(x); end
|
2050
|
-
# >>>>>>> right
|
2051
|
-
# C = 10
|
2052
|
-
# end
|
2053
|
-
# ~~~
|
2054
1823
|
class RBI::Rewriters::Merge
|
2055
1824
|
sig { params(left_name: ::String, right_name: ::String, keep: ::RBI::Rewriters::Merge::Keep).void }
|
2056
1825
|
def initialize(left_name: T.unsafe(nil), right_name: T.unsafe(nil), keep: T.unsafe(nil)); end
|
@@ -2075,7 +1844,6 @@ class RBI::Rewriters::Merge
|
|
2075
1844
|
end
|
2076
1845
|
end
|
2077
1846
|
|
2078
|
-
# Used for logging / error displaying purpose
|
2079
1847
|
class RBI::Rewriters::Merge::Conflict
|
2080
1848
|
sig { params(left: ::RBI::Node, right: ::RBI::Node, left_name: ::String, right_name: ::String).void }
|
2081
1849
|
def initialize(left:, right:, left_name:, right_name:); end
|
@@ -2086,46 +1854,13 @@ class RBI::Rewriters::Merge::Conflict
|
|
2086
1854
|
sig { returns(::String) }
|
2087
1855
|
def left_name; end
|
2088
1856
|
|
2089
|
-
# @return [Node]
|
2090
1857
|
def right; end
|
2091
|
-
|
2092
|
-
# @return [String]
|
2093
1858
|
def right_name; end
|
2094
1859
|
|
2095
1860
|
sig { returns(::String) }
|
2096
1861
|
def to_s; end
|
2097
1862
|
end
|
2098
1863
|
|
2099
|
-
# Merge adjacent conflict trees
|
2100
|
-
#
|
2101
|
-
# Transform this:
|
2102
|
-
# ~~~rb
|
2103
|
-
# class Foo
|
2104
|
-
# <<<<<<< left
|
2105
|
-
# def m1; end
|
2106
|
-
# =======
|
2107
|
-
# def m1(a); end
|
2108
|
-
# >>>>>>> right
|
2109
|
-
# <<<<<<< left
|
2110
|
-
# def m2(a); end
|
2111
|
-
# =======
|
2112
|
-
# def m2; end
|
2113
|
-
# >>>>>>> right
|
2114
|
-
# end
|
2115
|
-
# ~~~
|
2116
|
-
#
|
2117
|
-
# Into this:
|
2118
|
-
# ~~~rb
|
2119
|
-
# class Foo
|
2120
|
-
# <<<<<<< left
|
2121
|
-
# def m1; end
|
2122
|
-
# def m2(a); end
|
2123
|
-
# =======
|
2124
|
-
# def m1(a); end
|
2125
|
-
# def m2; end
|
2126
|
-
# >>>>>>> right
|
2127
|
-
# end
|
2128
|
-
# ~~~
|
2129
1864
|
class RBI::Rewriters::Merge::ConflictTreeMerger < ::RBI::Visitor
|
2130
1865
|
sig { override.params(node: T.nilable(::RBI::Node)).void }
|
2131
1866
|
def visit(node); end
|
@@ -2147,13 +1882,8 @@ class RBI::Rewriters::Merge::Keep
|
|
2147
1882
|
end
|
2148
1883
|
end
|
2149
1884
|
|
2150
|
-
# : Keep
|
2151
1885
|
RBI::Rewriters::Merge::Keep::LEFT = T.let(T.unsafe(nil), RBI::Rewriters::Merge::Keep)
|
2152
|
-
|
2153
|
-
# : Keep
|
2154
1886
|
RBI::Rewriters::Merge::Keep::NONE = T.let(T.unsafe(nil), RBI::Rewriters::Merge::Keep)
|
2155
|
-
|
2156
|
-
# : Keep
|
2157
1887
|
RBI::Rewriters::Merge::Keep::RIGHT = T.let(T.unsafe(nil), RBI::Rewriters::Merge::Keep)
|
2158
1888
|
|
2159
1889
|
class RBI::Rewriters::Merge::TreeMerger < ::RBI::Visitor
|
@@ -2201,22 +1931,6 @@ class RBI::Rewriters::NestSingletonMethods < ::RBI::Visitor
|
|
2201
1931
|
def visit(node); end
|
2202
1932
|
end
|
2203
1933
|
|
2204
|
-
# This rewriter moves top-level members into a top-level Object class
|
2205
|
-
#
|
2206
|
-
# Example:
|
2207
|
-
# ~~~rb
|
2208
|
-
# def foo; end
|
2209
|
-
# attr_reader :bar
|
2210
|
-
# ~~~
|
2211
|
-
#
|
2212
|
-
# will be rewritten to:
|
2213
|
-
#
|
2214
|
-
# ~~~rb
|
2215
|
-
# class Object
|
2216
|
-
# def foo; end
|
2217
|
-
# attr_reader :bar
|
2218
|
-
# end
|
2219
|
-
# ~~~
|
2220
1934
|
class RBI::Rewriters::NestTopLevelMembers < ::RBI::Visitor
|
2221
1935
|
sig { void }
|
2222
1936
|
def initialize; end
|
@@ -2225,48 +1939,6 @@ class RBI::Rewriters::NestTopLevelMembers < ::RBI::Visitor
|
|
2225
1939
|
def visit(node); end
|
2226
1940
|
end
|
2227
1941
|
|
2228
|
-
# Remove all definitions existing in the index from the current tree
|
2229
|
-
#
|
2230
|
-
# Let's create an `Index` from two different `Tree`s:
|
2231
|
-
# ~~~rb
|
2232
|
-
# tree1 = Parse.parse_string(<<~RBI)
|
2233
|
-
# class Foo
|
2234
|
-
# def foo; end
|
2235
|
-
# end
|
2236
|
-
# RBI
|
2237
|
-
#
|
2238
|
-
# tree2 = Parse.parse_string(<<~RBI)
|
2239
|
-
# FOO = 10
|
2240
|
-
# RBI
|
2241
|
-
#
|
2242
|
-
# index = Index.index(tree1, tree2)
|
2243
|
-
# ~~~
|
2244
|
-
#
|
2245
|
-
# We can use `RemoveKnownDefinitions` to remove the definitions found in the `index` from the `Tree` to clean:
|
2246
|
-
# ~~~rb
|
2247
|
-
# tree_to_clean = Parser.parse_string(<<~RBI)
|
2248
|
-
# class Foo
|
2249
|
-
# def foo; end
|
2250
|
-
# def bar; end
|
2251
|
-
# end
|
2252
|
-
# FOO = 10
|
2253
|
-
# BAR = 42
|
2254
|
-
# RBI
|
2255
|
-
#
|
2256
|
-
# cleaned_tree, operations = RemoveKnownDefinitions.remove(tree_to_clean, index)
|
2257
|
-
#
|
2258
|
-
# assert_equal(<<~RBI, cleaned_tree)
|
2259
|
-
# class Foo
|
2260
|
-
# def bar; end
|
2261
|
-
# end
|
2262
|
-
# BAR = 42
|
2263
|
-
# RBI
|
2264
|
-
#
|
2265
|
-
# assert_equal(<<~OPERATIONS, operations.join("\n"))
|
2266
|
-
# Deleted ::Foo#foo at -:2:2-2-16 (duplicate from -:2:2-2:16)
|
2267
|
-
# Deleted ::FOO at -:5:0-5:8 (duplicate from -:1:0-1:8)
|
2268
|
-
# OPERATIONS
|
2269
|
-
# ~~~
|
2270
1942
|
class RBI::Rewriters::RemoveKnownDefinitions < ::RBI::Visitor
|
2271
1943
|
sig { params(index: ::RBI::Index).void }
|
2272
1944
|
def initialize(index); end
|
@@ -2309,7 +1981,6 @@ class RBI::Rewriters::RemoveKnownDefinitions::Operation
|
|
2309
1981
|
sig { returns(::RBI::Node) }
|
2310
1982
|
def deleted_node; end
|
2311
1983
|
|
2312
|
-
# @return [Node]
|
2313
1984
|
def duplicate_of; end
|
2314
1985
|
|
2315
1986
|
sig { returns(::String) }
|
@@ -2335,7 +2006,6 @@ class RBI::Rewriters::SortNodes < ::RBI::Visitor
|
|
2335
2006
|
def sort_node_names!(node); end
|
2336
2007
|
end
|
2337
2008
|
|
2338
|
-
# Translate all RBS signature comments to Sorbet RBI signatures
|
2339
2009
|
class RBI::Rewriters::TranslateRBSSigs < ::RBI::Visitor
|
2340
2010
|
sig { override.params(node: T.nilable(::RBI::Node)).void }
|
2341
2011
|
def visit(node); end
|
@@ -2354,15 +2024,14 @@ end
|
|
2354
2024
|
|
2355
2025
|
class RBI::Rewriters::TranslateRBSSigs::Error < ::RBI::Error; end
|
2356
2026
|
|
2357
|
-
# @abstract
|
2358
2027
|
class RBI::Scope < ::RBI::Tree
|
2359
2028
|
include ::RBI::Indexable
|
2360
2029
|
|
2361
|
-
|
2030
|
+
abstract!
|
2031
|
+
|
2362
2032
|
sig { returns(T.self_type) }
|
2363
2033
|
def dup_empty; end
|
2364
2034
|
|
2365
|
-
# @abstract
|
2366
2035
|
sig { abstract.returns(::String) }
|
2367
2036
|
def fully_qualified_name; end
|
2368
2037
|
|
@@ -2373,18 +2042,6 @@ class RBI::Scope < ::RBI::Tree
|
|
2373
2042
|
def to_s; end
|
2374
2043
|
end
|
2375
2044
|
|
2376
|
-
# A conflict between two scope headers
|
2377
|
-
#
|
2378
|
-
# Is rendered as a merge conflict between `left` and` right` for scope definitions:
|
2379
|
-
# ~~~rb
|
2380
|
-
# <<<<<<< left
|
2381
|
-
# class Foo
|
2382
|
-
# =======
|
2383
|
-
# module Foo
|
2384
|
-
# >>>>>>> right
|
2385
|
-
# def m1; end
|
2386
|
-
# end
|
2387
|
-
# ~~~
|
2388
2045
|
class RBI::ScopeConflict < ::RBI::Tree
|
2389
2046
|
sig { params(left: ::RBI::Scope, right: ::RBI::Scope, left_name: ::String, right_name: ::String).void }
|
2390
2047
|
def initialize(left:, right:, left_name: T.unsafe(nil), right_name: T.unsafe(nil)); end
|
@@ -2395,14 +2052,10 @@ class RBI::ScopeConflict < ::RBI::Tree
|
|
2395
2052
|
sig { returns(::String) }
|
2396
2053
|
def left_name; end
|
2397
2054
|
|
2398
|
-
# @return [Scope]
|
2399
2055
|
def right; end
|
2400
|
-
|
2401
|
-
# @return [String]
|
2402
2056
|
def right_name; end
|
2403
2057
|
end
|
2404
2058
|
|
2405
|
-
# Sends
|
2406
2059
|
class RBI::Send < ::RBI::NodeWithComments
|
2407
2060
|
include ::RBI::Indexable
|
2408
2061
|
|
@@ -2439,7 +2092,6 @@ class RBI::Send < ::RBI::NodeWithComments
|
|
2439
2092
|
def to_s; end
|
2440
2093
|
end
|
2441
2094
|
|
2442
|
-
# Sorbet's sigs
|
2443
2095
|
class RBI::Sig < ::RBI::NodeWithComments
|
2444
2096
|
sig do
|
2445
2097
|
params(
|
@@ -2469,40 +2121,23 @@ class RBI::Sig < ::RBI::NodeWithComments
|
|
2469
2121
|
sig { params(name: ::String, type: T.any(::RBI::Type, ::String)).void }
|
2470
2122
|
def add_param(name, type); end
|
2471
2123
|
|
2472
|
-
# @return [Boolean]
|
2473
2124
|
def allow_incompatible_override; end
|
2474
|
-
|
2475
|
-
# @return [Boolean]
|
2476
2125
|
def allow_incompatible_override=(_arg0); end
|
2477
2126
|
|
2478
2127
|
sig { returns(T.nilable(::Symbol)) }
|
2479
2128
|
def checked; end
|
2480
2129
|
|
2481
|
-
# @return [Symbol, nil]
|
2482
2130
|
def checked=(_arg0); end
|
2483
2131
|
|
2484
2132
|
sig { returns(T::Boolean) }
|
2485
2133
|
def is_abstract; end
|
2486
2134
|
|
2487
|
-
# @return [Boolean]
|
2488
2135
|
def is_abstract=(_arg0); end
|
2489
|
-
|
2490
|
-
# @return [Boolean]
|
2491
2136
|
def is_final; end
|
2492
|
-
|
2493
|
-
# @return [Boolean]
|
2494
2137
|
def is_final=(_arg0); end
|
2495
|
-
|
2496
|
-
# @return [Boolean]
|
2497
2138
|
def is_overridable; end
|
2498
|
-
|
2499
|
-
# @return [Boolean]
|
2500
2139
|
def is_overridable=(_arg0); end
|
2501
|
-
|
2502
|
-
# @return [Boolean]
|
2503
2140
|
def is_override; end
|
2504
|
-
|
2505
|
-
# @return [Boolean]
|
2506
2141
|
def is_override=(_arg0); end
|
2507
2142
|
|
2508
2143
|
sig { returns(T::Array[::RBI::SigParam]) }
|
@@ -2511,16 +2146,12 @@ class RBI::Sig < ::RBI::NodeWithComments
|
|
2511
2146
|
sig { returns(T.any(::RBI::Type, ::String)) }
|
2512
2147
|
def return_type; end
|
2513
2148
|
|
2514
|
-
# @return [Type, String]
|
2515
2149
|
def return_type=(_arg0); end
|
2516
2150
|
|
2517
2151
|
sig { returns(T::Array[::String]) }
|
2518
2152
|
def type_params; end
|
2519
2153
|
|
2520
|
-
# @return [Boolean]
|
2521
2154
|
def without_runtime; end
|
2522
|
-
|
2523
|
-
# @return [Boolean]
|
2524
2155
|
def without_runtime=(_arg0); end
|
2525
2156
|
end
|
2526
2157
|
|
@@ -2582,23 +2213,19 @@ class RBI::Struct < ::RBI::Scope
|
|
2582
2213
|
sig { returns(T::Boolean) }
|
2583
2214
|
def keyword_init; end
|
2584
2215
|
|
2585
|
-
# @return [Boolean]
|
2586
2216
|
def keyword_init=(_arg0); end
|
2587
2217
|
|
2588
2218
|
sig { returns(T::Array[::Symbol]) }
|
2589
2219
|
def members; end
|
2590
2220
|
|
2591
|
-
# @return [Array<Symbol>]
|
2592
2221
|
def members=(_arg0); end
|
2593
2222
|
|
2594
2223
|
sig { returns(::String) }
|
2595
2224
|
def name; end
|
2596
2225
|
|
2597
|
-
# @return [String]
|
2598
2226
|
def name=(_arg0); end
|
2599
2227
|
end
|
2600
2228
|
|
2601
|
-
# Sorbet's T::Enum
|
2602
2229
|
class RBI::TEnum < ::RBI::Class
|
2603
2230
|
sig do
|
2604
2231
|
params(
|
@@ -2657,7 +2284,6 @@ class RBI::TEnumValue < ::RBI::NodeWithComments
|
|
2657
2284
|
def to_s; end
|
2658
2285
|
end
|
2659
2286
|
|
2660
|
-
# Sorbet's T::Struct
|
2661
2287
|
class RBI::TStruct < ::RBI::Class
|
2662
2288
|
sig do
|
2663
2289
|
params(
|
@@ -2698,8 +2324,9 @@ class RBI::TStructConst < ::RBI::TStructField
|
|
2698
2324
|
def to_s; end
|
2699
2325
|
end
|
2700
2326
|
|
2701
|
-
# @abstract
|
2702
2327
|
class RBI::TStructField < ::RBI::NodeWithComments
|
2328
|
+
abstract!
|
2329
|
+
|
2703
2330
|
sig do
|
2704
2331
|
params(
|
2705
2332
|
name: ::String,
|
@@ -2717,23 +2344,19 @@ class RBI::TStructField < ::RBI::NodeWithComments
|
|
2717
2344
|
sig { returns(T.nilable(::String)) }
|
2718
2345
|
def default; end
|
2719
2346
|
|
2720
|
-
# @return [String, nil]
|
2721
2347
|
def default=(_arg0); end
|
2722
2348
|
|
2723
|
-
# @abstract
|
2724
2349
|
sig { abstract.returns(T::Array[::String]) }
|
2725
2350
|
def fully_qualified_names; end
|
2726
2351
|
|
2727
2352
|
sig { returns(::String) }
|
2728
2353
|
def name; end
|
2729
2354
|
|
2730
|
-
# @return [String]
|
2731
2355
|
def name=(_arg0); end
|
2732
2356
|
|
2733
2357
|
sig { returns(T.any(::RBI::Type, ::String)) }
|
2734
2358
|
def type; end
|
2735
2359
|
|
2736
|
-
# @return [Type, String]
|
2737
2360
|
def type=(_arg0); end
|
2738
2361
|
end
|
2739
2362
|
|
@@ -2897,14 +2520,12 @@ class RBI::Tree < ::RBI::NodeWithComments
|
|
2897
2520
|
def nodes_cache; end
|
2898
2521
|
end
|
2899
2522
|
|
2900
|
-
# The base class for all RBI types.
|
2901
|
-
#
|
2902
|
-
# @abstract
|
2903
2523
|
class RBI::Type
|
2524
|
+
abstract!
|
2525
|
+
|
2904
2526
|
sig { void }
|
2905
2527
|
def initialize; end
|
2906
2528
|
|
2907
|
-
# @abstract
|
2908
2529
|
sig { abstract.params(other: ::BasicObject).returns(T::Boolean) }
|
2909
2530
|
def ==(other); end
|
2910
2531
|
|
@@ -2914,63 +2535,24 @@ class RBI::Type
|
|
2914
2535
|
sig { override.returns(::Integer) }
|
2915
2536
|
def hash; end
|
2916
2537
|
|
2917
|
-
# Returns a new type that is `nilable` if it is not already.
|
2918
|
-
#
|
2919
|
-
# If the type is already nilable, it returns itself.
|
2920
|
-
# ```ruby
|
2921
|
-
# type = RBI::Type.simple("String")
|
2922
|
-
# type.to_rbi # => "String"
|
2923
|
-
# type.nilable.to_rbi # => "T.nilable(String)"
|
2924
|
-
# type.nilable.nilable.to_rbi # => "T.nilable(String)"
|
2925
|
-
# ```
|
2926
2538
|
sig { returns(::RBI::Type) }
|
2927
2539
|
def nilable; end
|
2928
2540
|
|
2929
|
-
# Returns whether the type is nilable.
|
2930
2541
|
sig { returns(T::Boolean) }
|
2931
2542
|
def nilable?; end
|
2932
2543
|
|
2933
|
-
# Returns the non-nilable version of the type.
|
2934
|
-
# If the type is already non-nilable, it returns itself.
|
2935
|
-
# If the type is nilable, it returns the inner type.
|
2936
|
-
#
|
2937
|
-
# ```ruby
|
2938
|
-
# type = RBI::Type.nilable(RBI::Type.simple("String"))
|
2939
|
-
# type.to_rbi # => "T.nilable(String)"
|
2940
|
-
# type.non_nilable.to_rbi # => "String"
|
2941
|
-
# type.non_nilable.non_nilable.to_rbi # => "String"
|
2942
|
-
# ```
|
2943
2544
|
sig { returns(::RBI::Type) }
|
2944
2545
|
def non_nilable; end
|
2945
2546
|
|
2946
|
-
# Returns a normalized version of the type.
|
2947
|
-
#
|
2948
|
-
# Normalized types are meant to be easier to process, not to read.
|
2949
|
-
# For example, `T.any(TrueClass, FalseClass)` instead of `T::Boolean` or
|
2950
|
-
# `T.any(String, NilClass)` instead of `T.nilable(String)`.
|
2951
|
-
#
|
2952
|
-
# This is the inverse of `#simplify`.
|
2953
|
-
#
|
2954
|
-
# @abstract
|
2955
2547
|
sig { abstract.returns(::RBI::Type) }
|
2956
2548
|
def normalize; end
|
2957
2549
|
|
2958
2550
|
sig { returns(::String) }
|
2959
2551
|
def rbs_string; end
|
2960
2552
|
|
2961
|
-
# Returns a simplified version of the type.
|
2962
|
-
#
|
2963
|
-
# Simplified types are meant to be easier to read, not to process.
|
2964
|
-
# For example, `T::Boolean` instead of `T.any(TrueClass, FalseClass)` or
|
2965
|
-
# `T.nilable(String)` instead of `T.any(String, NilClass)`.
|
2966
|
-
#
|
2967
|
-
# This is the inverse of `#normalize`.
|
2968
|
-
#
|
2969
|
-
# @abstract
|
2970
2553
|
sig { abstract.returns(::RBI::Type) }
|
2971
2554
|
def simplify; end
|
2972
2555
|
|
2973
|
-
# @abstract
|
2974
2556
|
sig { abstract.returns(::String) }
|
2975
2557
|
def to_rbi; end
|
2976
2558
|
|
@@ -2978,95 +2560,63 @@ class RBI::Type
|
|
2978
2560
|
def to_s; end
|
2979
2561
|
|
2980
2562
|
class << self
|
2981
|
-
# Builds a type that represents an intersection of multiple types like `T.all(String, Integer)`.
|
2982
|
-
#
|
2983
|
-
# Note that this method transforms types such as `T.all(String, String)` into `String`, so
|
2984
|
-
# it may return something other than a `All`.
|
2985
2563
|
sig { params(type1: ::RBI::Type, type2: ::RBI::Type, types: ::RBI::Type).returns(::RBI::Type) }
|
2986
2564
|
def all(type1, type2, *types); end
|
2987
2565
|
|
2988
|
-
# Builds a type that represents a union of multiple types like `T.any(String, Integer)`.
|
2989
|
-
#
|
2990
|
-
# Note that this method transforms types such as `T.any(String, NilClass)` into `T.nilable(String)`, so
|
2991
|
-
# it may return something other than a `Any`.
|
2992
2566
|
sig { params(type1: ::RBI::Type, type2: ::RBI::Type, types: ::RBI::Type).returns(::RBI::Type) }
|
2993
2567
|
def any(type1, type2, *types); end
|
2994
2568
|
|
2995
|
-
# Builds a type that represents `T.anything`.
|
2996
2569
|
sig { returns(::RBI::Type::Anything) }
|
2997
2570
|
def anything; end
|
2998
2571
|
|
2999
|
-
# Builds a type that represents `T.attached_class`.
|
3000
2572
|
sig { returns(::RBI::Type::AttachedClass) }
|
3001
2573
|
def attached_class; end
|
3002
2574
|
|
3003
|
-
# Builds a type that represents `T::Boolean`.
|
3004
2575
|
sig { returns(::RBI::Type::Boolean) }
|
3005
2576
|
def boolean; end
|
3006
2577
|
|
3007
|
-
# Builds a type that represents the singleton class of another type like `T.class_of(Foo)`.
|
3008
2578
|
sig { params(type: ::RBI::Type::Simple, type_parameter: T.nilable(::RBI::Type)).returns(::RBI::Type::ClassOf) }
|
3009
2579
|
def class_of(type, type_parameter = T.unsafe(nil)); end
|
3010
2580
|
|
3011
|
-
# Builds a type that represents a generic type like `T::Array[String]` or `T::Hash[Symbol, Integer]`.
|
3012
2581
|
sig { params(name: ::String, params: T.any(::RBI::Type, T::Array[::RBI::Type])).returns(::RBI::Type::Generic) }
|
3013
2582
|
def generic(name, *params); end
|
3014
2583
|
|
3015
|
-
# Builds a type that represents a nilable of another type like `T.nilable(String)`.
|
3016
|
-
#
|
3017
|
-
# Note that this method transforms types such as `T.nilable(T.untyped)` into `T.untyped`, so
|
3018
|
-
# it may return something other than a `RBI::Type::Nilable`.
|
3019
2584
|
sig { params(type: ::RBI::Type).returns(::RBI::Type) }
|
3020
2585
|
def nilable(type); end
|
3021
2586
|
|
3022
|
-
# Builds a type that represents `T.noreturn`.
|
3023
2587
|
sig { returns(::RBI::Type::NoReturn) }
|
3024
2588
|
def noreturn; end
|
3025
2589
|
|
3026
2590
|
sig { params(node: ::Prism::Node).returns(::RBI::Type) }
|
3027
2591
|
def parse_node(node); end
|
3028
2592
|
|
3029
|
-
# @raise [Error]
|
3030
2593
|
sig { params(string: ::String).returns(::RBI::Type) }
|
3031
2594
|
def parse_string(string); end
|
3032
2595
|
|
3033
|
-
# Builds a type that represents a proc type like `T.proc.void`.
|
3034
2596
|
sig { returns(::RBI::Type::Proc) }
|
3035
2597
|
def proc; end
|
3036
2598
|
|
3037
|
-
# Builds a type that represents `T.self_type`.
|
3038
2599
|
sig { returns(::RBI::Type::SelfType) }
|
3039
2600
|
def self_type; end
|
3040
2601
|
|
3041
|
-
# Builds a type that represents a shape type like `{name: String, age: Integer}`.
|
3042
2602
|
sig { params(types: T::Hash[T.any(::String, ::Symbol), ::RBI::Type]).returns(::RBI::Type::Shape) }
|
3043
2603
|
def shape(types = T.unsafe(nil)); end
|
3044
2604
|
|
3045
|
-
# Builds a simple type like `String` or `::Foo::Bar`.
|
3046
|
-
#
|
3047
|
-
# It raises a `NameError` if the name is not a valid Ruby class identifier.
|
3048
|
-
#
|
3049
|
-
# @raise [NameError]
|
3050
2605
|
sig { params(name: ::String).returns(::RBI::Type::Simple) }
|
3051
2606
|
def simple(name); end
|
3052
2607
|
|
3053
|
-
# Builds a type that represents the class of another type like `T::Class[Foo]`.
|
3054
2608
|
sig { params(type: ::RBI::Type).returns(::RBI::Type::Class) }
|
3055
2609
|
def t_class(type); end
|
3056
2610
|
|
3057
|
-
# Builds a type that represents a tuple type like `[String, Integer]`.
|
3058
2611
|
sig { params(types: T.any(::RBI::Type, T::Array[::RBI::Type])).returns(::RBI::Type::Tuple) }
|
3059
2612
|
def tuple(*types); end
|
3060
2613
|
|
3061
|
-
# Builds a type that represents a type parameter like `T.type_parameter(:U)`.
|
3062
2614
|
sig { params(name: ::Symbol).returns(::RBI::Type::TypeParameter) }
|
3063
2615
|
def type_parameter(name); end
|
3064
2616
|
|
3065
|
-
# Builds a type that represents `T.untyped`.
|
3066
2617
|
sig { returns(::RBI::Type::Untyped) }
|
3067
2618
|
def untyped; end
|
3068
2619
|
|
3069
|
-
# Builds a type that represents `void`.
|
3070
2620
|
sig { returns(::RBI::Type::Void) }
|
3071
2621
|
def void; end
|
3072
2622
|
|
@@ -3081,14 +2631,12 @@ class RBI::Type
|
|
3081
2631
|
sig { params(node: ::Prism::CallNode, count: ::Integer).returns(T::Array[::Prism::Node]) }
|
3082
2632
|
def check_arguments_exactly!(node, count); end
|
3083
2633
|
|
3084
|
-
# @raise [Error]
|
3085
2634
|
sig { params(node: ::Prism::CallNode).returns(::RBI::Type) }
|
3086
2635
|
def parse_call(node); end
|
3087
2636
|
|
3088
2637
|
sig { params(node: T.any(::Prism::ConstantPathNode, ::Prism::ConstantReadNode)).returns(::RBI::Type) }
|
3089
2638
|
def parse_constant(node); end
|
3090
2639
|
|
3091
|
-
# @raise [Error]
|
3092
2640
|
sig { params(node: ::Prism::CallNode).returns(::RBI::Type) }
|
3093
2641
|
def parse_proc(node); end
|
3094
2642
|
|
@@ -3118,7 +2666,6 @@ class RBI::Type
|
|
3118
2666
|
end
|
3119
2667
|
end
|
3120
2668
|
|
3121
|
-
# A type that is intersection of multiple types like `T.all(String, Integer)`.
|
3122
2669
|
class RBI::Type::All < ::RBI::Type::Composite
|
3123
2670
|
sig { override.returns(::RBI::Type) }
|
3124
2671
|
def normalize; end
|
@@ -3130,7 +2677,6 @@ class RBI::Type::All < ::RBI::Type::Composite
|
|
3130
2677
|
def to_rbi; end
|
3131
2678
|
end
|
3132
2679
|
|
3133
|
-
# A type that is union of multiple types like `T.any(String, Integer)`.
|
3134
2680
|
class RBI::Type::Any < ::RBI::Type::Composite
|
3135
2681
|
sig { returns(T::Boolean) }
|
3136
2682
|
def nilable?; end
|
@@ -3145,7 +2691,6 @@ class RBI::Type::Any < ::RBI::Type::Composite
|
|
3145
2691
|
def to_rbi; end
|
3146
2692
|
end
|
3147
2693
|
|
3148
|
-
# `T.anything`.
|
3149
2694
|
class RBI::Type::Anything < ::RBI::Type
|
3150
2695
|
sig { override.params(other: ::BasicObject).returns(T::Boolean) }
|
3151
2696
|
def ==(other); end
|
@@ -3160,7 +2705,6 @@ class RBI::Type::Anything < ::RBI::Type
|
|
3160
2705
|
def to_rbi; end
|
3161
2706
|
end
|
3162
2707
|
|
3163
|
-
# `T.attached_class`.
|
3164
2708
|
class RBI::Type::AttachedClass < ::RBI::Type
|
3165
2709
|
sig { override.params(other: ::BasicObject).returns(T::Boolean) }
|
3166
2710
|
def ==(other); end
|
@@ -3175,7 +2719,6 @@ class RBI::Type::AttachedClass < ::RBI::Type
|
|
3175
2719
|
def to_rbi; end
|
3176
2720
|
end
|
3177
2721
|
|
3178
|
-
# `T::Boolean`.
|
3179
2722
|
class RBI::Type::Boolean < ::RBI::Type
|
3180
2723
|
sig { override.params(other: ::BasicObject).returns(T::Boolean) }
|
3181
2724
|
def ==(other); end
|
@@ -3190,7 +2733,6 @@ class RBI::Type::Boolean < ::RBI::Type
|
|
3190
2733
|
def to_rbi; end
|
3191
2734
|
end
|
3192
2735
|
|
3193
|
-
# The class of another type like `T::Class[Foo]`.
|
3194
2736
|
class RBI::Type::Class < ::RBI::Type
|
3195
2737
|
sig { params(type: ::RBI::Type).void }
|
3196
2738
|
def initialize(type); end
|
@@ -3211,7 +2753,6 @@ class RBI::Type::Class < ::RBI::Type
|
|
3211
2753
|
def type; end
|
3212
2754
|
end
|
3213
2755
|
|
3214
|
-
# The singleton class of another type like `T.class_of(Foo)`.
|
3215
2756
|
class RBI::Type::ClassOf < ::RBI::Type
|
3216
2757
|
sig { params(type: ::RBI::Type::Simple, type_parameter: T.nilable(::RBI::Type)).void }
|
3217
2758
|
def initialize(type, type_parameter = T.unsafe(nil)); end
|
@@ -3235,10 +2776,9 @@ class RBI::Type::ClassOf < ::RBI::Type
|
|
3235
2776
|
def type_parameter; end
|
3236
2777
|
end
|
3237
2778
|
|
3238
|
-
# A type that is composed of multiple types like `T.all(String, Integer)`.
|
3239
|
-
#
|
3240
|
-
# @abstract
|
3241
2779
|
class RBI::Type::Composite < ::RBI::Type
|
2780
|
+
abstract!
|
2781
|
+
|
3242
2782
|
sig { params(types: T::Array[::RBI::Type]).void }
|
3243
2783
|
def initialize(types); end
|
3244
2784
|
|
@@ -3251,7 +2791,6 @@ end
|
|
3251
2791
|
|
3252
2792
|
class RBI::Type::Error < ::RBI::Error; end
|
3253
2793
|
|
3254
|
-
# A generic type like `T::Array[String]` or `T::Hash[Symbol, Integer]`.
|
3255
2794
|
class RBI::Type::Generic < ::RBI::Type
|
3256
2795
|
sig { params(name: ::String, params: ::RBI::Type).void }
|
3257
2796
|
def initialize(name, *params); end
|
@@ -3275,7 +2814,6 @@ class RBI::Type::Generic < ::RBI::Type
|
|
3275
2814
|
def to_rbi; end
|
3276
2815
|
end
|
3277
2816
|
|
3278
|
-
# A type that can be `nil` like `T.nilable(String)`.
|
3279
2817
|
class RBI::Type::Nilable < ::RBI::Type
|
3280
2818
|
sig { params(type: ::RBI::Type).void }
|
3281
2819
|
def initialize(type); end
|
@@ -3296,7 +2834,6 @@ class RBI::Type::Nilable < ::RBI::Type
|
|
3296
2834
|
def type; end
|
3297
2835
|
end
|
3298
2836
|
|
3299
|
-
# `T.noreturn`.
|
3300
2837
|
class RBI::Type::NoReturn < ::RBI::Type
|
3301
2838
|
sig { override.params(other: ::BasicObject).returns(T::Boolean) }
|
3302
2839
|
def ==(other); end
|
@@ -3311,7 +2848,6 @@ class RBI::Type::NoReturn < ::RBI::Type
|
|
3311
2848
|
def to_rbi; end
|
3312
2849
|
end
|
3313
2850
|
|
3314
|
-
# A proc type like `T.proc.void`.
|
3315
2851
|
class RBI::Type::Proc < ::RBI::Type
|
3316
2852
|
sig { void }
|
3317
2853
|
def initialize; end
|
@@ -3350,7 +2886,6 @@ class RBI::Type::Proc < ::RBI::Type
|
|
3350
2886
|
def void; end
|
3351
2887
|
end
|
3352
2888
|
|
3353
|
-
# `T.self_type`.
|
3354
2889
|
class RBI::Type::SelfType < ::RBI::Type
|
3355
2890
|
sig { override.params(other: ::BasicObject).returns(T::Boolean) }
|
3356
2891
|
def ==(other); end
|
@@ -3365,7 +2900,6 @@ class RBI::Type::SelfType < ::RBI::Type
|
|
3365
2900
|
def to_rbi; end
|
3366
2901
|
end
|
3367
2902
|
|
3368
|
-
# A shape type like `{name: String, age: Integer}`.
|
3369
2903
|
class RBI::Type::Shape < ::RBI::Type
|
3370
2904
|
sig { params(types: T::Hash[T.any(::String, ::Symbol), ::RBI::Type]).void }
|
3371
2905
|
def initialize(types); end
|
@@ -3386,9 +2920,6 @@ class RBI::Type::Shape < ::RBI::Type
|
|
3386
2920
|
def types; end
|
3387
2921
|
end
|
3388
2922
|
|
3389
|
-
# A type that represents a simple class name like `String` or `Foo`.
|
3390
|
-
#
|
3391
|
-
# It can also be a qualified name like `::Foo` or `Foo::Bar`.
|
3392
2923
|
class RBI::Type::Simple < ::RBI::Type
|
3393
2924
|
sig { params(name: ::String).void }
|
3394
2925
|
def initialize(name); end
|
@@ -3409,7 +2940,6 @@ class RBI::Type::Simple < ::RBI::Type
|
|
3409
2940
|
def to_rbi; end
|
3410
2941
|
end
|
3411
2942
|
|
3412
|
-
# A tuple type like `[String, Integer]`.
|
3413
2943
|
class RBI::Type::Tuple < ::RBI::Type
|
3414
2944
|
sig { params(types: T::Array[::RBI::Type]).void }
|
3415
2945
|
def initialize(types); end
|
@@ -3430,7 +2960,6 @@ class RBI::Type::Tuple < ::RBI::Type
|
|
3430
2960
|
def types; end
|
3431
2961
|
end
|
3432
2962
|
|
3433
|
-
# A type parameter like `T.type_parameter(:U)`.
|
3434
2963
|
class RBI::Type::TypeParameter < ::RBI::Type
|
3435
2964
|
sig { params(name: ::Symbol).void }
|
3436
2965
|
def initialize(name); end
|
@@ -3451,7 +2980,6 @@ class RBI::Type::TypeParameter < ::RBI::Type
|
|
3451
2980
|
def to_rbi; end
|
3452
2981
|
end
|
3453
2982
|
|
3454
|
-
# `T.untyped`.
|
3455
2983
|
class RBI::Type::Untyped < ::RBI::Type
|
3456
2984
|
sig { override.params(other: ::BasicObject).returns(T::Boolean) }
|
3457
2985
|
def ==(other); end
|
@@ -3529,7 +3057,6 @@ end
|
|
3529
3057
|
|
3530
3058
|
class RBI::Type::Visitor::Error < ::RBI::Error; end
|
3531
3059
|
|
3532
|
-
# `void`.
|
3533
3060
|
class RBI::Type::Void < ::RBI::Type
|
3534
3061
|
sig { override.params(other: ::BasicObject).returns(T::Boolean) }
|
3535
3062
|
def ==(other); end
|
@@ -3570,7 +3097,6 @@ class RBI::TypeMember < ::RBI::NodeWithComments
|
|
3570
3097
|
sig { override.returns(::String) }
|
3571
3098
|
def to_s; end
|
3572
3099
|
|
3573
|
-
# @return [String]
|
3574
3100
|
def value; end
|
3575
3101
|
end
|
3576
3102
|
|
@@ -3665,8 +3191,9 @@ end
|
|
3665
3191
|
|
3666
3192
|
RBI::VERSION = T.let(T.unsafe(nil), String)
|
3667
3193
|
|
3668
|
-
# @abstract
|
3669
3194
|
class RBI::Visibility < ::RBI::NodeWithComments
|
3195
|
+
abstract!
|
3196
|
+
|
3670
3197
|
sig { params(visibility: ::Symbol, loc: T.nilable(::RBI::Loc), comments: T::Array[::RBI::Comment]).void }
|
3671
3198
|
def initialize(visibility, loc: T.unsafe(nil), comments: T.unsafe(nil)); end
|
3672
3199
|
|
@@ -3694,8 +3221,9 @@ class RBI::VisibilityGroup < ::RBI::Tree
|
|
3694
3221
|
def visibility; end
|
3695
3222
|
end
|
3696
3223
|
|
3697
|
-
# @abstract
|
3698
3224
|
class RBI::Visitor
|
3225
|
+
abstract!
|
3226
|
+
|
3699
3227
|
sig { params(node: T.nilable(::RBI::Node)).void }
|
3700
3228
|
def visit(node); end
|
3701
3229
|
|