rbs 3.7.0 → 3.8.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +3 -3
  3. data/.github/workflows/ruby.yml +7 -7
  4. data/CHANGELOG.md +52 -0
  5. data/core/array.rbs +1743 -1580
  6. data/core/basic_object.rbs +38 -35
  7. data/core/comparable.rbs +1 -1
  8. data/core/complex.rbs +165 -93
  9. data/core/data.rbs +1 -1
  10. data/core/dir.rbs +1 -17
  11. data/core/encoding.rbs +12 -6
  12. data/core/enumerable.rbs +270 -266
  13. data/core/enumerator.rbs +0 -2
  14. data/core/env.rbs +1 -1
  15. data/core/errno.rbs +33 -16
  16. data/core/errors.rbs +2 -2
  17. data/core/exception.rbs +236 -170
  18. data/core/fiber.rbs +3 -2
  19. data/core/file.rbs +32 -74
  20. data/core/float.rbs +125 -72
  21. data/core/gc.rbs +138 -40
  22. data/core/hash.rbs +120 -141
  23. data/core/integer.rbs +79 -50
  24. data/core/io/buffer.rbs +49 -43
  25. data/core/io.rbs +97 -144
  26. data/core/kernel.rbs +290 -200
  27. data/core/match_data.rbs +76 -2
  28. data/core/math.rbs +0 -36
  29. data/core/module.rbs +28 -23
  30. data/core/nil_class.rbs +0 -3
  31. data/core/numeric.rbs +100 -103
  32. data/core/object.rbs +0 -4
  33. data/core/object_space/weak_key_map.rbs +3 -4
  34. data/core/object_space.rbs +3 -3
  35. data/core/proc.rbs +0 -2
  36. data/core/process.rbs +109 -57
  37. data/core/ractor.rbs +37 -4
  38. data/core/range.rbs +114 -87
  39. data/core/rational.rbs +0 -2
  40. data/core/rbs/unnamed/argf.rbs +234 -33
  41. data/core/rbs/unnamed/env_class.rbs +35 -53
  42. data/core/rbs/unnamed/random.rbs +1 -2
  43. data/core/regexp.rbs +4 -52
  44. data/core/ruby_vm.rbs +88 -9
  45. data/core/rubygems/config_file.rbs +3 -0
  46. data/core/rubygems/errors.rbs +0 -5
  47. data/core/rubygems/platform.rbs +0 -9
  48. data/core/rubygems/rubygems.rbs +0 -5
  49. data/core/rubygems/version.rbs +6 -6
  50. data/core/set.rbs +3 -15
  51. data/core/string.rbs +130 -136
  52. data/core/struct.rbs +6 -18
  53. data/core/symbol.rbs +14 -21
  54. data/core/thread.rbs +32 -35
  55. data/core/time.rbs +127 -50
  56. data/core/trace_point.rbs +16 -0
  57. data/core/true_class.rbs +0 -1
  58. data/core/warning.rbs +9 -2
  59. data/docs/architecture.md +1 -1
  60. data/docs/syntax.md +1 -1
  61. data/ext/rbs_extension/location.c +29 -19
  62. data/ext/rbs_extension/parser.c +267 -292
  63. data/ext/rbs_extension/parserstate.c +56 -22
  64. data/lib/rbs/annotate/annotations.rb +3 -3
  65. data/lib/rbs/annotate/rdoc_source.rb +2 -2
  66. data/lib/rbs/cli/diff.rb +3 -3
  67. data/lib/rbs/cli/validate.rb +1 -1
  68. data/lib/rbs/cli.rb +13 -13
  69. data/lib/rbs/collection/config.rb +3 -1
  70. data/lib/rbs/definition_builder/ancestor_builder.rb +3 -3
  71. data/lib/rbs/environment_loader.rb +1 -1
  72. data/lib/rbs/namespace.rb +1 -0
  73. data/lib/rbs/parser_aux.rb +2 -2
  74. data/lib/rbs/prototype/rb.rb +11 -8
  75. data/lib/rbs/prototype/rbi.rb +9 -5
  76. data/lib/rbs/prototype/runtime/value_object_generator.rb +7 -5
  77. data/lib/rbs/prototype/runtime.rb +4 -5
  78. data/lib/rbs/type_name.rb +14 -9
  79. data/lib/rbs/unit_test/type_assertions.rb +2 -2
  80. data/lib/rbs/validator.rb +3 -1
  81. data/lib/rbs/version.rb +1 -1
  82. data/lib/rdoc_plugin/parser.rb +2 -2
  83. data/rbs.gemspec +4 -0
  84. data/sig/ancestor_graph.rbs +4 -4
  85. data/sig/namespace.rbs +2 -3
  86. data/sig/resolver/constant_resolver.rbs +2 -2
  87. data/sig/resolver/context.rbs +1 -1
  88. data/sig/type_alias_regularity.rbs +5 -5
  89. data/sig/typename.rbs +8 -5
  90. data/sig/use_map.rbs +1 -1
  91. data/sig/validator.rbs +2 -2
  92. data/stdlib/base64/0/base64.rbs +0 -9
  93. data/stdlib/benchmark/0/benchmark.rbs +11 -2
  94. data/stdlib/bigdecimal/0/big_decimal.rbs +26 -182
  95. data/stdlib/cgi/0/core.rbs +47 -0
  96. data/stdlib/coverage/0/coverage.rbs +0 -3
  97. data/stdlib/csv/0/csv.rbs +18 -58
  98. data/stdlib/date/0/date.rbs +4 -19
  99. data/stdlib/did_you_mean/0/did_you_mean.rbs +0 -5
  100. data/stdlib/digest/0/digest.rbs +25 -2
  101. data/stdlib/erb/0/erb.rbs +0 -1
  102. data/stdlib/etc/0/etc.rbs +51 -34
  103. data/stdlib/fileutils/0/fileutils.rbs +3 -44
  104. data/stdlib/io-console/0/io-console.rbs +69 -15
  105. data/stdlib/ipaddr/0/ipaddr.rbs +8 -4
  106. data/stdlib/json/0/json.rbs +56 -71
  107. data/stdlib/logger/0/log_device.rbs +1 -1
  108. data/stdlib/logger/0/logger.rbs +3 -18
  109. data/stdlib/net-http/0/net-http.rbs +19 -77
  110. data/stdlib/nkf/0/nkf.rbs +30 -0
  111. data/stdlib/objspace/0/objspace.rbs +1 -2
  112. data/stdlib/observable/0/observable.rbs +1 -1
  113. data/stdlib/open-uri/0/open-uri.rbs +52 -0
  114. data/stdlib/open3/0/open3.rbs +0 -8
  115. data/stdlib/openssl/0/openssl.rbs +136 -69
  116. data/stdlib/optparse/0/optparse.rbs +58 -18
  117. data/stdlib/pathname/0/pathname.rbs +2 -8
  118. data/stdlib/pp/0/pp.rbs +3 -1
  119. data/stdlib/prettyprint/0/prettyprint.rbs +0 -4
  120. data/stdlib/pstore/0/pstore.rbs +0 -6
  121. data/stdlib/psych/0/psych.rbs +15 -4
  122. data/stdlib/pty/0/pty.rbs +46 -4
  123. data/stdlib/rdoc/0/code_object.rbs +0 -4
  124. data/stdlib/rdoc/0/markup.rbs +10 -12
  125. data/stdlib/rdoc/0/rdoc.rbs +1 -2
  126. data/stdlib/resolv/0/resolv.rbs +8 -3
  127. data/stdlib/ripper/0/ripper.rbs +0 -2
  128. data/stdlib/securerandom/0/securerandom.rbs +0 -2
  129. data/stdlib/shellwords/0/shellwords.rbs +11 -12
  130. data/stdlib/singleton/0/singleton.rbs +0 -1
  131. data/stdlib/socket/0/addrinfo.rbs +0 -1
  132. data/stdlib/socket/0/basic_socket.rbs +0 -5
  133. data/stdlib/socket/0/socket.rbs +49 -25
  134. data/stdlib/socket/0/tcp_server.rbs +0 -3
  135. data/stdlib/socket/0/tcp_socket.rbs +58 -3
  136. data/stdlib/socket/0/udp_socket.rbs +0 -1
  137. data/stdlib/socket/0/unix_server.rbs +0 -3
  138. data/stdlib/strscan/0/string_scanner.rbs +1265 -422
  139. data/stdlib/tempfile/0/tempfile.rbs +135 -28
  140. data/stdlib/time/0/time.rbs +48 -35
  141. data/stdlib/timeout/0/timeout.rbs +11 -8
  142. data/stdlib/tmpdir/0/tmpdir.rbs +8 -1
  143. data/stdlib/tsort/0/tsort.rbs +0 -4
  144. data/stdlib/uri/0/common.rbs +11 -30
  145. data/stdlib/uri/0/ftp.rbs +1 -1
  146. data/stdlib/uri/0/generic.rbs +22 -18
  147. data/stdlib/uri/0/http.rbs +2 -2
  148. data/stdlib/uri/0/rfc2396_parser.rbs +3 -0
  149. data/stdlib/zlib/0/buf_error.rbs +1 -70
  150. data/stdlib/zlib/0/data_error.rbs +1 -70
  151. data/stdlib/zlib/0/deflate.rbs +8 -72
  152. data/stdlib/zlib/0/error.rbs +1 -70
  153. data/stdlib/zlib/0/gzip_file/crc_error.rbs +2 -105
  154. data/stdlib/zlib/0/gzip_file/error.rbs +2 -105
  155. data/stdlib/zlib/0/gzip_file/length_error.rbs +2 -105
  156. data/stdlib/zlib/0/gzip_file/no_footer.rbs +2 -105
  157. data/stdlib/zlib/0/gzip_file.rbs +1 -71
  158. data/stdlib/zlib/0/gzip_reader.rbs +3 -74
  159. data/stdlib/zlib/0/gzip_writer.rbs +1 -70
  160. data/stdlib/zlib/0/inflate.rbs +4 -71
  161. data/stdlib/zlib/0/mem_error.rbs +1 -70
  162. data/stdlib/zlib/0/need_dict.rbs +1 -70
  163. data/stdlib/zlib/0/stream_end.rbs +1 -70
  164. data/stdlib/zlib/0/stream_error.rbs +1 -70
  165. data/stdlib/zlib/0/version_error.rbs +1 -70
  166. data/stdlib/zlib/0/zlib.rbs +0 -2
  167. data/stdlib/zlib/0/zstream.rbs +4 -72
  168. metadata +4 -6
data/core/regexp.rbs CHANGED
@@ -41,7 +41,6 @@
41
41
  #
42
42
  # See [Regexp Methods](rdoc-ref:regexp/methods.rdoc).
43
43
  #
44
- #
45
44
  # ## Regexp Objects
46
45
  #
47
46
  # A regexp object has:
@@ -54,7 +53,6 @@
54
53
  #
55
54
  # * An encoding; see [Encodings](rdoc-ref:Regexp@Encodings).
56
55
  #
57
- #
58
56
  # ## Creating a Regexp
59
57
  #
60
58
  # A regular expression may be created with:
@@ -82,7 +80,6 @@
82
80
  #
83
81
  # * Method Regexp.new.
84
82
  #
85
- #
86
83
  # ## Method `match`
87
84
  #
88
85
  # Each of the methods Regexp#match, String#match, and Symbol#match returns a
@@ -118,7 +115,6 @@
118
115
  # * `#match`: see [Method match](rdoc-ref:Regexp@Method+match).
119
116
  # * `#=~`: see [Operator =~](rdoc-ref:Regexp@Operator+-3D~).
120
117
  #
121
- #
122
118
  # The affected global variables are:
123
119
  #
124
120
  # * `$~`: Returns a MatchData object, or `nil`.
@@ -130,7 +126,6 @@
130
126
  # `nil`. Note that `$0` is quite different; it returns the name of the
131
127
  # currently executing program.
132
128
  #
133
- #
134
129
  # Examples:
135
130
  #
136
131
  # # Matched string, but no matched groups.
@@ -188,7 +183,6 @@
188
183
  # * [POSIX Bracket Expressions](rdoc-ref:Regexp@POSIX+Bracket+Expressions)
189
184
  # * [Comments](rdoc-ref:Regexp@Comments)
190
185
  #
191
- #
192
186
  # ### Special Characters
193
187
  #
194
188
  # Regexp special characters, called *metacharacters*, have special meanings in
@@ -216,8 +210,9 @@
216
210
  #
217
211
  # ### Source Literals
218
212
  #
219
- # The source literal largely behaves like a double-quoted string; see [String
220
- # Literals](rdoc-ref:syntax/literals.rdoc@String+Literals).
213
+ # The source literal largely behaves like a double-quoted string; see
214
+ # [Double-Quoted String
215
+ # Literals](rdoc-ref:syntax/literals.rdoc@Double-Quoted+String+Literals).
221
216
  #
222
217
  # In particular, a source literal may contain interpolated expressions:
223
218
  #
@@ -237,7 +232,6 @@
237
232
  #
238
233
  # \w \W \d \D \h \H \S \R
239
234
  #
240
- #
241
235
  # ### Character Classes
242
236
  #
243
237
  # A *character class* is delimited by square brackets; it specifies that certain
@@ -342,7 +336,6 @@
342
336
  # /\R/.match("\u2028") # => #<MatchData "\u2028"> # Line separator (LSEP)
343
337
  # /\R/.match("\u2029") # => #<MatchData "\u2029"> # Paragraph separator (PSEP)
344
338
  #
345
- #
346
339
  # ### Anchors
347
340
  #
348
341
  # An anchor is a metasequence that matches a zero-width position between
@@ -414,7 +407,6 @@
414
407
  # "hello, world".match(/,/, 3) # => #<MatchData ",">
415
408
  # "hello, world".match(/\G,/, 3) # => nil
416
409
  #
417
- #
418
410
  # #### Lookaround Anchors
419
411
  #
420
412
  # Lookahead anchors:
@@ -427,7 +419,6 @@
427
419
  # characters *do not* match *pat*, but doesn't include those characters in
428
420
  # the matched substring.
429
421
  #
430
- #
431
422
  # Lookbehind anchors:
432
423
  #
433
424
  # * `(?<=*pat*)`: Positive lookbehind assertion: ensures that the preceding
@@ -438,7 +429,6 @@
438
429
  # characters do not match *pat*, but doesn't include those characters in the
439
430
  # matched substring.
440
431
  #
441
- #
442
432
  # The pattern below uses positive lookahead and positive lookbehind to match
443
433
  # text appearing in **...** tags without including the tags in the match:
444
434
  #
@@ -462,7 +452,6 @@
462
452
  # /(a)\K(b)\Kc/
463
453
  # /(?<=(?<=(a))(b))c/
464
454
  #
465
- #
466
455
  # ### Alternation
467
456
  #
468
457
  # The vertical bar metacharacter (`|`) may be used within parentheses to express
@@ -546,7 +535,6 @@
546
535
  # /\w{1,2}/.match('x') # => #<MatchData "x">
547
536
  # /\w{1,2}/.match('xyz') # => #<MatchData "xy">
548
537
  #
549
- #
550
538
  # #### Greedy, Lazy, or Possessive Matching
551
539
  #
552
540
  # Quantifier matching may be greedy, lazy, or possessive:
@@ -561,7 +549,6 @@
561
549
  # Possessive quantifiers: `*+`, `++`, `?+`. Note that `{min, max}` and its
562
550
  # variants do *not* support possessive matching.
563
551
  #
564
- #
565
552
  # More:
566
553
  #
567
554
  # * About greedy and lazy matching, see [Choosing Minimal or Maximal
@@ -575,7 +562,6 @@
575
562
  # gramming%20Languages%20%282nd%20ed.%29%20%5BGoyvaerts%20%26%20Levithan%202
576
563
  # 012-09-06%5D.pdf#tutorial-backtrack).
577
564
  #
578
- #
579
565
  # ### Groups and Captures
580
566
  #
581
567
  # A simple regexp has (at most) one match:
@@ -660,7 +646,6 @@
660
646
  # * The ordinary `\*n`* notation applies only for *n* in range (1..9).
661
647
  # * The `MatchData[*n*]` notation applies for any non-negative *n*.
662
648
  #
663
- #
664
649
  # * `\0` is a special backreference, referring to the entire matched string;
665
650
  # it may not be used within the regexp itself, but may be used outside it
666
651
  # (for example, in a substitution method call):
@@ -668,7 +653,6 @@
668
653
  # 'The cat sat in the hat'.gsub(/[csh]at/, '\0s')
669
654
  # # => "The cats sats in the hats"
670
655
  #
671
- #
672
656
  # #### Named Captures
673
657
  #
674
658
  # As seen above, a capture can be referred to by its number. A capture can also
@@ -733,7 +717,6 @@
733
717
  # 5. The final subexpression `"` now matches the final substring `"`, and the
734
718
  # overall match succeeds.
735
719
  #
736
- #
737
720
  # If subexpression `.*` is grouped atomically, the backtracking is disabled, and
738
721
  # the overall match fails:
739
722
  #
@@ -775,7 +758,6 @@
775
758
  # 9. Matches the fourth character in the string, `')'`.
776
759
  # 10. Matches the end of the string.
777
760
  #
778
- #
779
761
  # See [Subexpression
780
762
  # calls](https://learnbyexample.github.io/Ruby_Regexp/groupings-and-backreferenc
781
763
  # es.html?highlight=subexpression#subexpression-calls).
@@ -789,7 +771,6 @@
789
771
  # match to be applied is *no*.
790
772
  # * If not needed, `|*no`* may be omitted.
791
773
  #
792
- #
793
774
  # Examples:
794
775
  #
795
776
  # re = /\A(foo)?(?(1)(T)|(F))\z/
@@ -852,7 +833,6 @@
852
833
  # * `/\p{Upper}/`: Uppercase alphabetical
853
834
  # * `/\p{XDigit}/`: Digit allowed in a hexadecimal number (i.e., 0-9a-fA-F)
854
835
  #
855
- #
856
836
  # These are also commonly used:
857
837
  #
858
838
  # * `/\p{Emoji}/`: Unicode emoji.
@@ -866,18 +846,14 @@
866
846
  # * `Decimal Number` (`Nd`)
867
847
  # * `Connector Punctuation` (`Pc`).
868
848
  #
869
- #
870
849
  # * Unicode properties:
871
850
  # * `Alpha`
872
851
  # * `Join_Control`
873
852
  #
874
- #
875
- #
876
853
  # * `/\p{ASCII}/`: A character in the ASCII character set.
877
854
  # * `/\p{Any}/`: Any Unicode character (including unassigned characters).
878
855
  # * `/\p{Assigned}/`: An assigned character.
879
856
  #
880
- #
881
857
  # #### Unicode Character Categories
882
858
  #
883
859
  # A Unicode character category name:
@@ -886,7 +862,6 @@
886
862
  # * Is case-insensitive.
887
863
  # * Treats a space, a hyphen, and an underscore as equivalent.
888
864
  #
889
- #
890
865
  # Examples:
891
866
  #
892
867
  # /\p{lu}/ # => /\p{lu}/
@@ -908,7 +883,6 @@
908
883
  # * [Lu, Titlecase_Letter](https://www.compart.com/en/unicode/category/Lt).
909
884
  # * [Lu, Uppercase_Letter](https://www.compart.com/en/unicode/category/Lu).
910
885
  #
911
- #
912
886
  # Marks:
913
887
  #
914
888
  # * `M`, `Mark`: `Mc`, `Me`, or `Mn`.
@@ -916,7 +890,6 @@
916
890
  # * [Me, Enclosing_Mark](https://www.compart.com/en/unicode/category/Me).
917
891
  # * [Mn, Nonapacing_Mark](https://www.compart.com/en/unicode/category/Mn).
918
892
  #
919
- #
920
893
  # Numbers:
921
894
  #
922
895
  # * `N`, `Number`: `Nd`, `Nl`, or `No`.
@@ -924,7 +897,6 @@
924
897
  # * [Nl, Letter_Number](https://www.compart.com/en/unicode/category/Nl).
925
898
  # * [No, Other_Number](https://www.compart.com/en/unicode/category/No).
926
899
  #
927
- #
928
900
  # Punctation:
929
901
  #
930
902
  # * `P`, `Punctuation`: `Pc`, `Pd`, `Pe`, `Pf`, `Pi`, `Po`, or `Ps`.
@@ -955,7 +927,6 @@
955
927
  # * [Co, Private_Use](https://www.compart.com/en/unicode/category/Co).
956
928
  # * [Cs, Surrogate](https://www.compart.com/en/unicode/category/Cs).
957
929
  #
958
- #
959
930
  # #### Unicode Scripts and Blocks
960
931
  #
961
932
  # Among the Unicode properties are:
@@ -965,7 +936,6 @@
965
936
  # * [Unicode blocks](https://en.wikipedia.org/wiki/Unicode_block); see
966
937
  # [supported blocks](http://www.unicode.org/Public/UNIDATA/Blocks.txt).
967
938
  #
968
- #
969
939
  # ### POSIX Bracket Expressions
970
940
  #
971
941
  # A POSIX *bracket expression* is also similar to a character class. These
@@ -976,7 +946,6 @@
976
946
  # * `/[[:digit:]]/` matches any character in the Unicode `Decimal Number`
977
947
  # (`Nd`) category; see below.
978
948
  #
979
- #
980
949
  # The POSIX bracket expressions:
981
950
  #
982
951
  # * `/[[:digit:]]/`: Matches a [Unicode
@@ -1030,7 +999,6 @@
1030
999
  # * `/[[:punct:]]/`: Matches any (Unicode punctuation
1031
1000
  # character}[https://www.compart.com/en/unicode/category/Po]:
1032
1001
  #
1033
- #
1034
1002
  # Ruby also supports these (non-POSIX) bracket expressions:
1035
1003
  #
1036
1004
  # * `/[[:ascii:]]/`: Matches a character in the ASCII character set.
@@ -1042,14 +1010,10 @@
1042
1010
  # * `Decimal Number` (`Nd`)
1043
1011
  # * `Connector Punctuation` (`Pc`).
1044
1012
  #
1045
- #
1046
1013
  # * Unicode properties:
1047
1014
  # * `Alpha`
1048
1015
  # * `Join_Control`
1049
1016
  #
1050
- #
1051
- #
1052
- #
1053
1017
  # ### Comments
1054
1018
  #
1055
1019
  # A comment may be included in a regexp pattern using the `(?#`*comment*`)`
@@ -1073,7 +1037,6 @@
1073
1037
  # * `o`: `/*pattern*/o` sets [Interpolation
1074
1038
  # Mode](rdoc-ref:Regexp@Interpolation+Mode).
1075
1039
  #
1076
- #
1077
1040
  # Any, all, or none of these may be applied.
1078
1041
  #
1079
1042
  # Modifiers `i`, `m`, and `x` may be applied to subexpressions:
@@ -1084,7 +1047,6 @@
1084
1047
  # * `(?-*modifier*:*subexp*)` turns the mode "off" for *subexp* within the
1085
1048
  # group
1086
1049
  #
1087
- #
1088
1050
  # Example:
1089
1051
  #
1090
1052
  # re = /(?i)te(?-i)st/
@@ -1126,7 +1088,6 @@
1126
1088
  #
1127
1089
  # /a.c/m.match("a\nc") # => #<MatchData "a\nc">
1128
1090
  #
1129
- #
1130
1091
  # Unlike other languages, the modifier `m` does not affect the anchors `^` and
1131
1092
  # `$`. These anchors always match at line-boundaries in Ruby.
1132
1093
  #
@@ -1138,7 +1099,6 @@
1138
1099
  # * Character `#` marks the remainder of its containing line as a comment,
1139
1100
  # which is also to be ignored for matching purposes.
1140
1101
  #
1141
- #
1142
1102
  # In extended mode, whitespace and comments may be used to form a
1143
1103
  # self-documented regexp.
1144
1104
  #
@@ -1219,7 +1179,6 @@
1219
1179
  #
1220
1180
  # /foo/s.encoding # => #<Encoding:Windows-31J>
1221
1181
  #
1222
- #
1223
1182
  # A regexp can be matched against a target string when either:
1224
1183
  #
1225
1184
  # * They have the same encoding.
@@ -1227,7 +1186,6 @@
1227
1186
  # ASCII characters. Method Regexp#fixed_encoding? returns whether the regexp
1228
1187
  # has a *fixed* encoding.
1229
1188
  #
1230
- #
1231
1189
  # If a match between incompatible encodings is attempted an
1232
1190
  # `Encoding::CompatibilityError` exception is raised.
1233
1191
  #
@@ -1270,7 +1228,6 @@
1270
1228
  # re = Regexp.new('foo', timeout: 5.0)
1271
1229
  # re.timeout # => 5.0
1272
1230
  #
1273
- #
1274
1231
  # When regexp.timeout is `nil`, the timeout "falls through" to Regexp.timeout;
1275
1232
  # when regexp.timeout is non-`nil`, that value controls timing out:
1276
1233
  #
@@ -1300,7 +1257,6 @@
1300
1257
  # * No nested quantifiers with counting (i.e. no nested `{n}`, `{min,}`,
1301
1258
  # `{,max}`, or `{min,max}` style quantifiers)
1302
1259
  #
1303
- #
1304
1260
  # You can use method Regexp.linear_time? to determine whether a pattern meets
1305
1261
  # these criteria:
1306
1262
  #
@@ -1326,7 +1282,6 @@
1326
1282
  # ming%20Languages%20%282nd%20ed.%29%20%5BGoyvaerts%20%26%20Levithan%202012-
1327
1283
  # 09-06%5D.pdf) by Jan Goyvaerts & Steven Levithan.
1328
1284
  #
1329
- #
1330
1285
  # Explore, test (interactive online editor):
1331
1286
  #
1332
1287
  # * [Rubular](https://rubular.com/).
@@ -1398,7 +1353,7 @@ class Regexp
1398
1353
  # - Regexp.last_match(n) -> string or nil
1399
1354
  # - Regexp.last_match(name) -> string or nil
1400
1355
  # -->
1401
- # With no argument, returns the value of `$!`, which is the result of the most
1356
+ # With no argument, returns the value of `$~`, which is the result of the most
1402
1357
  # recent pattern match (see [Regexp global
1403
1358
  # variables](rdoc-ref:Regexp@Global+Variables)):
1404
1359
  #
@@ -1580,7 +1535,6 @@ class Regexp
1580
1535
  # * `nil` or `false`, which is ignored.
1581
1536
  # * Any other truthy value, in which case the regexp will be case-insensitive.
1582
1537
  #
1583
- #
1584
1538
  # If optional keyword argument `timeout` is given, its float value overrides the
1585
1539
  # timeout interval for the class, Regexp.timeout. If `nil` is passed as
1586
1540
  # +timeout, it uses the timeout interval for the class, Regexp.timeout.
@@ -1654,7 +1608,6 @@ class Regexp
1654
1608
  # interpolation](rdoc-ref:Regexp@Interpolation+Mode).
1655
1609
  # * Is at the left of the expression.
1656
1610
  #
1657
- #
1658
1611
  # Example:
1659
1612
  #
1660
1613
  # /(?<lhs>\w+)\s*=\s*(?<rhs>\w+)/ =~ ' x = y '
@@ -1843,7 +1796,6 @@ class Regexp
1843
1796
  # * Each key is the name of a named capture.
1844
1797
  # * Each value is an array of integer indexes for that named capture.
1845
1798
  #
1846
- #
1847
1799
  # Examples:
1848
1800
  #
1849
1801
  # /(?<foo>.)(?<bar>.)/.named_captures # => {"foo"=>[1], "bar"=>[2]}
data/core/ruby_vm.rbs CHANGED
@@ -257,28 +257,35 @@ class RubyVM::InstructionSequence < Object
257
257
  # : A string identifying the data format. **Always
258
258
  # `YARVInstructionSequence/SimpleDataFormat`.**
259
259
  #
260
+ #
260
261
  # major_version
261
262
  # : The major version of the instruction sequence.
262
263
  #
264
+ #
263
265
  # minor_version
264
266
  # : The minor version of the instruction sequence.
265
267
  #
268
+ #
266
269
  # format_type
267
270
  # : A number identifying the data format. **Always 1**.
268
271
  #
272
+ #
269
273
  # misc
270
274
  # : A hash containing:
271
275
  #
272
276
  # `:arg_size`
273
277
  # : the total number of arguments taken by the method or the block (0 if
274
278
  # *iseq* doesn't represent a method or block)
279
+ #
275
280
  # `:local_size`
276
281
  # : the number of local variables + 1
282
+ #
277
283
  # `:stack_max`
278
284
  # : used in calculating the stack depth at which a SystemStackError is
279
285
  # thrown.
280
286
  #
281
287
  #
288
+ #
282
289
  # #label
283
290
  # : The name of the context (block, method, class, module, etc.) that this
284
291
  # instruction sequence belongs to.
@@ -286,41 +293,49 @@ class RubyVM::InstructionSequence < Object
286
293
  # `<main>` if it's at the top level, `<compiled>` if it was evaluated from a
287
294
  # string.
288
295
  #
296
+ #
289
297
  # #path
290
298
  # : The relative path to the Ruby file where the instruction sequence was
291
299
  # loaded from.
292
300
  #
293
301
  # `<compiled>` if the iseq was evaluated from a string.
294
302
  #
303
+ #
295
304
  # #absolute_path
296
305
  # : The absolute path to the Ruby file where the instruction sequence was
297
306
  # loaded from.
298
307
  #
299
308
  # `nil` if the iseq was evaluated from a string.
300
309
  #
310
+ #
301
311
  # #first_lineno
302
312
  # : The number of the first source line where the instruction sequence was
303
313
  # loaded from.
304
314
  #
315
+ #
305
316
  # type
306
317
  # : The type of the instruction sequence.
307
318
  #
308
319
  # Valid values are `:top`, `:method`, `:block`, `:class`, `:rescue`,
309
320
  # `:ensure`, `:eval`, `:main`, and `plain`.
310
321
  #
322
+ #
311
323
  # locals
312
324
  # : An array containing the names of all arguments and local variables as
313
325
  # symbols.
314
326
  #
327
+ #
315
328
  # params
316
329
  # : An Hash object containing parameter information.
317
330
  #
318
331
  # More info about these values can be found in `vm_core.h`.
319
332
  #
333
+ #
320
334
  # catch_table
321
335
  # : A list of exceptions and control flow operators (rescue, next, redo,
322
336
  # break, etc.).
323
337
  #
338
+ #
324
339
  # bytecode
325
340
  # : An array of arrays containing the instruction names and operands that make
326
341
  # up the body of the instruction sequence.
@@ -371,9 +386,8 @@ end
371
386
  # access children nodes by name, etc.
372
387
  #
373
388
  # If you are looking for a stable API or an API working under multiple Ruby
374
- # implementations, consider using the *parser* gem or Ripper. If you would like
375
- # to make RubyVM::AbstractSyntaxTree stable, please join the discussion at
376
- # https://bugs.ruby-lang.org/issues/14844.
389
+ # implementations, consider using the *prism* gem, which is the official Ruby
390
+ # API to parse Ruby code.
377
391
  #
378
392
  module RubyVM::AbstractSyntaxTree
379
393
  # <!--
@@ -521,6 +535,15 @@ module RubyVM::AbstractSyntaxTree
521
535
  #
522
536
  def last_column: () -> Integer
523
537
 
538
+ # <!--
539
+ # rdoc-file=ast.rb
540
+ # - node.locations -> array
541
+ # -->
542
+ # Returns location objects associated with the AST node. The returned array
543
+ # contains RubyVM::AbstractSyntaxTree::Location.
544
+ #
545
+ def locations: () -> Array[Location]
546
+
524
547
  # <!--
525
548
  # rdoc-file=ast.rb
526
549
  # - node.tokens -> array
@@ -565,6 +588,54 @@ module RubyVM::AbstractSyntaxTree
565
588
  #
566
589
  def children: () -> Array[untyped]
567
590
  end
591
+
592
+ # <!-- rdoc-file=ast.rb -->
593
+ # RubyVM::AbstractSyntaxTree::Location instances are created by
594
+ # RubyVM::AbstractSyntaxTree#locations.
595
+ #
596
+ # This class is MRI specific.
597
+ #
598
+ class Location
599
+ # <!--
600
+ # rdoc-file=ast.rb
601
+ # - location.first_column -> integer
602
+ # -->
603
+ # The column number in the source code where this AST's text began.
604
+ #
605
+ def first_column: () -> Integer
606
+
607
+ # <!--
608
+ # rdoc-file=ast.rb
609
+ # - location.first_lineno -> integer
610
+ # -->
611
+ # The line number in the source code where this AST's text began.
612
+ #
613
+ def first_lineno: () -> Integer
614
+
615
+ # <!--
616
+ # rdoc-file=ast.rb
617
+ # - location.inspect -> string
618
+ # -->
619
+ # Returns debugging information about this location as a string.
620
+ #
621
+ def inspect: () -> String
622
+
623
+ # <!--
624
+ # rdoc-file=ast.rb
625
+ # - location.last_lineno -> integer
626
+ # -->
627
+ # The line number in the source code where this AST's text ended.
628
+ #
629
+ def last_lineno: () -> Integer
630
+
631
+ # <!--
632
+ # rdoc-file=ast.rb
633
+ # - location.last_column -> integer
634
+ # -->
635
+ # The column number in the source code where this AST's text ended.
636
+ #
637
+ def last_column: () -> Integer
638
+ end
568
639
  end
569
640
 
570
641
  # <!-- rdoc-file=yjit.rb -->
@@ -612,13 +683,19 @@ module RubyVM::YJIT
612
683
 
613
684
  # <!--
614
685
  # rdoc-file=yjit.rb
615
- # - enable(stats: false)
686
+ # - enable(stats: false, log: false)
616
687
  # -->
617
688
  # Enable YJIT compilation. `stats` option decides whether to enable YJIT stats
618
- # or not.
619
- # * `false`: Disable stats.
620
- # * `true`: Enable stats. Print stats at exit.
621
- # * `:quiet`: Enable stats. Do not print stats at exit.
689
+ # or not. `compilation_log` decides
690
+ # whether to enable YJIT compilation logging or not.
691
+ # `stats`:
692
+ # * `false`: Don't enable stats.
693
+ # * `true`: Enable stats. Print stats at exit.
694
+ # * `:quiet`: Enable stats. Do not print stats at exit.
695
+ # `log`:
696
+ # * `false`: Don't enable the log.
697
+ # * `true`: Enable the log. Print log at exit.
698
+ # * `:quiet`: Enable the log. Do not print log at exit.
622
699
  #
623
700
  def self.enable: (?stats: false | true | :quiet) -> void
624
701
 
@@ -656,11 +733,13 @@ module RubyVM::YJIT
656
733
 
657
734
  # <!--
658
735
  # rdoc-file=yjit.rb
659
- # - runtime_stats(context: false)
736
+ # - runtime_stats(key = nil)
660
737
  # -->
661
738
  # Return a hash for statistics generated for the `--yjit-stats` command line
662
739
  # option.
663
740
  # Return `nil` when option is not passed or unavailable.
741
+ # If a symbol argument is provided, return only the value for the named stat.
742
+ # If any other type is provided, raises TypeError.
664
743
  #
665
744
  def self.runtime_stats: (?context: bool) -> Hash[untyped, untyped]?
666
745
 
@@ -16,10 +16,13 @@
16
16
  #
17
17
  # `:backtrace`
18
18
  # : See #backtrace
19
+ #
19
20
  # `:sources`
20
21
  # : Sets Gem::sources
22
+ #
21
23
  # `:verbose`
22
24
  # : See #verbose
25
+ #
23
26
  # `:concurrent_downloads`
24
27
  # : See #concurrent_downloads
25
28
  #
@@ -8,21 +8,18 @@
8
8
  # * [RubyGems User Guide](https://guides.rubygems.org/)
9
9
  # * [Frequently Asked Questions](https://guides.rubygems.org/faqs)
10
10
  #
11
- #
12
11
  # For gem developer documentation see:
13
12
  #
14
13
  # * [Creating Gems](https://guides.rubygems.org/make-your-own-gem)
15
14
  # * Gem::Specification
16
15
  # * Gem::Version for version dependency notes
17
16
  #
18
- #
19
17
  # Further RubyGems documentation can be found at:
20
18
  #
21
19
  # * [RubyGems Guides](https://guides.rubygems.org)
22
20
  # * [RubyGems API](https://www.rubydoc.info/github/rubygems/rubygems) (also
23
21
  # available from `gem server`)
24
22
  #
25
- #
26
23
  # ## RubyGems Plugins
27
24
  #
28
25
  # RubyGems will load plugins in the latest version of each installed gem or
@@ -65,7 +62,6 @@
65
62
  # * Paul Brannan -- paul(at)atdesk.com
66
63
  # * Jim Weirich -- jim(at)weirichhouse.org
67
64
  #
68
- #
69
65
  # Contributors:
70
66
  #
71
67
  # * Gavin Sinclair -- gsinclair(at)soyabean.com.au
@@ -83,7 +79,6 @@
83
79
  # * Evan Phoenix -- evan(at)fallingsnow.net
84
80
  # * Steve Klabnik -- steve(at)steveklabnik.com
85
81
  #
86
- #
87
82
  # (If your name is missing, PLEASE let us know!)
88
83
  #
89
84
  # ## License
@@ -1,12 +1,3 @@
1
- # <!-- rdoc-file=lib/rubygems.rb -->
2
- # TruffleRuby >= 24 defines REUSE_AS_BINARY_ON_TRUFFLERUBY in
3
- # defaults/truffleruby. However, TruffleRuby < 24 defines
4
- # REUSE_AS_BINARY_ON_TRUFFLERUBY directly in its copy of
5
- # lib/rubygems/platform.rb, so it is not defined if RubyGems is updated (gem
6
- # update --system). Instead, we define it here in that case, similar to
7
- # bundler/lib/bundler/rubygems_ext.rb. We must define it here and not in
8
- # platform.rb because platform.rb is loaded before defaults/truffleruby.
9
- #
10
1
  # <!-- rdoc-file=lib/rubygems/platform.rb -->
11
2
  # Available list of platforms for targeting Gem installations.
12
3
  #
@@ -8,21 +8,18 @@
8
8
  # * [RubyGems User Guide](https://guides.rubygems.org/)
9
9
  # * [Frequently Asked Questions](https://guides.rubygems.org/faqs)
10
10
  #
11
- #
12
11
  # For gem developer documentation see:
13
12
  #
14
13
  # * [Creating Gems](https://guides.rubygems.org/make-your-own-gem)
15
14
  # * Gem::Specification
16
15
  # * Gem::Version for version dependency notes
17
16
  #
18
- #
19
17
  # Further RubyGems documentation can be found at:
20
18
  #
21
19
  # * [RubyGems Guides](https://guides.rubygems.org)
22
20
  # * [RubyGems API](https://www.rubydoc.info/github/rubygems/rubygems) (also
23
21
  # available from `gem server`)
24
22
  #
25
- #
26
23
  # ## RubyGems Plugins
27
24
  #
28
25
  # RubyGems will load plugins in the latest version of each installed gem or
@@ -65,7 +62,6 @@
65
62
  # * Paul Brannan -- paul(at)atdesk.com
66
63
  # * Jim Weirich -- jim(at)weirichhouse.org
67
64
  #
68
- #
69
65
  # Contributors:
70
66
  #
71
67
  # * Gavin Sinclair -- gsinclair(at)soyabean.com.au
@@ -83,7 +79,6 @@
83
79
  # * Evan Phoenix -- evan(at)fallingsnow.net
84
80
  # * Steve Klabnik -- steve(at)steveklabnik.com
85
81
  #
86
- #
87
82
  # (If your name is missing, PLEASE let us know!)
88
83
  #
89
84
  # ## License