rbs 3.10.4 → 4.0.0

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 (267) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +14 -14
  3. data/.github/workflows/bundle-update.yml +60 -0
  4. data/.github/workflows/c-check.yml +7 -5
  5. data/.github/workflows/comments.yml +2 -2
  6. data/.github/workflows/dependabot.yml +2 -2
  7. data/.github/workflows/ruby.yml +16 -26
  8. data/.github/workflows/rust.yml +95 -0
  9. data/.github/workflows/typecheck.yml +1 -1
  10. data/.github/workflows/windows.yml +2 -2
  11. data/.rubocop.yml +2 -2
  12. data/.vscode/extensions.json +5 -0
  13. data/.vscode/settings.json +19 -0
  14. data/CHANGELOG.md +202 -2
  15. data/Rakefile +9 -23
  16. data/Steepfile +2 -0
  17. data/config.yml +457 -13
  18. data/core/array.rbs +218 -188
  19. data/core/basic_object.rbs +9 -8
  20. data/core/binding.rbs +0 -2
  21. data/core/builtin.rbs +2 -2
  22. data/core/class.rbs +6 -5
  23. data/core/comparable.rbs +45 -31
  24. data/core/complex.rbs +66 -55
  25. data/core/dir.rbs +57 -45
  26. data/core/encoding.rbs +6 -6
  27. data/core/enumerable.rbs +105 -91
  28. data/core/enumerator/arithmetic_sequence.rbs +70 -0
  29. data/core/enumerator.rbs +24 -3
  30. data/core/errno.rbs +3 -2
  31. data/core/errors.rbs +31 -29
  32. data/core/exception.rbs +12 -12
  33. data/core/fiber.rbs +47 -36
  34. data/core/file.rbs +242 -169
  35. data/core/file_test.rbs +2 -2
  36. data/core/float.rbs +42 -68
  37. data/core/gc.rbs +78 -70
  38. data/core/hash.rbs +70 -60
  39. data/core/integer.rbs +32 -75
  40. data/core/io/buffer.rbs +36 -36
  41. data/core/io/wait.rbs +7 -7
  42. data/core/io.rbs +192 -146
  43. data/core/kernel.rbs +198 -147
  44. data/core/marshal.rbs +3 -3
  45. data/core/match_data.rbs +14 -12
  46. data/core/math.rbs +69 -67
  47. data/core/method.rbs +6 -8
  48. data/core/module.rbs +148 -88
  49. data/core/nil_class.rbs +4 -3
  50. data/core/numeric.rbs +53 -50
  51. data/core/object.rbs +6 -8
  52. data/core/object_space.rbs +11 -10
  53. data/core/pathname.rbs +131 -81
  54. data/core/proc.rbs +65 -34
  55. data/core/process.rbs +221 -201
  56. data/core/ractor.rbs +15 -11
  57. data/core/random.rbs +21 -3
  58. data/core/range.rbs +152 -49
  59. data/core/rational.rbs +5 -56
  60. data/core/rbs/unnamed/argf.rbs +58 -51
  61. data/core/rbs/unnamed/env_class.rbs +18 -13
  62. data/core/rbs/unnamed/main_class.rbs +123 -0
  63. data/core/rbs/unnamed/random.rbs +7 -116
  64. data/core/regexp.rbs +236 -197
  65. data/core/ruby.rbs +1 -1
  66. data/core/ruby_vm.rbs +32 -30
  67. data/core/rubygems/config_file.rbs +5 -5
  68. data/core/rubygems/errors.rbs +1 -1
  69. data/core/rubygems/requirement.rbs +5 -5
  70. data/core/rubygems/rubygems.rbs +5 -3
  71. data/core/set.rbs +17 -16
  72. data/core/signal.rbs +2 -2
  73. data/core/string.rbs +318 -298
  74. data/core/struct.rbs +26 -25
  75. data/core/symbol.rbs +25 -24
  76. data/core/thread.rbs +40 -41
  77. data/core/time.rbs +47 -42
  78. data/core/trace_point.rbs +34 -31
  79. data/core/true_class.rbs +2 -2
  80. data/core/unbound_method.rbs +10 -10
  81. data/core/warning.rbs +7 -7
  82. data/docs/collection.md +1 -1
  83. data/docs/config.md +171 -0
  84. data/docs/inline.md +576 -0
  85. data/docs/syntax.md +46 -16
  86. data/docs/type_fingerprint.md +21 -0
  87. data/exe/rbs +1 -1
  88. data/ext/rbs_extension/ast_translation.c +595 -98
  89. data/ext/rbs_extension/class_constants.c +30 -0
  90. data/ext/rbs_extension/class_constants.h +15 -0
  91. data/ext/rbs_extension/legacy_location.c +30 -53
  92. data/ext/rbs_extension/legacy_location.h +37 -0
  93. data/ext/rbs_extension/main.c +125 -24
  94. data/include/rbs/ast.h +485 -150
  95. data/include/rbs/lexer.h +11 -4
  96. data/include/rbs/location.h +25 -44
  97. data/include/rbs/parser.h +20 -2
  98. data/include/rbs/util/rbs_constant_pool.h +0 -3
  99. data/include/rbs.h +8 -0
  100. data/lib/rbs/ast/annotation.rb +1 -1
  101. data/lib/rbs/ast/comment.rb +1 -1
  102. data/lib/rbs/ast/declarations.rb +10 -10
  103. data/lib/rbs/ast/members.rb +14 -14
  104. data/lib/rbs/ast/ruby/annotations.rb +409 -0
  105. data/lib/rbs/ast/ruby/comment_block.rb +245 -0
  106. data/lib/rbs/ast/ruby/declarations.rb +281 -0
  107. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +28 -0
  108. data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
  109. data/lib/rbs/ast/ruby/members.rb +723 -0
  110. data/lib/rbs/ast/type_param.rb +24 -4
  111. data/lib/rbs/buffer.rb +105 -20
  112. data/lib/rbs/cli/diff.rb +16 -15
  113. data/lib/rbs/cli/validate.rb +62 -125
  114. data/lib/rbs/cli.rb +55 -23
  115. data/lib/rbs/collection/config/lockfile_generator.rb +8 -4
  116. data/lib/rbs/collection/sources/git.rb +1 -0
  117. data/lib/rbs/collection.rb +0 -1
  118. data/lib/rbs/definition.rb +6 -1
  119. data/lib/rbs/definition_builder/ancestor_builder.rb +119 -63
  120. data/lib/rbs/definition_builder/method_builder.rb +65 -30
  121. data/lib/rbs/definition_builder.rb +177 -20
  122. data/lib/rbs/diff.rb +7 -1
  123. data/lib/rbs/environment/class_entry.rb +69 -0
  124. data/lib/rbs/environment/module_entry.rb +66 -0
  125. data/lib/rbs/environment.rb +338 -155
  126. data/lib/rbs/environment_loader.rb +2 -2
  127. data/lib/rbs/errors.rb +30 -20
  128. data/lib/rbs/inline_parser/comment_association.rb +117 -0
  129. data/lib/rbs/inline_parser.rb +542 -0
  130. data/lib/rbs/location_aux.rb +36 -4
  131. data/lib/rbs/locator.rb +5 -1
  132. data/lib/rbs/method_type.rb +5 -3
  133. data/lib/rbs/namespace.rb +0 -7
  134. data/lib/rbs/parser_aux.rb +31 -8
  135. data/lib/rbs/prototype/helpers.rb +57 -0
  136. data/lib/rbs/prototype/rb.rb +3 -28
  137. data/lib/rbs/prototype/rbi.rb +3 -20
  138. data/lib/rbs/prototype/runtime.rb +10 -2
  139. data/lib/rbs/resolver/type_name_resolver.rb +0 -8
  140. data/lib/rbs/source.rb +99 -0
  141. data/lib/rbs/subtractor.rb +4 -3
  142. data/lib/rbs/test/type_check.rb +5 -2
  143. data/lib/rbs/type_name.rb +1 -8
  144. data/lib/rbs/types.rb +88 -78
  145. data/lib/rbs/unit_test/convertibles.rb +1 -0
  146. data/lib/rbs/unit_test/type_assertions.rb +35 -8
  147. data/lib/rbs/validator.rb +2 -2
  148. data/lib/rbs/version.rb +1 -1
  149. data/lib/rbs.rb +12 -1
  150. data/rbs.gemspec +3 -2
  151. data/rust/.gitignore +1 -0
  152. data/rust/Cargo.lock +378 -0
  153. data/rust/Cargo.toml +7 -0
  154. data/rust/ruby-rbs/Cargo.toml +22 -0
  155. data/rust/ruby-rbs/build.rs +764 -0
  156. data/rust/ruby-rbs/examples/locations.rs +60 -0
  157. data/rust/ruby-rbs/src/lib.rs +1 -0
  158. data/rust/ruby-rbs/src/node/mod.rs +742 -0
  159. data/rust/ruby-rbs/tests/sanity.rs +47 -0
  160. data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
  161. data/rust/ruby-rbs-sys/Cargo.toml +23 -0
  162. data/rust/ruby-rbs-sys/build.rs +204 -0
  163. data/rust/ruby-rbs-sys/src/lib.rs +50 -0
  164. data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
  165. data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
  166. data/rust/ruby-rbs-sys/wrapper.h +1 -0
  167. data/schema/typeParam.json +17 -1
  168. data/sig/ancestor_builder.rbs +1 -1
  169. data/sig/ast/ruby/annotations.rbs +421 -0
  170. data/sig/ast/ruby/comment_block.rbs +127 -0
  171. data/sig/ast/ruby/declarations.rbs +158 -0
  172. data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
  173. data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
  174. data/sig/ast/ruby/members.rbs +178 -0
  175. data/sig/buffer.rbs +63 -5
  176. data/sig/cli/diff.rbs +5 -11
  177. data/sig/cli/validate.rbs +12 -8
  178. data/sig/cli.rbs +18 -18
  179. data/sig/definition.rbs +6 -0
  180. data/sig/definition_builder.rbs +3 -1
  181. data/sig/environment/class_entry.rbs +50 -0
  182. data/sig/environment/module_entry.rbs +50 -0
  183. data/sig/environment.rbs +37 -81
  184. data/sig/errors.rbs +26 -20
  185. data/sig/inline_parser/comment_association.rbs +71 -0
  186. data/sig/inline_parser.rbs +124 -0
  187. data/sig/location.rbs +32 -7
  188. data/sig/locator.rbs +0 -2
  189. data/sig/method_builder.rbs +9 -4
  190. data/sig/namespace.rbs +0 -5
  191. data/sig/parser.rbs +47 -13
  192. data/sig/prototype/helpers.rbs +2 -0
  193. data/sig/resolver/type_name_resolver.rbs +0 -3
  194. data/sig/source.rbs +48 -0
  195. data/sig/type_param.rbs +13 -8
  196. data/sig/typename.rbs +0 -5
  197. data/sig/types.rbs +6 -7
  198. data/sig/unit_test/spy.rbs +0 -8
  199. data/sig/unit_test/type_assertions.rbs +11 -0
  200. data/src/ast.c +491 -143
  201. data/src/lexer.c +1552 -1314
  202. data/src/lexer.re +7 -0
  203. data/src/lexstate.c +8 -1
  204. data/src/location.c +8 -48
  205. data/src/parser.c +1107 -409
  206. data/src/util/rbs_constant_pool.c +0 -4
  207. data/stdlib/bigdecimal/0/big_decimal.rbs +16 -16
  208. data/stdlib/cgi-escape/0/escape.rbs +4 -4
  209. data/stdlib/coverage/0/coverage.rbs +4 -3
  210. data/stdlib/date/0/date.rbs +33 -28
  211. data/stdlib/date/0/date_time.rbs +24 -23
  212. data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
  213. data/stdlib/digest/0/digest.rbs +110 -0
  214. data/stdlib/erb/0/erb.rbs +64 -53
  215. data/stdlib/etc/0/etc.rbs +55 -50
  216. data/stdlib/fileutils/0/fileutils.rbs +140 -126
  217. data/stdlib/forwardable/0/forwardable.rbs +10 -10
  218. data/stdlib/io-console/0/io-console.rbs +2 -2
  219. data/stdlib/json/0/json.rbs +158 -131
  220. data/stdlib/monitor/0/monitor.rbs +3 -3
  221. data/stdlib/net-http/0/net-http.rbs +159 -134
  222. data/stdlib/objspace/0/objspace.rbs +8 -30
  223. data/stdlib/open-uri/0/open-uri.rbs +8 -8
  224. data/stdlib/open3/0/open3.rbs +469 -10
  225. data/stdlib/openssl/0/openssl.rbs +144 -129
  226. data/stdlib/optparse/0/optparse.rbs +23 -14
  227. data/stdlib/pathname/0/pathname.rbs +2 -2
  228. data/stdlib/pp/0/pp.rbs +9 -8
  229. data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
  230. data/stdlib/pstore/0/pstore.rbs +35 -30
  231. data/stdlib/psych/0/psych.rbs +62 -9
  232. data/stdlib/psych/0/store.rbs +2 -4
  233. data/stdlib/pty/0/pty.rbs +9 -6
  234. data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
  235. data/stdlib/rdoc/0/code_object.rbs +2 -1
  236. data/stdlib/rdoc/0/parser.rbs +1 -1
  237. data/stdlib/rdoc/0/store.rbs +1 -1
  238. data/stdlib/ripper/0/ripper.rbs +20 -17
  239. data/stdlib/securerandom/0/manifest.yaml +2 -0
  240. data/stdlib/securerandom/0/securerandom.rbs +7 -20
  241. data/stdlib/shellwords/0/shellwords.rbs +2 -2
  242. data/stdlib/socket/0/addrinfo.rbs +9 -9
  243. data/stdlib/socket/0/basic_socket.rbs +3 -3
  244. data/stdlib/socket/0/ip_socket.rbs +10 -8
  245. data/stdlib/socket/0/socket.rbs +10 -9
  246. data/stdlib/socket/0/tcp_server.rbs +1 -1
  247. data/stdlib/socket/0/tcp_socket.rbs +1 -1
  248. data/stdlib/socket/0/udp_socket.rbs +1 -1
  249. data/stdlib/socket/0/unix_server.rbs +1 -1
  250. data/stdlib/stringio/0/stringio.rbs +55 -54
  251. data/stdlib/strscan/0/string_scanner.rbs +46 -44
  252. data/stdlib/tempfile/0/tempfile.rbs +24 -20
  253. data/stdlib/time/0/time.rbs +7 -5
  254. data/stdlib/tsort/0/tsort.rbs +7 -6
  255. data/stdlib/uri/0/common.rbs +31 -18
  256. data/stdlib/uri/0/file.rbs +2 -2
  257. data/stdlib/uri/0/generic.rbs +9 -2
  258. data/stdlib/uri/0/http.rbs +2 -2
  259. data/stdlib/uri/0/ldap.rbs +2 -2
  260. data/stdlib/uri/0/mailto.rbs +3 -3
  261. data/stdlib/uri/0/rfc2396_parser.rbs +6 -5
  262. data/stdlib/zlib/0/deflate.rbs +4 -3
  263. data/stdlib/zlib/0/gzip_reader.rbs +6 -6
  264. data/stdlib/zlib/0/gzip_writer.rbs +14 -12
  265. data/stdlib/zlib/0/inflate.rbs +1 -1
  266. data/stdlib/zlib/0/need_dict.rbs +1 -1
  267. metadata +66 -3
data/core/file_test.rbs CHANGED
@@ -269,7 +269,7 @@ module FileTest
269
269
  # -->
270
270
  # If *file_name* is readable by others, returns an integer representing the file
271
271
  # permission bits of *file_name*. Returns `nil` otherwise. The meaning of the
272
- # bits is platform dependent; on Unix systems, see `stat(2)`.
272
+ # bits is platform dependent; on Unix systems, see <code>stat(2)</code>.
273
273
  #
274
274
  # *file_name* can be an IO object.
275
275
  #
@@ -285,7 +285,7 @@ module FileTest
285
285
  # -->
286
286
  # If *file_name* is writable by others, returns an integer representing the file
287
287
  # permission bits of *file_name*. Returns `nil` otherwise. The meaning of the
288
- # bits is platform dependent; on Unix systems, see `stat(2)`.
288
+ # bits is platform dependent; on Unix systems, see <code>stat(2)</code>.
289
289
  #
290
290
  # *file_name* can be an IO object.
291
291
  #
data/core/float.rbs CHANGED
@@ -12,7 +12,7 @@
12
12
  #
13
13
  # Others cannot; among these are the transcendental numbers, including:
14
14
  #
15
- # * Pi, *π*: in mathematics, a number of infinite precision:
15
+ # * Pi, <em>π</em>: in mathematics, a number of infinite precision:
16
16
  # 3.1415926535897932384626433... (to 25 places); in Ruby, it is of limited
17
17
  # precision (in this case, to 16 decimal places):
18
18
  #
@@ -32,8 +32,8 @@
32
32
  # Others do not:
33
33
  #
34
34
  # * In mathematics, 2/3 as a decimal number is an infinitely-repeating
35
- # decimal: 0.666... (forever); in Ruby, `2.0/3` is of limited precision (in
36
- # this case, to 16 decimal places):
35
+ # decimal: 0.666... (forever); in Ruby, <code>2.0/3</code> is of limited
36
+ # precision (in this case, to 16 decimal places):
37
37
  #
38
38
  # 2.0/3 # => 0.6666666666666666
39
39
  #
@@ -139,7 +139,7 @@
139
139
  #
140
140
  # Others cannot; among these are the transcendental numbers, including:
141
141
  #
142
- # * Pi, *π*: in mathematics, a number of infinite precision:
142
+ # * Pi, <em>π</em>: in mathematics, a number of infinite precision:
143
143
  # 3.1415926535897932384626433... (to 25 places); in Ruby, it is of limited
144
144
  # precision (in this case, to 16 decimal places):
145
145
  #
@@ -159,8 +159,8 @@
159
159
  # Others do not:
160
160
  #
161
161
  # * In mathematics, 2/3 as a decimal number is an infinitely-repeating
162
- # decimal: 0.666... (forever); in Ruby, `2.0/3` is of limited precision (in
163
- # this case, to 16 decimal places):
162
+ # decimal: 0.666... (forever); in Ruby, <code>2.0/3</code> is of limited
163
+ # precision (in this case, to 16 decimal places):
164
164
  #
165
165
  # 2.0/3 # => 0.6666666666666666
166
166
  #
@@ -336,8 +336,6 @@ class Float < Numeric
336
336
  def +: (Complex) -> Complex
337
337
  | (Numeric) -> Float
338
338
 
339
- def +@: () -> Float
340
-
341
339
  # <!--
342
340
  # rdoc-file=numeric.c
343
341
  # - self - other -> numeric
@@ -392,7 +390,8 @@ class Float < Numeric
392
390
  # 2.0 < Rational(3, 1) # => true
393
391
  # 2.0 < 2.0 # => false
394
392
  #
395
- # `Float::NAN < Float::NAN` returns an implementation-dependent value.
393
+ # <code>Float::NAN < Float::NAN</code> returns an implementation-dependent
394
+ # value.
396
395
  #
397
396
  def <: (Numeric) -> bool
398
397
 
@@ -409,7 +408,8 @@ class Float < Numeric
409
408
  # 2.0 <= 2.0 # => true
410
409
  # 2.0 <= 1.0 # => false
411
410
  #
412
- # `Float::NAN <= Float::NAN` returns an implementation-dependent value.
411
+ # <code>Float::NAN <= Float::NAN</code> returns an implementation-dependent
412
+ # value.
413
413
  #
414
414
  def <=: (Numeric) -> bool
415
415
 
@@ -421,7 +421,7 @@ class Float < Numeric
421
421
  #
422
422
  # Returns:
423
423
  #
424
- # * `-1`, if `self` is less than `other`.
424
+ # * <code>-1</code>, if `self` is less than `other`.
425
425
  # * `0`, if `self` is equal to `other`.
426
426
  # * `1`, if `self` is greater than `other`.
427
427
  # * `nil`, if the two values are incommensurate.
@@ -436,7 +436,8 @@ class Float < Numeric
436
436
  # 2.0 <=> 1.9 # => 1
437
437
  # 2.0 <=> 'foo' # => nil
438
438
  #
439
- # `Float::NAN <=> Float::NAN` returns an implementation-dependent value.
439
+ # <code>Float::NAN <=> Float::NAN</code> returns an implementation-dependent
440
+ # value.
440
441
  #
441
442
  # Class Float includes module Comparable, each of whose methods uses Float#<=>
442
443
  # for comparison.
@@ -454,7 +455,8 @@ class Float < Numeric
454
455
  # 2.0 == Rational(2, 1) # => true
455
456
  # 2.0 == Complex(2, 0) # => true
456
457
  #
457
- # `Float::NAN == Float::NAN` returns an implementation-dependent value.
458
+ # <code>Float::NAN == Float::NAN</code> returns an implementation-dependent
459
+ # value.
458
460
  #
459
461
  # Related: Float#eql? (requires `other` to be a Float).
460
462
  #
@@ -468,7 +470,8 @@ class Float < Numeric
468
470
  # 2.0 == Rational(2, 1) # => true
469
471
  # 2.0 == Complex(2, 0) # => true
470
472
  #
471
- # `Float::NAN == Float::NAN` returns an implementation-dependent value.
473
+ # <code>Float::NAN == Float::NAN</code> returns an implementation-dependent
474
+ # value.
472
475
  #
473
476
  # Related: Float#eql? (requires `other` to be a Float).
474
477
  #
@@ -485,7 +488,8 @@ class Float < Numeric
485
488
  # 2.0 > Rational(1, 2) # => true
486
489
  # 2.0 > 2.0 # => false
487
490
  #
488
- # `Float::NAN > Float::NAN` returns an implementation-dependent value.
491
+ # <code>Float::NAN > Float::NAN</code> returns an implementation-dependent
492
+ # value.
489
493
  #
490
494
  def >: (Numeric) -> bool
491
495
 
@@ -501,7 +505,8 @@ class Float < Numeric
501
505
  # 2.0 >= 2.0 # => true
502
506
  # 2.0 >= 2.1 # => false
503
507
  #
504
- # `Float::NAN >= Float::NAN` returns an implementation-dependent value.
508
+ # <code>Float::NAN >= Float::NAN</code> returns an implementation-dependent
509
+ # value.
505
510
  #
506
511
  def >=: (Numeric) -> bool
507
512
 
@@ -517,12 +522,10 @@ class Float < Numeric
517
522
  #
518
523
  def abs: () -> Float
519
524
 
520
- def abs2: () -> Float
521
-
522
525
  # <!-- rdoc-file=complex.c -->
523
526
  # Returns 0 if `self` is positive, Math::PI otherwise.
524
527
  #
525
- def angle: () -> (Integer | Float)
528
+ def angle: ...
526
529
 
527
530
  # <!--
528
531
  # rdoc-file=complex.c
@@ -558,7 +561,7 @@ class Float < Numeric
558
561
  #
559
562
  # When `ndigits` is non-positive,
560
563
  # returns an Integer based on a computed granularity:
561
- # * The granularity is `10 ** ndigits.abs`.
564
+ # * The granularity is <code>10 ** ndigits.abs</code>.
562
565
  # * The returned value is the largest multiple of the granularity
563
566
  # that is less than or equal to `self`.
564
567
  # Examples with positive `self`:
@@ -610,10 +613,6 @@ class Float < Numeric
610
613
  #
611
614
  def coerce: (Numeric) -> [ Float, Float ]
612
615
 
613
- def conj: () -> Float
614
-
615
- def conjugate: () -> Float
616
-
617
616
  # <!--
618
617
  # rdoc-file=rational.c
619
618
  # - flo.denominator -> integer
@@ -624,13 +623,11 @@ class Float < Numeric
624
623
  #
625
624
  def denominator: () -> Integer
626
625
 
627
- def div: (Numeric) -> Integer
628
-
629
626
  # <!--
630
627
  # rdoc-file=numeric.c
631
628
  # - divmod(other) -> array
632
629
  # -->
633
- # Returns a 2-element array `[q, r]`, where
630
+ # Returns a 2-element array <code>[q, r]</code>, where
634
631
  #
635
632
  # q = (self/other).floor # Quotient
636
633
  # r = self % other # Remainder
@@ -653,8 +650,6 @@ class Float < Numeric
653
650
  def divmod: (Integer | Float | Rational) -> [ Integer, Float ]
654
651
  | (Numeric) -> [ Numeric, Numeric ]
655
652
 
656
- def dup: () -> self
657
-
658
653
  # <!--
659
654
  # rdoc-file=numeric.c
660
655
  # - eql?(other) -> true or false
@@ -668,7 +663,8 @@ class Float < Numeric
668
663
  # 2.0.eql?(Rational(2, 1)) # => false
669
664
  # 2.0.eql?(Complex(2, 0)) # => false
670
665
  #
671
- # `Float::NAN.eql?(Float::NAN)` returns an implementation-dependent value.
666
+ # <code>Float::NAN.eql?(Float::NAN)</code> returns an implementation-dependent
667
+ # value.
672
668
  #
673
669
  # Related: Float#== (performs type conversions).
674
670
  #
@@ -690,8 +686,8 @@ class Float < Numeric
690
686
  # rdoc-file=numeric.c
691
687
  # - finite? -> true or false
692
688
  # -->
693
- # Returns `true` if `self` is not `Infinity`, `-Infinity`, or `NaN`, `false`
694
- # otherwise:
689
+ # Returns `true` if `self` is not `Infinity`, <code>-Infinity</code>, or `NaN`,
690
+ # `false` otherwise:
695
691
  #
696
692
  # f = 2.0 # => 2.0
697
693
  # f.finite? # => true
@@ -736,7 +732,7 @@ class Float < Numeric
736
732
  #
737
733
  # When `self` is non-zero and `ndigits` is non-positive,
738
734
  # returns an integer value based on a computed granularity:
739
- # * The granularity is `10 ** ndigits.abs`.
735
+ # * The granularity is <code>10 ** ndigits.abs</code>.
740
736
  # * The returned value is the largest multiple of the granularity
741
737
  # that is less than or equal to `self`.
742
738
  # Examples with positive `self`:
@@ -777,12 +773,6 @@ class Float < Numeric
777
773
  #
778
774
  def hash: () -> Integer
779
775
 
780
- def i: () -> Complex
781
-
782
- def imag: () -> Integer
783
-
784
- def imaginary: () -> Integer
785
-
786
776
  # <!--
787
777
  # rdoc-file=numeric.c
788
778
  # - infinite? -> -1, 1, or nil
@@ -790,7 +780,7 @@ class Float < Numeric
790
780
  # Returns:
791
781
  #
792
782
  # * 1, if `self` is `Infinity`.
793
- # * -1 if `self` is `-Infinity`.
783
+ # * -1 if `self` is <code>-Infinity</code>.
794
784
  # * `nil`, otherwise.
795
785
  #
796
786
  # Examples:
@@ -827,8 +817,6 @@ class Float < Numeric
827
817
  #
828
818
  alias inspect to_s
829
819
 
830
- def integer?: () -> bool
831
-
832
820
  # <!--
833
821
  # rdoc-file=numeric.rb
834
822
  # - magnitude()
@@ -890,7 +878,7 @@ class Float < Numeric
890
878
  # Returns the next-larger representable Float.
891
879
  #
892
880
  # These examples show the internally stored values (64-bit hexadecimal) for each
893
- # Float `f` and for the corresponding `f.next_float`:
881
+ # Float `f` and for the corresponding <code>f.next_float</code>:
894
882
  #
895
883
  # f = 0.0 # 0x0000000000000000
896
884
  # f.next_float # 0x0000000000000001
@@ -928,8 +916,6 @@ class Float < Numeric
928
916
  #
929
917
  def next_float: () -> Float
930
918
 
931
- def nonzero?: () -> self?
932
-
933
919
  # <!--
934
920
  # rdoc-file=rational.c
935
921
  # - flo.numerator -> integer
@@ -966,7 +952,7 @@ class Float < Numeric
966
952
  # Returns the next-smaller representable Float.
967
953
  #
968
954
  # These examples show the internally stored values (64-bit hexadecimal) for each
969
- # Float `f` and for the corresponding `f.pev_float`:
955
+ # Float `f` and for the corresponding <code>f.pev_float</code>:
970
956
  #
971
957
  # f = 5e-324 # 0x0000000000000001
972
958
  # f.prev_float # 0x0000000000000000
@@ -1026,14 +1012,8 @@ class Float < Numeric
1026
1012
  #
1027
1013
  def rationalize: (?Numeric eps) -> Rational
1028
1014
 
1029
- def real: () -> Float
1030
-
1031
- def real?: () -> true
1032
-
1033
1015
  def rect: () -> [ Float, Numeric ]
1034
1016
 
1035
- alias rectangular rect
1036
-
1037
1017
  def remainder: (Numeric) -> Float
1038
1018
 
1039
1019
  # <!--
@@ -1053,8 +1033,8 @@ class Float < Numeric
1053
1033
  # f.round(1) # => -12345.7
1054
1034
  # f.round(3) # => -12345.679
1055
1035
  #
1056
- # When `ndigits` is negative, returns an integer with at least `ndigits.abs`
1057
- # trailing zeros:
1036
+ # When `ndigits` is negative, returns an integer with at least
1037
+ # <code>ndigits.abs</code> trailing zeros:
1058
1038
  #
1059
1039
  # f = 12345.6789
1060
1040
  # f.round(0) # => 12346
@@ -1066,19 +1046,20 @@ class Float < Numeric
1066
1046
  # If keyword argument `half` is given, and `self` is equidistant from the two
1067
1047
  # candidate values, the rounding is according to the given `half` value:
1068
1048
  #
1069
- # * `:up` or `nil`: round away from zero:
1049
+ # * <code>:up</code> or `nil`: round away from zero:
1070
1050
  #
1071
1051
  # 2.5.round(half: :up) # => 3
1072
1052
  # 3.5.round(half: :up) # => 4
1073
1053
  # (-2.5).round(half: :up) # => -3
1074
1054
  #
1075
- # * `:down`: round toward zero:
1055
+ # * <code>:down</code>: round toward zero:
1076
1056
  #
1077
1057
  # 2.5.round(half: :down) # => 2
1078
1058
  # 3.5.round(half: :down) # => 3
1079
1059
  # (-2.5).round(half: :down) # => -2
1080
1060
  #
1081
- # * `:even`: round toward the candidate whose last nonzero digit is even:
1061
+ # * <code>:even</code>: round toward the candidate whose last nonzero digit is
1062
+ # even:
1082
1063
  #
1083
1064
  # 2.5.round(half: :even) # => 2
1084
1065
  # 3.5.round(half: :even) # => 4
@@ -1091,13 +1072,6 @@ class Float < Numeric
1091
1072
  def round: (?half: :up | :down | :even) -> Integer
1092
1073
  | (int digits, ?half: :up | :down | :even) -> (Integer | Float)
1093
1074
 
1094
- def step: (?Numeric limit, ?Numeric step) { (Float) -> void } -> self
1095
- | (?Numeric limit, ?Numeric step) -> Enumerator[Float, self]
1096
- | (?by: Numeric, ?to: Numeric) { (Float) -> void } -> self
1097
- | (?by: Numeric, ?to: Numeric) -> Enumerator[Float, self]
1098
-
1099
- def to_c: () -> Complex
1100
-
1101
1075
  # <!--
1102
1076
  # rdoc-file=numeric.rb
1103
1077
  # - to_f -> self
@@ -1198,8 +1172,8 @@ class Float < Numeric
1198
1172
  # f.truncate(1) # => -12345.6
1199
1173
  # f.truncate(3) # => -12345.678
1200
1174
  #
1201
- # When `ndigits` is negative, returns an integer with at least `ndigits.abs`
1202
- # trailing zeros:
1175
+ # When `ndigits` is negative, returns an integer with at least
1176
+ # <code>ndigits.abs</code> trailing zeros:
1203
1177
  #
1204
1178
  # f = 12345.6789
1205
1179
  # f.truncate(0) # => 12345
@@ -1285,8 +1259,8 @@ Float::MAX_EXP: Integer
1285
1259
  # Usually defaults to 2.2250738585072014e-308.
1286
1260
  #
1287
1261
  # If the platform supports denormalized numbers, there are numbers between zero
1288
- # and Float::MIN. `0.0.next_float` returns the smallest positive floating point
1289
- # number including denormalized numbers.
1262
+ # and Float::MIN. <code>0.0.next_float</code> returns the smallest positive
1263
+ # floating point number including denormalized numbers.
1290
1264
  #
1291
1265
  Float::MIN: Float
1292
1266
 
data/core/gc.rbs CHANGED
@@ -182,21 +182,21 @@ module GC
182
182
  # GC.config(foo: 'bar')
183
183
  # # => {rgengc_allow_full_mark: false, implementation: "default"}
184
184
  #
185
- # **All-Implementations Configuration**
185
+ # <strong>All-Implementations Configuration</strong>
186
186
  #
187
187
  # The single read-only entry for all implementations is:
188
188
  #
189
- # * `:implementation`: the string name of the implementation; for the Ruby
190
- # default implementation, `'default'`.
189
+ # * <code>:implementation</code>: the string name of the implementation; for
190
+ # the Ruby default implementation, <code>'default'</code>.
191
191
  #
192
- # **Implementation-Specific Configuration**
192
+ # <strong>Implementation-Specific Configuration</strong>
193
193
  #
194
194
  # A GC implementation maintains its own implementation-specific configuration.
195
195
  #
196
196
  # For Ruby's default implementation the single entry is:
197
197
  #
198
- # * `:rgengc_allow_full_mark`: Controls whether the GC is allowed to run a
199
- # full mark (young & old objects):
198
+ # * <code>:rgengc_allow_full_mark</code>: Controls whether the GC is allowed
199
+ # to run a full mark (young & old objects):
200
200
  #
201
201
  # * `true` (default): GC interleaves major and minor collections. A flag
202
202
  # is set to notify GC that a full mark has been requested. This flag is
@@ -348,59 +348,66 @@ module GC
348
348
  #
349
349
  # The hash includes entries such as:
350
350
  #
351
- # * `:count`: The total number of garbage collections run since application
352
- # start (count includes both minor and major garbage collections).
353
- # * `:time`: The total time spent in garbage collections (in milliseconds).
354
- # * `:heap_allocated_pages`: The total number of allocated pages.
355
- # * `:heap_empty_pages`: The number of pages with no live objects, and that
356
- # could be released to the system.
357
- # * `:heap_sorted_length`: The number of pages that can fit into the buffer
358
- # that holds references to all pages.
359
- # * `:heap_allocatable_pages`: The total number of pages the application could
360
- # allocate without additional GC.
361
- # * `:heap_available_slots`: The total number of slots in all
362
- # `:heap_allocated_pages`.
363
- # * `:heap_live_slots`: The total number of slots which contain live objects.
364
- # * `:heap_free_slots`: The total number of slots which do not contain live
365
- # objects.
366
- # * `:heap_final_slots`: The total number of slots with pending finalizers to
367
- # be run.
368
- # * `:heap_marked_slots`: The total number of objects marked in the last GC.
369
- # * `:heap_eden_pages`: The total number of pages which contain at least one
370
- # live slot.
371
- # * `:total_allocated_pages`: The cumulative number of pages allocated since
372
- # application start.
373
- # * `:total_freed_pages`: The cumulative number of pages freed since
374
- # application start.
375
- # * `:total_allocated_objects`: The cumulative number of objects allocated
351
+ # * <code>:count</code>: The total number of garbage collections run since
352
+ # application start (count includes both minor and major garbage
353
+ # collections).
354
+ # * <code>:time</code>: The total time spent in garbage collections (in
355
+ # milliseconds).
356
+ # * <code>:heap_allocated_pages</code>: The total number of allocated pages.
357
+ # * <code>:heap_empty_pages</code>: The number of pages with no live objects,
358
+ # and that could be released to the system.
359
+ # * <code>:heap_sorted_length</code>: The number of pages that can fit into
360
+ # the buffer that holds references to all pages.
361
+ # * <code>:heap_allocatable_pages</code>: The total number of pages the
362
+ # application could allocate without additional GC.
363
+ # * <code>:heap_available_slots</code>: The total number of slots in all
364
+ # <code>:heap_allocated_pages</code>.
365
+ # * <code>:heap_live_slots</code>: The total number of slots which contain
366
+ # live objects.
367
+ # * <code>:heap_free_slots</code>: The total number of slots which do not
368
+ # contain live objects.
369
+ # * <code>:heap_final_slots</code>: The total number of slots with pending
370
+ # finalizers to be run.
371
+ # * <code>:heap_marked_slots</code>: The total number of objects marked in the
372
+ # last GC.
373
+ # * <code>:heap_eden_pages</code>: The total number of pages which contain at
374
+ # least one live slot.
375
+ # * <code>:total_allocated_pages</code>: The cumulative number of pages
376
+ # allocated since application start.
377
+ # * <code>:total_freed_pages</code>: The cumulative number of pages freed
376
378
  # since application start.
377
- # * `:total_freed_objects`: The cumulative number of objects freed since
378
- # application start.
379
- # * `:malloc_increase_bytes`: Amount of memory allocated on the heap for
380
- # objects. Decreased by any GC.
381
- # * `:malloc_increase_bytes_limit`: When `:malloc_increase_bytes` crosses this
382
- # limit, GC is triggered.
383
- # * `:minor_gc_count`: The total number of minor garbage collections run since
384
- # process start.
385
- # * `:major_gc_count`: The total number of major garbage collections run since
379
+ # * <code>:total_allocated_objects</code>: The cumulative number of objects
380
+ # allocated since application start.
381
+ # * <code>:total_freed_objects</code>: The cumulative number of objects freed
382
+ # since application start.
383
+ # * <code>:malloc_increase_bytes</code>: Amount of memory allocated on the
384
+ # heap for objects. Decreased by any GC.
385
+ # * <code>:malloc_increase_bytes_limit</code>: When
386
+ # <code>:malloc_increase_bytes</code> crosses this limit, GC is triggered.
387
+ # * <code>:minor_gc_count</code>: The total number of minor garbage
388
+ # collections run since process start.
389
+ # * <code>:major_gc_count</code>: The total number of major garbage
390
+ # collections run since process start.
391
+ # * <code>:compact_count</code>: The total number of compactions run since
386
392
  # process start.
387
- # * `:compact_count`: The total number of compactions run since process start.
388
- # * `:read_barrier_faults`: The total number of times the read barrier was
389
- # triggered during compaction.
390
- # * `:total_moved_objects`: The total number of objects compaction has moved.
391
- # * `:remembered_wb_unprotected_objects`: The total number of objects without
392
- # write barriers.
393
- # * `:remembered_wb_unprotected_objects_limit`: When
394
- # `:remembered_wb_unprotected_objects` crosses this limit, major GC is
395
- # triggered.
396
- # * `:old_objects`: Number of live, old objects which have survived at least 3
397
- # garbage collections.
398
- # * `:old_objects_limit`: When `:old_objects` crosses this limit, major GC is
393
+ # * <code>:read_barrier_faults</code>: The total number of times the read
394
+ # barrier was triggered during compaction.
395
+ # * <code>:total_moved_objects</code>: The total number of objects compaction
396
+ # has moved.
397
+ # * <code>:remembered_wb_unprotected_objects</code>: The total number of
398
+ # objects without write barriers.
399
+ # * <code>:remembered_wb_unprotected_objects_limit</code>: When
400
+ # <code>:remembered_wb_unprotected_objects</code> crosses this limit, major
401
+ # GC is triggered.
402
+ # * <code>:old_objects</code>: Number of live, old objects which have survived
403
+ # at least 3 garbage collections.
404
+ # * <code>:old_objects_limit</code>: When <code>:old_objects</code> crosses
405
+ # this limit, major GC is triggered.
406
+ # * <code>:oldmalloc_increase_bytes</code>: Amount of memory allocated on the
407
+ # heap for objects. Decreased by major GC.
408
+ # * <code>:oldmalloc_increase_bytes_limit</code>: When
409
+ # <code>:oldmalloc_increase_bytes</code> crosses this limit, major GC is
399
410
  # triggered.
400
- # * `:oldmalloc_increase_bytes`: Amount of memory allocated on the heap for
401
- # objects. Decreased by major GC.
402
- # * `:oldmalloc_increase_bytes_limit`: When `:oldmalloc_increase_bytes`
403
- # crosses this limit, major GC is triggered.
404
411
  #
405
412
  def self.stat: (?Hash[Symbol, untyped]? hash) -> Hash[Symbol, untyped]
406
413
  | (Symbol key) -> Integer
@@ -575,21 +582,22 @@ module GC
575
582
  #
576
583
  # The statistics for a heap may include:
577
584
  #
578
- # * `:slot_size`: The slot size of the heap in bytes.
579
- # * `:heap_allocatable_pages`: The number of pages that can be allocated
580
- # without triggering a new garbage collection cycle.
581
- # * `:heap_eden_pages`: The number of pages in the eden heap.
582
- # * `:heap_eden_slots`: The total number of slots in all of the pages in the
583
- # eden heap.
584
- # * `:total_allocated_pages`: The total number of pages that have been
585
- # allocated in the heap.
586
- # * `:total_freed_pages`: The total number of pages that have been freed and
587
- # released back to the system in the heap.
588
- # * `:force_major_gc_count`: The number of times this heap has forced major
589
- # garbage collection cycles to start due to running out of free slots.
590
- # * `:force_incremental_marking_finish_count`: The number of times this heap
591
- # has forced incremental marking to complete due to running out of pooled
585
+ # * <code>:slot_size</code>: The slot size of the heap in bytes.
586
+ # * <code>:heap_allocatable_pages</code>: The number of pages that can be
587
+ # allocated without triggering a new garbage collection cycle.
588
+ # * <code>:heap_eden_pages</code>: The number of pages in the eden heap.
589
+ # * <code>:heap_eden_slots</code>: The total number of slots in all of the
590
+ # pages in the eden heap.
591
+ # * <code>:total_allocated_pages</code>: The total number of pages that have
592
+ # been allocated in the heap.
593
+ # * <code>:total_freed_pages</code>: The total number of pages that have been
594
+ # freed and released back to the system in the heap.
595
+ # * <code>:force_major_gc_count</code>: The number of times this heap has
596
+ # forced major garbage collection cycles to start due to running out of free
592
597
  # slots.
598
+ # * <code>:force_incremental_marking_finish_count</code>: The number of times
599
+ # this heap has forced incremental marking to complete due to running out of
600
+ # pooled slots.
593
601
  #
594
602
  def self.stat_heap: (?Integer? heap_name, ?Hash[Symbol, untyped]? hash) -> Hash[Symbol, untyped]
595
603
  | (Integer heap_name, Symbol key) -> Integer