rbs 3.10.2 → 4.0.0.dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +2 -2
  3. data/.github/workflows/ruby.yml +24 -34
  4. data/.github/workflows/typecheck.yml +3 -1
  5. data/.github/workflows/windows.yml +2 -2
  6. data/.gitignore +0 -4
  7. data/CHANGELOG.md +0 -107
  8. data/README.md +1 -38
  9. data/Rakefile +20 -142
  10. data/Steepfile +1 -0
  11. data/config.yml +43 -1
  12. data/core/array.rbs +46 -96
  13. data/core/comparable.rbs +6 -13
  14. data/core/complex.rbs +25 -40
  15. data/core/dir.rbs +4 -4
  16. data/core/encoding.rbs +9 -6
  17. data/core/enumerable.rbs +3 -90
  18. data/core/enumerator.rbs +1 -43
  19. data/core/errno.rbs +0 -8
  20. data/core/errors.rbs +1 -28
  21. data/core/exception.rbs +2 -2
  22. data/core/fiber.rbs +20 -29
  23. data/core/file.rbs +19 -49
  24. data/core/file_test.rbs +1 -1
  25. data/core/float.rbs +33 -224
  26. data/core/gc.rbs +281 -417
  27. data/core/hash.rbs +727 -1023
  28. data/core/integer.rbs +63 -104
  29. data/core/io/buffer.rbs +10 -21
  30. data/core/io/wait.rbs +33 -11
  31. data/core/io.rbs +12 -14
  32. data/core/kernel.rbs +51 -61
  33. data/core/marshal.rbs +1 -1
  34. data/core/match_data.rbs +1 -1
  35. data/core/math.rbs +3 -42
  36. data/core/method.rbs +25 -63
  37. data/core/module.rbs +23 -101
  38. data/core/nil_class.rbs +3 -3
  39. data/core/numeric.rbs +17 -25
  40. data/core/object.rbs +3 -3
  41. data/core/object_space.rbs +15 -21
  42. data/core/proc.rbs +24 -30
  43. data/core/process.rbs +2 -2
  44. data/core/ractor.rbs +509 -361
  45. data/core/range.rbs +8 -7
  46. data/core/rational.rbs +34 -56
  47. data/core/rbs/unnamed/argf.rbs +2 -2
  48. data/core/rbs/unnamed/env_class.rbs +1 -1
  49. data/core/rbs/unnamed/random.rbs +2 -4
  50. data/core/regexp.rbs +20 -25
  51. data/core/ruby_vm.rbs +4 -6
  52. data/core/rubygems/errors.rbs +70 -3
  53. data/core/rubygems/rubygems.rbs +79 -11
  54. data/core/rubygems/version.rbs +3 -2
  55. data/core/set.rbs +359 -488
  56. data/core/signal.rbs +14 -24
  57. data/core/string.rbs +1236 -3165
  58. data/core/struct.rbs +1 -1
  59. data/core/symbol.rbs +11 -17
  60. data/core/thread.rbs +33 -95
  61. data/core/time.rbs +9 -35
  62. data/core/trace_point.rbs +4 -7
  63. data/core/unbound_method.rbs +6 -14
  64. data/docs/collection.md +2 -2
  65. data/docs/gem.md +1 -0
  66. data/docs/sigs.md +3 -3
  67. data/ext/rbs_extension/ast_translation.c +1077 -944
  68. data/ext/rbs_extension/ast_translation.h +0 -7
  69. data/ext/rbs_extension/class_constants.c +83 -71
  70. data/ext/rbs_extension/class_constants.h +7 -4
  71. data/ext/rbs_extension/extconf.rb +2 -24
  72. data/ext/rbs_extension/legacy_location.c +172 -173
  73. data/ext/rbs_extension/legacy_location.h +3 -8
  74. data/ext/rbs_extension/main.c +289 -239
  75. data/ext/rbs_extension/rbs_extension.h +0 -3
  76. data/ext/rbs_extension/rbs_string_bridging.h +0 -4
  77. data/include/rbs/ast.h +98 -37
  78. data/include/rbs/defines.h +12 -38
  79. data/include/rbs/lexer.h +114 -126
  80. data/include/rbs/location.h +14 -14
  81. data/include/rbs/parser.h +37 -21
  82. data/include/rbs/string.h +5 -3
  83. data/include/rbs/util/rbs_allocator.h +19 -40
  84. data/include/rbs/util/rbs_assert.h +1 -12
  85. data/include/rbs/util/rbs_constant_pool.h +3 -3
  86. data/include/rbs/util/rbs_encoding.h +1 -3
  87. data/include/rbs/util/rbs_unescape.h +1 -2
  88. data/lib/rbs/ast/ruby/annotations.rb +119 -0
  89. data/lib/rbs/ast/ruby/comment_block.rb +221 -0
  90. data/lib/rbs/ast/ruby/declarations.rb +86 -0
  91. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +24 -0
  92. data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
  93. data/lib/rbs/ast/ruby/members.rb +213 -0
  94. data/lib/rbs/buffer.rb +104 -24
  95. data/lib/rbs/cli/validate.rb +40 -35
  96. data/lib/rbs/cli.rb +5 -6
  97. data/lib/rbs/collection/config/lockfile_generator.rb +0 -8
  98. data/lib/rbs/collection.rb +0 -1
  99. data/lib/rbs/definition.rb +6 -1
  100. data/lib/rbs/definition_builder/ancestor_builder.rb +65 -62
  101. data/lib/rbs/definition_builder/method_builder.rb +45 -30
  102. data/lib/rbs/definition_builder.rb +44 -9
  103. data/lib/rbs/environment/class_entry.rb +69 -0
  104. data/lib/rbs/environment/module_entry.rb +66 -0
  105. data/lib/rbs/environment.rb +244 -218
  106. data/lib/rbs/environment_loader.rb +8 -2
  107. data/lib/rbs/errors.rb +5 -4
  108. data/lib/rbs/inline_parser/comment_association.rb +117 -0
  109. data/lib/rbs/inline_parser.rb +206 -0
  110. data/lib/rbs/location_aux.rb +35 -3
  111. data/lib/rbs/parser_aux.rb +11 -6
  112. data/lib/rbs/prototype/runtime.rb +2 -2
  113. data/lib/rbs/resolver/constant_resolver.rb +2 -2
  114. data/lib/rbs/resolver/type_name_resolver.rb +38 -124
  115. data/lib/rbs/source.rb +99 -0
  116. data/lib/rbs/subtractor.rb +5 -6
  117. data/lib/rbs/test/type_check.rb +0 -14
  118. data/lib/rbs/types.rb +1 -3
  119. data/lib/rbs/version.rb +1 -1
  120. data/lib/rbs.rb +13 -1
  121. data/lib/rdoc/discover.rb +1 -1
  122. data/lib/rdoc_plugin/parser.rb +1 -1
  123. data/rbs.gemspec +1 -0
  124. data/sig/ancestor_builder.rbs +1 -1
  125. data/sig/ast/ruby/annotations.rbs +110 -0
  126. data/sig/ast/ruby/comment_block.rbs +119 -0
  127. data/sig/ast/ruby/declarations.rbs +60 -0
  128. data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
  129. data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
  130. data/sig/ast/ruby/members.rbs +72 -0
  131. data/sig/buffer.rbs +63 -5
  132. data/sig/definition.rbs +1 -0
  133. data/sig/definition_builder.rbs +1 -1
  134. data/sig/environment/class_entry.rbs +50 -0
  135. data/sig/environment/module_entry.rbs +50 -0
  136. data/sig/environment.rbs +28 -133
  137. data/sig/errors.rbs +13 -6
  138. data/sig/inline_parser/comment_association.rbs +71 -0
  139. data/sig/inline_parser.rbs +87 -0
  140. data/sig/location.rbs +32 -7
  141. data/sig/manifest.yaml +1 -0
  142. data/sig/method_builder.rbs +7 -4
  143. data/sig/parser.rbs +16 -20
  144. data/sig/resolver/type_name_resolver.rbs +7 -38
  145. data/sig/source.rbs +48 -0
  146. data/sig/types.rbs +1 -4
  147. data/src/ast.c +290 -201
  148. data/src/lexer.c +2813 -2902
  149. data/src/lexer.re +4 -0
  150. data/src/lexstate.c +155 -169
  151. data/src/location.c +40 -40
  152. data/src/parser.c +2665 -2433
  153. data/src/string.c +48 -0
  154. data/src/util/rbs_allocator.c +76 -92
  155. data/src/util/rbs_assert.c +10 -10
  156. data/src/util/rbs_buffer.c +2 -2
  157. data/src/util/rbs_constant_pool.c +15 -13
  158. data/src/util/rbs_encoding.c +4062 -20097
  159. data/src/util/rbs_unescape.c +48 -85
  160. data/stdlib/bigdecimal/0/big_decimal.rbs +82 -100
  161. data/stdlib/bigdecimal-math/0/big_math.rbs +8 -169
  162. data/stdlib/cgi/0/core.rbs +393 -9
  163. data/stdlib/cgi/0/manifest.yaml +0 -1
  164. data/stdlib/coverage/0/coverage.rbs +1 -3
  165. data/stdlib/date/0/date.rbs +59 -67
  166. data/stdlib/date/0/date_time.rbs +1 -1
  167. data/stdlib/delegate/0/delegator.rbs +7 -10
  168. data/stdlib/erb/0/erb.rbs +347 -737
  169. data/stdlib/fileutils/0/fileutils.rbs +13 -18
  170. data/stdlib/forwardable/0/forwardable.rbs +0 -3
  171. data/stdlib/json/0/json.rbs +48 -68
  172. data/stdlib/net-http/0/net-http.rbs +0 -3
  173. data/stdlib/objspace/0/objspace.rbs +4 -9
  174. data/stdlib/open-uri/0/open-uri.rbs +0 -40
  175. data/stdlib/openssl/0/openssl.rbs +228 -331
  176. data/stdlib/optparse/0/optparse.rbs +3 -3
  177. data/stdlib/pathname/0/pathname.rbs +1380 -10
  178. data/stdlib/psych/0/psych.rbs +3 -3
  179. data/stdlib/rdoc/0/rdoc.rbs +1 -1
  180. data/stdlib/resolv/0/resolv.rbs +68 -25
  181. data/stdlib/ripper/0/ripper.rbs +2 -5
  182. data/stdlib/singleton/0/singleton.rbs +0 -3
  183. data/stdlib/socket/0/socket.rbs +1 -13
  184. data/stdlib/socket/0/tcp_socket.rbs +2 -10
  185. data/stdlib/stringio/0/stringio.rbs +85 -1176
  186. data/stdlib/strscan/0/string_scanner.rbs +31 -31
  187. data/stdlib/tempfile/0/tempfile.rbs +3 -3
  188. data/stdlib/time/0/time.rbs +1 -1
  189. data/stdlib/timeout/0/timeout.rbs +7 -63
  190. data/stdlib/tsort/0/cyclic.rbs +0 -3
  191. data/stdlib/uri/0/common.rbs +2 -11
  192. data/stdlib/uri/0/file.rbs +1 -1
  193. data/stdlib/uri/0/generic.rbs +16 -17
  194. data/stdlib/uri/0/rfc2396_parser.rbs +7 -6
  195. data/stdlib/zlib/0/zstream.rbs +0 -1
  196. metadata +39 -12
  197. data/.clang-format +0 -74
  198. data/.clangd +0 -2
  199. data/.github/workflows/c-check.yml +0 -54
  200. data/core/pathname.rbs +0 -1272
  201. data/core/ruby.rbs +0 -53
  202. data/docs/aliases.md +0 -79
  203. data/docs/encoding.md +0 -56
  204. data/ext/rbs_extension/compat.h +0 -10
  205. data/stdlib/cgi-escape/0/escape.rbs +0 -171
data/core/kernel.rbs CHANGED
@@ -80,7 +80,7 @@
80
80
  # * #print: Prints the given objects to standard output without a newline.
81
81
  # * #printf: Prints the string resulting from applying the given format string
82
82
  # to any additional arguments.
83
- # * #putc: Equivalent to `$stdout.putc(object)` for the given object.
83
+ # * #putc: Equivalent to <tt.$stdout.putc(object)</tt> for the given object.
84
84
  # * #puts: Equivalent to `$stdout.puts(*objects)` for the given objects.
85
85
  # * #readline: Similar to #gets, but raises an exception at the end of file.
86
86
  # * #readlines: Returns an array of the remaining lines from the current
@@ -718,14 +718,14 @@ module Kernel : BasicObject
718
718
  # variable `$?` to the process status.
719
719
  #
720
720
  # This method has potential security vulnerabilities if called with untrusted
721
- # input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
721
+ # input; see [Command Injection](rdoc-ref:command_injection.rdoc).
722
722
  #
723
723
  # Examples:
724
724
  #
725
725
  # $ `date` # => "Wed Apr 9 08:56:30 CDT 2003\n"
726
726
  # $ `echo oops && exit 99` # => "oops\n"
727
727
  # $ $? # => #<Process::Status: pid 17088 exit 99>
728
- # $ $?.exitstatus # => 99
728
+ # $ $?.status # => 99>
729
729
  #
730
730
  # The built-in syntax `%x{...}` uses this method.
731
731
  #
@@ -777,8 +777,6 @@ module Kernel : BasicObject
777
777
  # If *const* is defined as autoload, the file name to be loaded is replaced with
778
778
  # *filename*. If *const* is defined but not as autoload, does nothing.
779
779
  #
780
- # Files that are currently being loaded must not be registered for autoload.
781
- #
782
780
  def self?.autoload: (interned _module, String filename) -> NilClass
783
781
 
784
782
  # <!--
@@ -1004,8 +1002,6 @@ module Kernel : BasicObject
1004
1002
  # With argument `exception` not given, argument `message` and keyword argument
1005
1003
  # `cause` may be given, but argument `backtrace` may not be given.
1006
1004
  #
1007
- # `cause` can not be given as an only argument.
1008
- #
1009
1005
  def self?.fail: () -> bot
1010
1006
  | (string message, ?cause: Exception?) -> bot
1011
1007
  | (_Exception exception, ?_ToS? message, ?String | Array[String] | Array[Thread::Backtrace::Location] | nil backtrace, ?cause: Exception?) -> bot
@@ -1112,8 +1108,6 @@ module Kernel : BasicObject
1112
1108
  # With argument `exception` not given, argument `message` and keyword argument
1113
1109
  # `cause` may be given, but argument `backtrace` may not be given.
1114
1110
  #
1115
- # `cause` can not be given as an only argument.
1116
- #
1117
1111
  alias raise fail
1118
1112
 
1119
1113
  alias self.raise self.fail
@@ -1122,7 +1116,7 @@ module Kernel : BasicObject
1122
1116
  # Returns the string resulting from formatting `objects` into `format_string`.
1123
1117
  #
1124
1118
  # For details on `format_string`, see [Format
1125
- # Specifications](rdoc-ref:language/format_specifications.rdoc).
1119
+ # Specifications](rdoc-ref:format_specifications.rdoc).
1126
1120
  #
1127
1121
  def self?.format: (String format, *untyped args) -> String
1128
1122
 
@@ -1133,7 +1127,7 @@ module Kernel : BasicObject
1133
1127
  # Returns the string resulting from formatting `objects` into `format_string`.
1134
1128
  #
1135
1129
  # For details on `format_string`, see [Format
1136
- # Specifications](rdoc-ref:language/format_specifications.rdoc).
1130
+ # Specifications](rdoc-ref:format_specifications.rdoc).
1137
1131
  #
1138
1132
  alias sprintf format
1139
1133
 
@@ -1224,7 +1218,6 @@ module Kernel : BasicObject
1224
1218
  # loop do
1225
1219
  # print "Input: "
1226
1220
  # line = gets
1227
- # # break if q, Q is entered or EOF signal (Ctrl-D on Unix, Ctrl-Z on windows) is sent
1228
1221
  # break if !line or line =~ /^q/i
1229
1222
  # # ...
1230
1223
  # end
@@ -1253,7 +1246,7 @@ module Kernel : BasicObject
1253
1246
  # Creates an IO object connected to the given file.
1254
1247
  #
1255
1248
  # This method has potential security vulnerabilities if called with untrusted
1256
- # input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
1249
+ # input; see [Command Injection](rdoc-ref:command_injection.rdoc).
1257
1250
  #
1258
1251
  # With no block given, file stream is returned:
1259
1252
  #
@@ -1331,7 +1324,7 @@ module Kernel : BasicObject
1331
1324
  # io.write(sprintf(format_string, *objects))
1332
1325
  #
1333
1326
  # For details on `format_string`, see [Format
1334
- # Specifications](rdoc-ref:language/format_specifications.rdoc).
1327
+ # Specifications](rdoc-ref:format_specifications.rdoc).
1335
1328
  #
1336
1329
  # With the single argument `format_string`, formats `objects` into the string,
1337
1330
  # then writes the formatted string to $stdout:
@@ -1470,9 +1463,7 @@ module Kernel : BasicObject
1470
1463
  # Kernel.srand may be used to ensure that sequences of random numbers are
1471
1464
  # reproducible between different runs of a program.
1472
1465
  #
1473
- # Related: Random.rand.
1474
- # rand(100.0) # => 64 (Integer because max.to_i is 100)
1475
- # Random.rand(100.0) # => 30.315320967824523
1466
+ # See also Random.rand.
1476
1467
  #
1477
1468
  def self?.rand: (?0) -> Float
1478
1469
  | (int arg0) -> Integer
@@ -1594,8 +1585,7 @@ module Kernel : BasicObject
1594
1585
  # IO objects.
1595
1586
  #
1596
1587
  # Argument `timeout` is a numeric value (such as integer or float) timeout
1597
- # interval in seconds. `timeout` can also be `nil` or `Float::INFINITY`. `nil`
1598
- # and `Float::INFINITY` means no timeout.
1588
+ # interval in seconds.
1599
1589
  #
1600
1590
  # The method monitors the IO objects given in all three arrays, waiting for some
1601
1591
  # to be ready; returns a 3-element array whose elements are:
@@ -1783,58 +1773,58 @@ module Kernel : BasicObject
1783
1773
  # * Each of these tests operates only on the entity at `path0`,
1784
1774
  # and returns `true` or `false`;
1785
1775
  # for a non-existent entity, returns `false` (does not raise exception):
1786
- # Character|Test
1787
- # ---------|-------------------------------------------------------------------
1788
- # `'b'` |Whether the entity is a block device.
1789
- # `'c'` |Whether the entity is a character device.
1790
- # `'d'` |Whether the entity is a directory.
1791
- # `'e'` |Whether the entity is an existing entity.
1792
- # `'f'` |Whether the entity is an existing regular file.
1793
- # `'g'` |Whether the entity's setgid bit is set.
1794
- # `'G'` |Whether the entity's group ownership is equal to the caller's.
1795
- # `'k'` |Whether the entity's sticky bit is set.
1796
- # `'l'` |Whether the entity is a symbolic link.
1797
- # `'o'` |Whether the entity is owned by the caller's effective uid.
1798
- # `'O'` |Like `'o'`, but uses the real uid (not the effective uid).
1799
- # `'p'` |Whether the entity is a FIFO device (named pipe).
1800
- # `'r'` |Whether the entity is readable by the caller's effective uid/gid.
1801
- # `'R'` |Like `'r'`, but uses the real uid/gid (not the effective uid/gid).
1802
- # `'S'` |Whether the entity is a socket.
1803
- # `'u'` |Whether the entity's setuid bit is set.
1804
- # `'w'` |Whether the entity is writable by the caller's effective uid/gid.
1805
- # `'W'` |Like `'w'`, but uses the real uid/gid (not the effective uid/gid).
1806
- # `'x'` |Whether the entity is executable by the caller's effective uid/gid.
1807
- # `'X'` |Like `'x'`, but uses the real uid/gid (not the effective uid/git).
1808
- # `'z'` |Whether the entity exists and is of length zero.
1776
+ # Character |Test
1777
+ # ------------|-------------------------------------------------------------------------
1778
+ # <tt>'b'</tt>|Whether the entity is a block device.
1779
+ # <tt>'c'</tt>|Whether the entity is a character device.
1780
+ # <tt>'d'</tt>|Whether the entity is a directory.
1781
+ # <tt>'e'</tt>|Whether the entity is an existing entity.
1782
+ # <tt>'f'</tt>|Whether the entity is an existing regular file.
1783
+ # <tt>'g'</tt>|Whether the entity's setgid bit is set.
1784
+ # <tt>'G'</tt>|Whether the entity's group ownership is equal to the caller's.
1785
+ # <tt>'k'</tt>|Whether the entity's sticky bit is set.
1786
+ # <tt>'l'</tt>|Whether the entity is a symbolic link.
1787
+ # <tt>'o'</tt>|Whether the entity is owned by the caller's effective uid.
1788
+ # <tt>'O'</tt>|Like <tt>'o'</tt>, but uses the real uid (not the effective uid).
1789
+ # <tt>'p'</tt>|Whether the entity is a FIFO device (named pipe).
1790
+ # <tt>'r'</tt>|Whether the entity is readable by the caller's effective uid/gid.
1791
+ # <tt>'R'</tt>|Like <tt>'r'</tt>, but uses the real uid/gid (not the effective uid/gid).
1792
+ # <tt>'S'</tt>|Whether the entity is a socket.
1793
+ # <tt>'u'</tt>|Whether the entity's setuid bit is set.
1794
+ # <tt>'w'</tt>|Whether the entity is writable by the caller's effective uid/gid.
1795
+ # <tt>'W'</tt>|Like <tt>'w'</tt>, but uses the real uid/gid (not the effective uid/gid).
1796
+ # <tt>'x'</tt>|Whether the entity is executable by the caller's effective uid/gid.
1797
+ # <tt>'X'</tt>|Like <tt>'x'</tt>, but uses the real uid/gid (not the effective uid/git).
1798
+ # <tt>'z'</tt>|Whether the entity exists and is of length zero.
1809
1799
  # * This test operates only on the entity at `path0`,
1810
1800
  # and returns an integer size or `nil`:
1811
- # Character|Test
1812
- # ---------|--------------------------------------------------------------------------------------------
1813
- # `'s'` |Returns positive integer size if the entity exists and has non-zero length, `nil` otherwise.
1801
+ # Character |Test
1802
+ # ------------|--------------------------------------------------------------------------------------------
1803
+ # <tt>'s'</tt>|Returns positive integer size if the entity exists and has non-zero length, +nil+ otherwise.
1814
1804
  # * Each of these tests operates only on the entity at `path0`,
1815
1805
  # and returns a Time object;
1816
1806
  # raises an exception if the entity does not exist:
1817
- # Character|Test
1818
- # ---------|--------------------------------------
1819
- # `'A'` |Last access time for the entity.
1820
- # `'C'` |Last change time for the entity.
1821
- # `'M'` |Last modification time for the entity.
1807
+ # Character |Test
1808
+ # ------------|--------------------------------------
1809
+ # <tt>'A'</tt>|Last access time for the entity.
1810
+ # <tt>'C'</tt>|Last change time for the entity.
1811
+ # <tt>'M'</tt>|Last modification time for the entity.
1822
1812
  # * Each of these tests operates on the modification time (`mtime`)
1823
1813
  # of each of the entities at `path0` and `path1`,
1824
1814
  # and returns a `true` or `false`;
1825
1815
  # returns `false` if either entity does not exist:
1826
- # Character|Test
1827
- # ---------|---------------------------------------------------------------
1828
- # `'<'` |Whether the `mtime` at `path0` is less than that at `path1`.
1829
- # `'='` |Whether the `mtime` at `path0` is equal to that at `path1`.
1830
- # `'>'` |Whether the `mtime` at `path0` is greater than that at `path1`.
1816
+ # Character |Test
1817
+ # ------------|---------------------------------------------------------------
1818
+ # <tt>'<'</tt>|Whether the `mtime` at `path0` is less than that at `path1`.
1819
+ # <tt>'='</tt>|Whether the `mtime` at `path0` is equal to that at `path1`.
1820
+ # <tt>'>'</tt>|Whether the `mtime` at `path0` is greater than that at `path1`.
1831
1821
  # * This test operates on the content of each of the entities at `path0` and
1832
1822
  # `path1`,
1833
1823
  # and returns a `true` or `false`;
1834
1824
  # returns `false` if either entity does not exist:
1835
- # Character|Test
1836
- # ---------|---------------------------------------------
1837
- # `'-'` |Whether the entities exist and are identical.
1825
+ # Character |Test
1826
+ # ------------|---------------------------------------------
1827
+ # <tt>'-'</tt>|Whether the entities exist and are identical.
1838
1828
  #
1839
1829
  def self?.test: (String | Integer cmd, String | IO file1, ?String | IO file2) -> (TrueClass | FalseClass | Time | nil | Integer)
1840
1830
 
@@ -1911,7 +1901,7 @@ module Kernel : BasicObject
1911
1901
  # * Invoking the executable at `exe_path`.
1912
1902
  #
1913
1903
  # This method has potential security vulnerabilities if called with untrusted
1914
- # input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
1904
+ # input; see [Command Injection](rdoc-ref:command_injection.rdoc).
1915
1905
  #
1916
1906
  # The new process is created using the [exec system
1917
1907
  # call](https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/e
@@ -2003,7 +1993,7 @@ module Kernel : BasicObject
2003
1993
  # * Invoking the executable at `exe_path`.
2004
1994
  #
2005
1995
  # This method has potential security vulnerabilities if called with untrusted
2006
- # input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
1996
+ # input; see [Command Injection](rdoc-ref:command_injection.rdoc).
2007
1997
  #
2008
1998
  # Returns the process ID (pid) of the new process, without waiting for it to
2009
1999
  # complete.
@@ -2106,7 +2096,7 @@ module Kernel : BasicObject
2106
2096
  # * Invoking the executable at `exe_path`.
2107
2097
  #
2108
2098
  # This method has potential security vulnerabilities if called with untrusted
2109
- # input; see [Command Injection](rdoc-ref:security/command_injection.rdoc).
2099
+ # input; see [Command Injection](rdoc-ref:command_injection.rdoc).
2110
2100
  #
2111
2101
  # Returns:
2112
2102
  #
data/core/marshal.rbs CHANGED
@@ -147,7 +147,7 @@ module Marshal
147
147
  # * anonymous Class/Module.
148
148
  # * objects which are related to system (ex: Dir, File::Stat, IO, File, Socket
149
149
  # and so on)
150
- # * an instance of MatchData, Method, UnboundMethod, Proc, Thread,
150
+ # * an instance of MatchData, Data, Method, UnboundMethod, Proc, Thread,
151
151
  # ThreadGroup, Continuation
152
152
  # * objects which define singleton methods
153
153
  #
data/core/match_data.rbs CHANGED
@@ -41,7 +41,7 @@
41
41
  # * `$'` is Regexp.last_match`.post_match`;
42
42
  # * `$+` is Regexp.last_match`[ -1 ]` (the last capture).
43
43
  #
44
- # See also Regexp@Global+Variables.
44
+ # See also "Special global variables" section in Regexp documentation.
45
45
  #
46
46
  class MatchData
47
47
  type capture = String | Symbol | int
data/core/math.rbs CHANGED
@@ -410,27 +410,6 @@ module Math
410
410
  #
411
411
  def self.exp: (double x) -> Float
412
412
 
413
- # <!--
414
- # rdoc-file=math.c
415
- # - Math.expm1(x) -> float
416
- # -->
417
- # Returns "exp(x) - 1", `e` raised to the `x` power, minus 1.
418
- #
419
- # * Domain: `[-INFINITY, INFINITY]`.
420
- # * Range: `[-1.0, INFINITY]`.
421
- #
422
- # Examples:
423
- #
424
- # expm1(-INFINITY) # => 0.0
425
- # expm1(-1.0) # => -0.6321205588285577 # 1.0/E - 1
426
- # expm1(0.0) # => 0.0
427
- # expm1(0.5) # => 0.6487212707001282 # sqrt(E) - 1
428
- # expm1(1.0) # => 1.718281828459045 # E - 1
429
- # expm1(2.0) # => 6.38905609893065 # E**2 - 1
430
- # expm1(INFINITY) # => Infinity
431
- #
432
- def self.expm1: (double x) -> Float
433
-
434
413
  # <!--
435
414
  # rdoc-file=math.c
436
415
  # - Math.frexp(x) -> [fraction, exponent]
@@ -546,8 +525,9 @@ module Math
546
525
  #
547
526
  # [Math.log(Math.gamma(x).abs), Math.gamma(x) < 0 ? -1 : 1]
548
527
  #
549
- # See [log gamma
550
- # function](https://en.wikipedia.org/wiki/Gamma_function#Log-gamma_function).
528
+ # See [logarithmic gamma
529
+ # function](https://en.wikipedia.org/wiki/Gamma_function#The_log-gamma_function)
530
+ # .
551
531
  #
552
532
  # * Domain: `(-INFINITY, INFINITY]`.
553
533
  # * Range of first element: `(-INFINITY, INFINITY]`.
@@ -623,25 +603,6 @@ module Math
623
603
  #
624
604
  def self.log10: (double x) -> Float
625
605
 
626
- # <!--
627
- # rdoc-file=math.c
628
- # - Math.log1p(x) -> float
629
- # -->
630
- # Returns "log(x + 1)", the base E
631
- # [logarithm](https://en.wikipedia.org/wiki/Logarithm) of (`x` + 1).
632
- #
633
- # * Domain: `[-1, INFINITY]`.
634
- # * Range: `[-INFINITY, INFINITY]`.
635
- #
636
- # Examples:
637
- #
638
- # log1p(-1.0) # => -Infinity
639
- # log1p(0.0) # => 0.0
640
- # log1p(E - 1) # => 1.0
641
- # log1p(INFINITY) # => Infinity
642
- #
643
- def self.log1p: (double x) -> Float
644
-
645
606
  # <!--
646
607
  # rdoc-file=math.c
647
608
  # - Math.log2(x) -> float
data/core/method.rbs CHANGED
@@ -1,5 +1,5 @@
1
1
  # <!-- rdoc-file=proc.c -->
2
- # `Method` objects are created by Object#method, and are associated with a
2
+ # Method objects are created by Object#method, and are associated with a
3
3
  # particular object (not just with a class). They may be used to invoke the
4
4
  # method within the object, and as a block associated with an iterator. They
5
5
  # may also be unbound from one object (creating an UnboundMethod) and bound to
@@ -126,9 +126,7 @@ class Method
126
126
 
127
127
  # <!--
128
128
  # rdoc-file=proc.c
129
- # - meth.call(args, ...) -> obj
130
- # - meth[args, ...] -> obj
131
- # - method === obj -> result_of_method
129
+ # - meth.call(args, ...) -> obj
132
130
  # -->
133
131
  # Invokes the *meth* with the specified arguments, returning the method's return
134
132
  # value.
@@ -137,32 +135,23 @@ class Method
137
135
  # m.call(3) #=> 15
138
136
  # m.call(20) #=> 32
139
137
  #
140
- # Using Method#=== allows a method object to be the target of a `when` clause in
141
- # a case statement.
142
- #
143
- # require 'prime'
144
- #
145
- # case 1373
146
- # when Prime.method(:prime?)
147
- # # ...
148
- # end
149
- #
150
138
  def call: (?) -> untyped
151
139
 
152
140
  # <!--
153
141
  # rdoc-file=proc.c
154
- # - self << g -> a_proc
142
+ # - meth << g -> a_proc
155
143
  # -->
156
- # Returns a proc that is the composition of the given `g` and this method.
157
- #
158
- # The returned proc takes a variable number of arguments. It first calls `g`
159
- # with the arguments, then calls `self` with the return value of `g`.
144
+ # Returns a proc that is the composition of this method and the given *g*. The
145
+ # returned proc takes a variable number of arguments, calls *g* with them then
146
+ # calls this method with the result.
160
147
  #
161
- # def f(ary) = ary << 'in f'
148
+ # def f(x)
149
+ # x * x
150
+ # end
162
151
  #
163
152
  # f = self.method(:f)
164
- # g = proc { |ary| ary << 'in proc' }
165
- # (f << g).call([]) # => ["in proc", "in f"]
153
+ # g = proc {|x| x + x }
154
+ # p (f << g).call(2) #=> 16
166
155
  #
167
156
  def <<: (Proc::_Callable g) -> Proc
168
157
 
@@ -174,32 +163,23 @@ class Method
174
163
  # m.call(3) #=> 15
175
164
  # m.call(20) #=> 32
176
165
  #
177
- # Using Method#=== allows a method object to be the target of a `when` clause in
178
- # a case statement.
179
- #
180
- # require 'prime'
181
- #
182
- # case 1373
183
- # when Prime.method(:prime?)
184
- # # ...
185
- # end
186
- #
187
166
  alias === call
188
167
 
189
168
  # <!--
190
169
  # rdoc-file=proc.c
191
- # - self >> g -> a_proc
170
+ # - meth >> g -> a_proc
192
171
  # -->
193
- # Returns a proc that is the composition of this method and the given `g`.
194
- #
195
- # The returned proc takes a variable number of arguments. It first calls `self`
196
- # with the arguments, then calls `g` with the return value of `self`.
172
+ # Returns a proc that is the composition of this method and the given *g*. The
173
+ # returned proc takes a variable number of arguments, calls this method with
174
+ # them then calls *g* with the result.
197
175
  #
198
- # def f(ary) = ary << 'in f'
176
+ # def f(x)
177
+ # x * x
178
+ # end
199
179
  #
200
180
  # f = self.method(:f)
201
- # g = proc { |ary| ary << 'in proc' }
202
- # (f >> g).call([]) # => ["in f", "in proc"]
181
+ # g = proc {|x| x + x }
182
+ # p (f >> g).call(2) #=> 8
203
183
  #
204
184
  def >>: (Proc::_Callable g) -> Proc
205
185
 
@@ -211,16 +191,6 @@ class Method
211
191
  # m.call(3) #=> 15
212
192
  # m.call(20) #=> 32
213
193
  #
214
- # Using Method#=== allows a method object to be the target of a `when` clause in
215
- # a case statement.
216
- #
217
- # require 'prime'
218
- #
219
- # case 1373
220
- # when Prime.method(:prime?)
221
- # # ...
222
- # end
223
- #
224
194
  alias [] call
225
195
 
226
196
  # <!--
@@ -389,18 +359,10 @@ class Method
389
359
 
390
360
  # <!--
391
361
  # rdoc-file=proc.c
392
- # - meth.source_location -> [String, Integer, Integer, Integer, Integer]
362
+ # - meth.source_location -> [String, Integer]
393
363
  # -->
394
- # Returns the location where the method was defined. The returned Array
395
- # contains:
396
- # (1) the Ruby source filename
397
- # (2) the line number where the definition starts
398
- # (3) the column number where the definition starts
399
- # (4) the line number where the definition ends
400
- # (5) the column number where the definitions ends
401
- #
402
- # This method will return `nil` if the method was not defined in Ruby (i.e.
403
- # native).
364
+ # Returns the Ruby source filename and line number containing this method or nil
365
+ # if this method was not defined in Ruby (i.e. native).
404
366
  #
405
367
  def source_location: () -> [String, Integer]?
406
368
 
@@ -408,8 +370,8 @@ class Method
408
370
  # rdoc-file=proc.c
409
371
  # - meth.super_method -> method
410
372
  # -->
411
- # Returns a `Method` of superclass which would be called when super is used or
412
- # nil if there is no method on superclass.
373
+ # Returns a Method of superclass which would be called when super is used or nil
374
+ # if there is no method on superclass.
413
375
  #
414
376
  def super_method: () -> Method?
415
377
 
data/core/module.rbs CHANGED
@@ -114,15 +114,12 @@ class Module < Object
114
114
 
115
115
  # <!--
116
116
  # rdoc-file=object.c
117
- # - self < other -> true, false, or nil
117
+ # - mod < other -> true, false, or nil
118
118
  # -->
119
- # Returns whether `self` is a subclass of `other`, or `nil` if there is no
120
- # relationship between the two:
121
- #
122
- # Float < Numeric # => true
123
- # Numeric < Float # => false
124
- # Float < Float # => false
125
- # Float < Hash # => nil
119
+ # Returns true if *mod* is a subclass of *other*. Returns `false` if *mod* is
120
+ # the same as *other* or *mod* is an ancestor of *other*. Returns `nil` if
121
+ # there's no relationship between the two. (Think of the relationship in terms
122
+ # of the class definition: "class A < B" implies "A < B".)
126
123
  #
127
124
  def <: (Module other) -> bool?
128
125
 
@@ -138,29 +135,14 @@ class Module < Object
138
135
 
139
136
  # <!--
140
137
  # rdoc-file=object.c
141
- # - self <=> other -> -1, 0, 1, or nil
138
+ # - module <=> other_module -> -1, 0, +1, or nil
142
139
  # -->
143
- # Compares `self` and `other`.
144
- #
145
- # Returns:
146
- #
147
- # * `-1`, if `self` includes `other`, if or `self` is a subclass of `other`.
148
- # * `0`, if `self` and `other` are the same.
149
- # * `1`, if `other` includes `self`, or if `other` is a subclass of `self`.
150
- # * `nil`, if none of the above is true.
151
- #
152
- # Examples:
140
+ # Comparison---Returns -1, 0, +1 or nil depending on whether `module` includes
141
+ # `other_module`, they are the same, or if `module` is included by
142
+ # `other_module`.
153
143
  #
154
- # # Class Array includes module Enumerable.
155
- # Array <=> Enumerable # => -1
156
- # Enumerable <=> Enumerable # => 0
157
- # Enumerable <=> Array # => 1
158
- # # Class File is a subclass of class IO.
159
- # File <=> IO # => -1
160
- # File <=> File # => 0
161
- # IO <=> File # => 1
162
- # # Class File has no relationship to class String.
163
- # File <=> String # => nil
144
+ # Returns `nil` if `module` has no relationship with `other_module`, if
145
+ # `other_module` is not a module, or if the two values are incomparable.
164
146
  #
165
147
  def <=>: (untyped other) -> Integer?
166
148
 
@@ -346,8 +328,6 @@ class Module < Object
346
328
  # replaced with *filename*. If *const* is defined but not as autoload, does
347
329
  # nothing.
348
330
  #
349
- # Files that are currently being loaded must not be registered for autoload.
350
- #
351
331
  def autoload: (interned _module, String filename) -> NilClass
352
332
 
353
333
  # <!--
@@ -507,31 +487,6 @@ class Module < Object
507
487
  #
508
488
  # Added :FOO
509
489
  #
510
- # If we define a class using the `class` keyword, `const_added` runs before
511
- # `inherited`:
512
- #
513
- # module M
514
- # def self.const_added(const_name)
515
- # super
516
- # p :const_added
517
- # end
518
- #
519
- # parent = Class.new do
520
- # def self.inherited(subclass)
521
- # super
522
- # p :inherited
523
- # end
524
- # end
525
- #
526
- # class Child < parent
527
- # end
528
- # end
529
- #
530
- # *produces:*
531
- #
532
- # :const_added
533
- # :inherited
534
- #
535
490
  def const_added: (Symbol) -> void
536
491
 
537
492
  # <!--
@@ -1366,52 +1321,19 @@ class Module < Object
1366
1321
  # - protected(method_name, method_name, ...) -> array
1367
1322
  # - protected(array) -> array
1368
1323
  # -->
1369
- # Sets the visibility of a section or of a list of method names as protected.
1370
- # Accepts no arguments, a splat of method names (symbols or strings) or an array
1371
- # of method names. Returns the arguments that it received.
1372
- #
1373
- # ## Important difference between protected in other languages
1374
- #
1375
- # Protected methods in Ruby are different from other languages such as Java,
1376
- # where methods are marked as protected to give access to subclasses. In Ruby,
1377
- # subclasses **already have access to all methods defined in the parent class**,
1378
- # even private ones.
1379
- #
1380
- # Marking a method as protected allows **different objects of the same class**
1381
- # to call it.
1382
- #
1383
- # One use case is for comparison methods, such as `==`, if we want to expose a
1384
- # method for comparison between objects of the same class without making the
1385
- # method public to objects of other classes.
1386
- #
1387
- # ## Performance considerations
1388
- #
1389
- # Protected methods are slower than others because they can't use inline cache.
1390
- #
1391
- # ## Example
1392
- #
1393
- # class Account
1394
- # # Mark balance as protected, so that we can compare between accounts
1395
- # # without making it public.
1396
- # attr_reader :balance
1397
- # protected :balance
1398
- #
1399
- # def initialize(balance)
1400
- # @balance = balance
1401
- # end
1402
- #
1403
- # def >(other)
1404
- # # The invocation to `other.balance` is allowed because `other` is a
1405
- # # different object of the same class (Account).
1406
- # balance > other.balance
1407
- # end
1408
- # end
1324
+ # With no arguments, sets the default visibility for subsequently defined
1325
+ # methods to protected. With arguments, sets the named methods to have protected
1326
+ # visibility. String arguments are converted to symbols. An Array of Symbols
1327
+ # and/or Strings is also accepted. If a single argument is passed, it is
1328
+ # returned. If no argument is passed, nil is returned. If multiple arguments are
1329
+ # passed, the arguments are returned as an array.
1409
1330
  #
1410
- # account1 = Account.new(100)
1411
- # account2 = Account.new(50)
1331
+ # If a method has protected visibility, it is callable only where `self` of the
1332
+ # context is the same as the method. (method definition or instance_eval). This
1333
+ # behavior is different from Java's protected method. Usually `private` should
1334
+ # be used.
1412
1335
  #
1413
- # account1 > account2 # => true (works)
1414
- # account1.balance # => NoMethodError (fails because balance is not public)
1336
+ # Note that a protected method is slow because it can't use inline cache.
1415
1337
  #
1416
1338
  # To show a private method on RDoc, use `:doc:` instead of this.
1417
1339
  #
@@ -1656,7 +1578,7 @@ class Module < Object
1656
1578
  # m.name #=> nil
1657
1579
  #
1658
1580
  # c = Class.new
1659
- # c.set_temporary_name("MyClass(with description)") # => MyClass(with description)
1581
+ # c.set_temporary_name("MyClass(with description)")
1660
1582
  #
1661
1583
  # c.new # => #<MyClass(with description):0x0....>
1662
1584
  #