rbs 3.6.1 → 3.9.5

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.
Files changed (268) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +2 -2
  3. data/.github/workflows/dependabot.yml +1 -1
  4. data/.github/workflows/ruby.yml +34 -10
  5. data/.github/workflows/windows.yml +20 -3
  6. data/.gitignore +1 -0
  7. data/.rubocop.yml +26 -1
  8. data/CHANGELOG.md +241 -0
  9. data/Rakefile +54 -4
  10. data/config.yml +317 -0
  11. data/core/array.rbs +1756 -1591
  12. data/core/basic_object.rbs +38 -35
  13. data/core/comparable.rbs +1 -1
  14. data/core/complex.rbs +166 -94
  15. data/core/data.rbs +2 -2
  16. data/core/dir.rbs +2 -18
  17. data/core/encoding.rbs +12 -32
  18. data/core/enumerable.rbs +270 -266
  19. data/core/enumerator.rbs +14 -4
  20. data/core/env.rbs +1 -1
  21. data/core/errno.rbs +33 -16
  22. data/core/errors.rbs +6 -2
  23. data/core/exception.rbs +342 -167
  24. data/core/fiber.rbs +3 -2
  25. data/core/file.rbs +26 -75
  26. data/core/float.rbs +125 -72
  27. data/core/gc.rbs +158 -42
  28. data/core/hash.rbs +122 -143
  29. data/core/integer.rbs +79 -50
  30. data/core/io/buffer.rbs +49 -43
  31. data/core/io.rbs +108 -151
  32. data/core/kernel.rbs +341 -209
  33. data/core/match_data.rbs +76 -2
  34. data/core/math.rbs +0 -36
  35. data/core/method.rbs +2 -2
  36. data/core/module.rbs +32 -27
  37. data/core/nil_class.rbs +2 -2
  38. data/core/numeric.rbs +101 -104
  39. data/core/object.rbs +1 -5
  40. data/core/object_space/weak_key_map.rbs +3 -4
  41. data/core/object_space.rbs +3 -3
  42. data/core/proc.rbs +82 -14
  43. data/core/process.rbs +110 -58
  44. data/core/ractor.rbs +57 -4
  45. data/core/range.rbs +114 -87
  46. data/core/rational.rbs +0 -2
  47. data/core/rbs/unnamed/argf.rbs +237 -36
  48. data/core/rbs/unnamed/env_class.rbs +35 -53
  49. data/core/rbs/unnamed/random.rbs +1 -2
  50. data/core/regexp.rbs +10 -56
  51. data/core/ruby_vm.rbs +88 -9
  52. data/core/rubygems/config_file.rbs +3 -0
  53. data/core/rubygems/errors.rbs +3 -6
  54. data/core/rubygems/platform.rbs +0 -9
  55. data/core/rubygems/rubygems.rbs +3 -6
  56. data/core/rubygems/version.rbs +8 -8
  57. data/core/set.rbs +4 -16
  58. data/core/string.rbs +271 -264
  59. data/core/struct.rbs +6 -18
  60. data/core/symbol.rbs +14 -21
  61. data/core/thread.rbs +32 -35
  62. data/core/time.rbs +131 -50
  63. data/core/trace_point.rbs +124 -113
  64. data/core/true_class.rbs +0 -1
  65. data/core/unbound_method.rbs +1 -1
  66. data/core/warning.rbs +9 -2
  67. data/docs/architecture.md +1 -1
  68. data/docs/syntax.md +17 -10
  69. data/ext/rbs_extension/extconf.rb +11 -0
  70. data/ext/rbs_extension/location.c +61 -29
  71. data/ext/rbs_extension/location.h +4 -3
  72. data/ext/rbs_extension/main.c +23 -1
  73. data/ext/rbs_extension/parser.c +506 -517
  74. data/ext/rbs_extension/parserstate.c +109 -30
  75. data/ext/rbs_extension/parserstate.h +6 -4
  76. data/ext/rbs_extension/rbs_extension.h +1 -10
  77. data/{ext/rbs_extension → include/rbs}/constants.h +21 -19
  78. data/include/rbs/ruby_objs.h +72 -0
  79. data/include/rbs/util/rbs_constant_pool.h +219 -0
  80. data/include/rbs.h +7 -0
  81. data/lib/rbs/annotate/annotations.rb +3 -3
  82. data/lib/rbs/annotate/rdoc_source.rb +2 -2
  83. data/lib/rbs/ast/declarations.rb +9 -4
  84. data/lib/rbs/ast/directives.rb +10 -0
  85. data/lib/rbs/ast/members.rb +2 -0
  86. data/lib/rbs/ast/type_param.rb +2 -12
  87. data/lib/rbs/cli/diff.rb +3 -3
  88. data/lib/rbs/cli/validate.rb +2 -1
  89. data/lib/rbs/cli.rb +16 -16
  90. data/lib/rbs/collection/config/lockfile_generator.rb +58 -8
  91. data/lib/rbs/collection/config.rb +5 -3
  92. data/lib/rbs/collection/sources/rubygems.rb +1 -1
  93. data/lib/rbs/collection.rb +1 -0
  94. data/lib/rbs/definition.rb +51 -34
  95. data/lib/rbs/definition_builder/ancestor_builder.rb +5 -3
  96. data/lib/rbs/definition_builder.rb +83 -24
  97. data/lib/rbs/environment.rb +33 -18
  98. data/lib/rbs/environment_loader.rb +6 -1
  99. data/lib/rbs/errors.rb +24 -0
  100. data/lib/rbs/locator.rb +2 -0
  101. data/lib/rbs/method_type.rb +2 -0
  102. data/lib/rbs/namespace.rb +1 -0
  103. data/lib/rbs/parser_aux.rb +40 -3
  104. data/lib/rbs/prototype/rb.rb +20 -12
  105. data/lib/rbs/prototype/rbi.rb +11 -6
  106. data/lib/rbs/prototype/runtime/value_object_generator.rb +7 -5
  107. data/lib/rbs/prototype/runtime.rb +7 -5
  108. data/lib/rbs/subtractor.rb +3 -3
  109. data/lib/rbs/test/hook.rb +47 -42
  110. data/lib/rbs/test/type_check.rb +7 -5
  111. data/lib/rbs/type_name.rb +14 -9
  112. data/lib/rbs/types.rb +63 -14
  113. data/lib/rbs/unit_test/spy.rb +4 -2
  114. data/lib/rbs/unit_test/type_assertions.rb +19 -13
  115. data/lib/rbs/unit_test/with_aliases.rb +3 -1
  116. data/lib/rbs/validator.rb +7 -1
  117. data/lib/rbs/version.rb +1 -1
  118. data/lib/rbs/writer.rb +10 -5
  119. data/lib/rbs.rb +1 -0
  120. data/lib/rdoc_plugin/parser.rb +2 -2
  121. data/rbs.gemspec +6 -2
  122. data/sig/ancestor_graph.rbs +5 -5
  123. data/sig/annotate/rdoc_source.rbs +2 -0
  124. data/sig/cli.rbs +2 -0
  125. data/sig/collection/config/lockfile_generator.rbs +9 -1
  126. data/sig/declarations.rbs +10 -3
  127. data/sig/definition.rbs +80 -12
  128. data/sig/definition_builder.rbs +18 -4
  129. data/sig/directives.rbs +17 -1
  130. data/sig/environment.rbs +3 -1
  131. data/sig/errors.rbs +19 -0
  132. data/sig/namespace.rbs +2 -3
  133. data/sig/parser.rbs +5 -1
  134. data/sig/prototype/rb.rbs +1 -1
  135. data/sig/resolver/constant_resolver.rbs +2 -2
  136. data/sig/resolver/context.rbs +1 -1
  137. data/sig/subtractor.rbs +1 -1
  138. data/sig/test/type_check.rbs +2 -2
  139. data/sig/type_alias_dependency.rbs +2 -2
  140. data/sig/type_alias_regularity.rbs +6 -6
  141. data/sig/type_param.rbs +4 -4
  142. data/sig/typename.rbs +8 -5
  143. data/sig/types.rbs +1 -1
  144. data/sig/unit_test/spy.rbs +2 -0
  145. data/sig/unit_test/type_assertions.rbs +2 -0
  146. data/sig/use_map.rbs +1 -1
  147. data/sig/validator.rbs +6 -2
  148. data/sig/vendorer.rbs +1 -1
  149. data/sig/writer.rbs +1 -1
  150. data/{ext/rbs_extension → src}/constants.c +35 -36
  151. data/src/ruby_objs.c +799 -0
  152. data/src/util/rbs_constant_pool.c +342 -0
  153. data/stdlib/base64/0/base64.rbs +0 -9
  154. data/stdlib/benchmark/0/benchmark.rbs +11 -2
  155. data/stdlib/bigdecimal/0/big_decimal.rbs +26 -182
  156. data/stdlib/cgi/0/core.rbs +60 -3
  157. data/stdlib/cgi/0/manifest.yaml +1 -0
  158. data/stdlib/coverage/0/coverage.rbs +0 -3
  159. data/stdlib/csv/0/csv.rbs +18 -58
  160. data/stdlib/csv/0/manifest.yaml +1 -0
  161. data/stdlib/date/0/date.rbs +27 -42
  162. data/stdlib/did_you_mean/0/did_you_mean.rbs +1 -6
  163. data/stdlib/digest/0/digest.rbs +25 -2
  164. data/stdlib/erb/0/erb.rbs +0 -1
  165. data/stdlib/etc/0/etc.rbs +51 -34
  166. data/stdlib/fileutils/0/fileutils.rbs +3 -44
  167. data/stdlib/io-console/0/io-console.rbs +69 -15
  168. data/stdlib/ipaddr/0/ipaddr.rbs +16 -4
  169. data/stdlib/json/0/json.rbs +107 -120
  170. data/stdlib/logger/0/log_device.rbs +1 -1
  171. data/stdlib/logger/0/logger.rbs +3 -18
  172. data/stdlib/minitest/0/kernel.rbs +2 -2
  173. data/stdlib/minitest/0/minitest/abstract_reporter.rbs +4 -1
  174. data/stdlib/minitest/0/minitest/assertion.rbs +1 -0
  175. data/stdlib/minitest/0/minitest/assertions.rbs +58 -13
  176. data/stdlib/minitest/0/minitest/backtrace_filter.rbs +7 -0
  177. data/stdlib/minitest/0/minitest/bench_spec.rbs +8 -8
  178. data/stdlib/minitest/0/minitest/benchmark.rbs +17 -16
  179. data/stdlib/minitest/0/minitest/compress.rbs +13 -0
  180. data/stdlib/minitest/0/minitest/error_on_warning.rbs +3 -0
  181. data/stdlib/minitest/0/minitest/mock.rbs +9 -5
  182. data/stdlib/minitest/0/minitest/parallel/executor.rbs +4 -0
  183. data/stdlib/minitest/0/minitest/parallel/test/class_methods.rbs +0 -1
  184. data/stdlib/minitest/0/minitest/pride_io.rbs +8 -0
  185. data/stdlib/minitest/0/minitest/pride_lol.rbs +2 -0
  186. data/stdlib/minitest/0/minitest/progress_reporter.rbs +1 -1
  187. data/stdlib/minitest/0/minitest/reportable.rbs +2 -0
  188. data/stdlib/minitest/0/minitest/runnable.rbs +33 -1
  189. data/stdlib/minitest/0/minitest/spec/dsl/instance_methods.rbs +1 -1
  190. data/stdlib/minitest/0/minitest/spec/dsl.rbs +10 -6
  191. data/stdlib/minitest/0/minitest/spec.rbs +1 -1
  192. data/stdlib/minitest/0/minitest/statistics_reporter.rbs +5 -0
  193. data/stdlib/minitest/0/minitest/summary_reporter.rbs +0 -7
  194. data/stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs +1 -1
  195. data/stdlib/minitest/0/minitest/test.rbs +7 -14
  196. data/stdlib/minitest/0/minitest/unexpected_error.rbs +2 -0
  197. data/stdlib/minitest/0/minitest/unexpected_warning.rbs +6 -0
  198. data/stdlib/minitest/0/minitest/unit.rbs +1 -2
  199. data/stdlib/minitest/0/minitest.rbs +41 -892
  200. data/stdlib/monitor/0/monitor.rbs +13 -4
  201. data/stdlib/net-http/0/net-http.rbs +42 -109
  202. data/stdlib/nkf/0/nkf.rbs +30 -0
  203. data/stdlib/objspace/0/objspace.rbs +1 -2
  204. data/stdlib/observable/0/observable.rbs +1 -1
  205. data/stdlib/open-uri/0/manifest.yaml +1 -0
  206. data/stdlib/open-uri/0/open-uri.rbs +52 -0
  207. data/stdlib/open3/0/open3.rbs +0 -8
  208. data/stdlib/openssl/0/manifest.yaml +1 -0
  209. data/stdlib/openssl/0/openssl.rbs +235 -143
  210. data/stdlib/optparse/0/optparse.rbs +58 -18
  211. data/stdlib/pathname/0/pathname.rbs +2 -8
  212. data/stdlib/pp/0/pp.rbs +3 -1
  213. data/stdlib/prettyprint/0/prettyprint.rbs +0 -4
  214. data/stdlib/pstore/0/pstore.rbs +0 -6
  215. data/stdlib/psych/0/core_ext.rbs +12 -0
  216. data/stdlib/psych/0/psych.rbs +15 -4
  217. data/stdlib/pty/0/pty.rbs +46 -4
  218. data/stdlib/rdoc/0/code_object.rbs +0 -4
  219. data/stdlib/rdoc/0/markup.rbs +10 -12
  220. data/stdlib/rdoc/0/rdoc.rbs +13 -8
  221. data/stdlib/resolv/0/resolv.rbs +21 -12
  222. data/stdlib/ripper/0/ripper.rbs +0 -2
  223. data/stdlib/securerandom/0/securerandom.rbs +7 -2
  224. data/stdlib/shellwords/0/shellwords.rbs +11 -12
  225. data/stdlib/singleton/0/singleton.rbs +0 -1
  226. data/stdlib/socket/0/addrinfo.rbs +1 -2
  227. data/stdlib/socket/0/basic_socket.rbs +0 -5
  228. data/stdlib/socket/0/socket.rbs +32 -27
  229. data/stdlib/socket/0/tcp_server.rbs +0 -3
  230. data/stdlib/socket/0/tcp_socket.rbs +36 -3
  231. data/stdlib/socket/0/udp_socket.rbs +0 -1
  232. data/stdlib/socket/0/unix_server.rbs +0 -3
  233. data/stdlib/socket/0/unix_socket.rbs +4 -2
  234. data/{core/string_io.rbs → stdlib/stringio/0/stringio.rbs} +1 -1
  235. data/stdlib/strscan/0/string_scanner.rbs +1265 -422
  236. data/stdlib/tempfile/0/tempfile.rbs +135 -28
  237. data/stdlib/time/0/time.rbs +48 -35
  238. data/stdlib/timeout/0/timeout.rbs +11 -8
  239. data/stdlib/tmpdir/0/tmpdir.rbs +10 -3
  240. data/stdlib/tsort/0/tsort.rbs +0 -4
  241. data/stdlib/uri/0/common.rbs +28 -30
  242. data/stdlib/uri/0/ftp.rbs +1 -1
  243. data/stdlib/uri/0/generic.rbs +22 -18
  244. data/stdlib/uri/0/http.rbs +2 -2
  245. data/stdlib/uri/0/rfc2396_parser.rbs +3 -0
  246. data/stdlib/zlib/0/buf_error.rbs +1 -70
  247. data/stdlib/zlib/0/data_error.rbs +1 -70
  248. data/stdlib/zlib/0/deflate.rbs +8 -72
  249. data/stdlib/zlib/0/error.rbs +1 -70
  250. data/stdlib/zlib/0/gzip_file/crc_error.rbs +2 -105
  251. data/stdlib/zlib/0/gzip_file/error.rbs +2 -105
  252. data/stdlib/zlib/0/gzip_file/length_error.rbs +2 -105
  253. data/stdlib/zlib/0/gzip_file/no_footer.rbs +2 -105
  254. data/stdlib/zlib/0/gzip_file.rbs +1 -71
  255. data/stdlib/zlib/0/gzip_reader.rbs +3 -74
  256. data/stdlib/zlib/0/gzip_writer.rbs +1 -70
  257. data/stdlib/zlib/0/inflate.rbs +4 -71
  258. data/stdlib/zlib/0/mem_error.rbs +1 -70
  259. data/stdlib/zlib/0/need_dict.rbs +1 -70
  260. data/stdlib/zlib/0/stream_end.rbs +1 -70
  261. data/stdlib/zlib/0/stream_error.rbs +1 -70
  262. data/stdlib/zlib/0/version_error.rbs +1 -70
  263. data/stdlib/zlib/0/zlib.rbs +0 -2
  264. data/stdlib/zlib/0/zstream.rbs +4 -72
  265. metadata +17 -13
  266. data/ext/rbs_extension/ruby_objs.c +0 -602
  267. data/ext/rbs_extension/ruby_objs.h +0 -51
  268. data/stdlib/minitest/0/manifest.yaml +0 -2
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,12 +833,13 @@
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.
859
- # * `/\p{Graph}/`: Non-blank character (excludes spaces, control characters,
860
- # and similar).
839
+ # * `/\p{Graph}/`: Characters excluding `/\p{Cntrl}/` and `/\p{Space}/`. Note
840
+ # that invisible characters under the Unicode
841
+ # ["Format"](https://www.compart.com/en/unicode/category/Cf) category are
842
+ # included.
861
843
  # * `/\p{Word}/`: A member in one of these Unicode character categories (see
862
844
  # below) or having one of these Unicode properties:
863
845
  #
@@ -866,18 +848,14 @@
866
848
  # * `Decimal Number` (`Nd`)
867
849
  # * `Connector Punctuation` (`Pc`).
868
850
  #
869
- #
870
851
  # * Unicode properties:
871
852
  # * `Alpha`
872
853
  # * `Join_Control`
873
854
  #
874
- #
875
- #
876
855
  # * `/\p{ASCII}/`: A character in the ASCII character set.
877
856
  # * `/\p{Any}/`: Any Unicode character (including unassigned characters).
878
857
  # * `/\p{Assigned}/`: An assigned character.
879
858
  #
880
- #
881
859
  # #### Unicode Character Categories
882
860
  #
883
861
  # A Unicode character category name:
@@ -886,7 +864,6 @@
886
864
  # * Is case-insensitive.
887
865
  # * Treats a space, a hyphen, and an underscore as equivalent.
888
866
  #
889
- #
890
867
  # Examples:
891
868
  #
892
869
  # /\p{lu}/ # => /\p{lu}/
@@ -908,7 +885,6 @@
908
885
  # * [Lu, Titlecase_Letter](https://www.compart.com/en/unicode/category/Lt).
909
886
  # * [Lu, Uppercase_Letter](https://www.compart.com/en/unicode/category/Lu).
910
887
  #
911
- #
912
888
  # Marks:
913
889
  #
914
890
  # * `M`, `Mark`: `Mc`, `Me`, or `Mn`.
@@ -916,7 +892,6 @@
916
892
  # * [Me, Enclosing_Mark](https://www.compart.com/en/unicode/category/Me).
917
893
  # * [Mn, Nonapacing_Mark](https://www.compart.com/en/unicode/category/Mn).
918
894
  #
919
- #
920
895
  # Numbers:
921
896
  #
922
897
  # * `N`, `Number`: `Nd`, `Nl`, or `No`.
@@ -924,8 +899,7 @@
924
899
  # * [Nl, Letter_Number](https://www.compart.com/en/unicode/category/Nl).
925
900
  # * [No, Other_Number](https://www.compart.com/en/unicode/category/No).
926
901
  #
927
- #
928
- # Punctation:
902
+ # Punctuation:
929
903
  #
930
904
  # * `P`, `Punctuation`: `Pc`, `Pd`, `Pe`, `Pf`, `Pi`, `Po`, or `Ps`.
931
905
  # * [Pc,
@@ -955,7 +929,6 @@
955
929
  # * [Co, Private_Use](https://www.compart.com/en/unicode/category/Co).
956
930
  # * [Cs, Surrogate](https://www.compart.com/en/unicode/category/Cs).
957
931
  #
958
- #
959
932
  # #### Unicode Scripts and Blocks
960
933
  #
961
934
  # Among the Unicode properties are:
@@ -965,7 +938,6 @@
965
938
  # * [Unicode blocks](https://en.wikipedia.org/wiki/Unicode_block); see
966
939
  # [supported blocks](http://www.unicode.org/Public/UNIDATA/Blocks.txt).
967
940
  #
968
- #
969
941
  # ### POSIX Bracket Expressions
970
942
  #
971
943
  # A POSIX *bracket expression* is also similar to a character class. These
@@ -976,7 +948,6 @@
976
948
  # * `/[[:digit:]]/` matches any character in the Unicode `Decimal Number`
977
949
  # (`Nd`) category; see below.
978
950
  #
979
- #
980
951
  # The POSIX bracket expressions:
981
952
  #
982
953
  # * `/[[:digit:]]/`: Matches a [Unicode
@@ -1030,7 +1001,6 @@
1030
1001
  # * `/[[:punct:]]/`: Matches any (Unicode punctuation
1031
1002
  # character}[https://www.compart.com/en/unicode/category/Po]:
1032
1003
  #
1033
- #
1034
1004
  # Ruby also supports these (non-POSIX) bracket expressions:
1035
1005
  #
1036
1006
  # * `/[[:ascii:]]/`: Matches a character in the ASCII character set.
@@ -1042,14 +1012,10 @@
1042
1012
  # * `Decimal Number` (`Nd`)
1043
1013
  # * `Connector Punctuation` (`Pc`).
1044
1014
  #
1045
- #
1046
1015
  # * Unicode properties:
1047
1016
  # * `Alpha`
1048
1017
  # * `Join_Control`
1049
1018
  #
1050
- #
1051
- #
1052
- #
1053
1019
  # ### Comments
1054
1020
  #
1055
1021
  # A comment may be included in a regexp pattern using the `(?#`*comment*`)`
@@ -1073,7 +1039,6 @@
1073
1039
  # * `o`: `/*pattern*/o` sets [Interpolation
1074
1040
  # Mode](rdoc-ref:Regexp@Interpolation+Mode).
1075
1041
  #
1076
- #
1077
1042
  # Any, all, or none of these may be applied.
1078
1043
  #
1079
1044
  # Modifiers `i`, `m`, and `x` may be applied to subexpressions:
@@ -1084,7 +1049,6 @@
1084
1049
  # * `(?-*modifier*:*subexp*)` turns the mode "off" for *subexp* within the
1085
1050
  # group
1086
1051
  #
1087
- #
1088
1052
  # Example:
1089
1053
  #
1090
1054
  # re = /(?i)te(?-i)st/
@@ -1126,7 +1090,6 @@
1126
1090
  #
1127
1091
  # /a.c/m.match("a\nc") # => #<MatchData "a\nc">
1128
1092
  #
1129
- #
1130
1093
  # Unlike other languages, the modifier `m` does not affect the anchors `^` and
1131
1094
  # `$`. These anchors always match at line-boundaries in Ruby.
1132
1095
  #
@@ -1138,7 +1101,6 @@
1138
1101
  # * Character `#` marks the remainder of its containing line as a comment,
1139
1102
  # which is also to be ignored for matching purposes.
1140
1103
  #
1141
- #
1142
1104
  # In extended mode, whitespace and comments may be used to form a
1143
1105
  # self-documented regexp.
1144
1106
  #
@@ -1219,7 +1181,6 @@
1219
1181
  #
1220
1182
  # /foo/s.encoding # => #<Encoding:Windows-31J>
1221
1183
  #
1222
- #
1223
1184
  # A regexp can be matched against a target string when either:
1224
1185
  #
1225
1186
  # * They have the same encoding.
@@ -1227,7 +1188,6 @@
1227
1188
  # ASCII characters. Method Regexp#fixed_encoding? returns whether the regexp
1228
1189
  # has a *fixed* encoding.
1229
1190
  #
1230
- #
1231
1191
  # If a match between incompatible encodings is attempted an
1232
1192
  # `Encoding::CompatibilityError` exception is raised.
1233
1193
  #
@@ -1270,7 +1230,6 @@
1270
1230
  # re = Regexp.new('foo', timeout: 5.0)
1271
1231
  # re.timeout # => 5.0
1272
1232
  #
1273
- #
1274
1233
  # When regexp.timeout is `nil`, the timeout "falls through" to Regexp.timeout;
1275
1234
  # when regexp.timeout is non-`nil`, that value controls timing out:
1276
1235
  #
@@ -1300,7 +1259,6 @@
1300
1259
  # * No nested quantifiers with counting (i.e. no nested `{n}`, `{min,}`,
1301
1260
  # `{,max}`, or `{min,max}` style quantifiers)
1302
1261
  #
1303
- #
1304
1262
  # You can use method Regexp.linear_time? to determine whether a pattern meets
1305
1263
  # these criteria:
1306
1264
  #
@@ -1326,7 +1284,6 @@
1326
1284
  # ming%20Languages%20%282nd%20ed.%29%20%5BGoyvaerts%20%26%20Levithan%202012-
1327
1285
  # 09-06%5D.pdf) by Jan Goyvaerts & Steven Levithan.
1328
1286
  #
1329
- #
1330
1287
  # Explore, test (interactive online editor):
1331
1288
  #
1332
1289
  # * [Rubular](https://rubular.com/).
@@ -1398,7 +1355,7 @@ class Regexp
1398
1355
  # - Regexp.last_match(n) -> string or nil
1399
1356
  # - Regexp.last_match(name) -> string or nil
1400
1357
  # -->
1401
- # With no argument, returns the value of `$!`, which is the result of the most
1358
+ # With no argument, returns the value of `$~`, which is the result of the most
1402
1359
  # recent pattern match (see [Regexp global
1403
1360
  # variables](rdoc-ref:Regexp@Global+Variables)):
1404
1361
  #
@@ -1580,7 +1537,6 @@ class Regexp
1580
1537
  # * `nil` or `false`, which is ignored.
1581
1538
  # * Any other truthy value, in which case the regexp will be case-insensitive.
1582
1539
  #
1583
- #
1584
1540
  # If optional keyword argument `timeout` is given, its float value overrides the
1585
1541
  # timeout interval for the class, Regexp.timeout. If `nil` is passed as
1586
1542
  # +timeout, it uses the timeout interval for the class, Regexp.timeout.
@@ -1649,12 +1605,11 @@ class Regexp
1649
1605
  # `self`:
1650
1606
  #
1651
1607
  # * Is a regexp literal; see [Regexp
1652
- # Literals](rdoc-ref:literals.rdoc@Regexp+Literals).
1608
+ # Literals](rdoc-ref:syntax/literals.rdoc@Regexp+Literals).
1653
1609
  # * Does not contain interpolations; see [Regexp
1654
1610
  # interpolation](rdoc-ref:Regexp@Interpolation+Mode).
1655
1611
  # * Is at the left of the expression.
1656
1612
  #
1657
- #
1658
1613
  # Example:
1659
1614
  #
1660
1615
  # /(?<lhs>\w+)\s*=\s*(?<rhs>\w+)/ =~ ' x = y '
@@ -1843,7 +1798,6 @@ class Regexp
1843
1798
  # * Each key is the name of a named capture.
1844
1799
  # * Each value is an array of integer indexes for that named capture.
1845
1800
  #
1846
- #
1847
1801
  # Examples:
1848
1802
  #
1849
1803
  # /(?<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::Node#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,12 +79,13 @@
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
90
85
  #
91
- # See [LICENSE.txt](rdoc-ref:lib/rubygems/LICENSE.txt) for permissions.
86
+ # See
87
+ # [LICENSE.txt](https://github.com/rubygems/rubygems/blob/master/LICENSE.txt)
88
+ # for permissions.
92
89
  #
93
90
  # Thanks!
94
91
  #
@@ -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,12 +79,13 @@
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
90
85
  #
91
- # See [LICENSE.txt](rdoc-ref:lib/rubygems/LICENSE.txt) for permissions.
86
+ # See
87
+ # [LICENSE.txt](https://github.com/rubygems/rubygems/blob/master/LICENSE.txt)
88
+ # for permissions.
92
89
  #
93
90
  # Thanks!
94
91
  #