rbs 4.0.0.dev.4 → 4.0.0.dev.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 (223) 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 +11 -8
  5. data/.github/workflows/comments.yml +3 -3
  6. data/.github/workflows/dependabot.yml +1 -1
  7. data/.github/workflows/ruby.yml +17 -34
  8. data/.github/workflows/typecheck.yml +2 -2
  9. data/.github/workflows/valgrind.yml +42 -0
  10. data/.github/workflows/windows.yml +2 -2
  11. data/.rubocop.yml +1 -1
  12. data/README.md +1 -1
  13. data/Rakefile +32 -5
  14. data/config.yml +46 -0
  15. data/core/array.rbs +96 -46
  16. data/core/binding.rbs +0 -2
  17. data/core/builtin.rbs +2 -2
  18. data/core/comparable.rbs +13 -6
  19. data/core/complex.rbs +55 -41
  20. data/core/dir.rbs +4 -4
  21. data/core/encoding.rbs +7 -10
  22. data/core/enumerable.rbs +90 -3
  23. data/core/enumerator/arithmetic_sequence.rbs +70 -0
  24. data/core/enumerator.rbs +63 -1
  25. data/core/errno.rbs +8 -0
  26. data/core/errors.rbs +28 -1
  27. data/core/exception.rbs +2 -2
  28. data/core/fiber.rbs +40 -20
  29. data/core/file.rbs +108 -78
  30. data/core/file_test.rbs +1 -1
  31. data/core/float.rbs +225 -69
  32. data/core/gc.rbs +417 -281
  33. data/core/hash.rbs +1023 -727
  34. data/core/integer.rbs +104 -110
  35. data/core/io/buffer.rbs +21 -10
  36. data/core/io/wait.rbs +11 -33
  37. data/core/io.rbs +82 -19
  38. data/core/kernel.rbs +70 -59
  39. data/core/marshal.rbs +1 -1
  40. data/core/match_data.rbs +1 -1
  41. data/core/math.rbs +42 -3
  42. data/core/method.rbs +63 -27
  43. data/core/module.rbs +103 -26
  44. data/core/nil_class.rbs +3 -3
  45. data/core/numeric.rbs +43 -35
  46. data/core/object.rbs +3 -3
  47. data/core/object_space.rbs +21 -15
  48. data/core/pathname.rbs +1272 -0
  49. data/core/proc.rbs +30 -25
  50. data/core/process.rbs +4 -2
  51. data/core/ractor.rbs +361 -509
  52. data/core/random.rbs +17 -0
  53. data/core/range.rbs +113 -16
  54. data/core/rational.rbs +56 -85
  55. data/core/rbs/unnamed/argf.rbs +2 -2
  56. data/core/rbs/unnamed/env_class.rbs +1 -1
  57. data/core/rbs/unnamed/random.rbs +4 -113
  58. data/core/regexp.rbs +25 -20
  59. data/core/ruby.rbs +53 -0
  60. data/core/ruby_vm.rbs +6 -4
  61. data/core/rubygems/errors.rbs +3 -70
  62. data/core/rubygems/rubygems.rbs +11 -79
  63. data/core/rubygems/version.rbs +2 -3
  64. data/core/set.rbs +488 -359
  65. data/core/signal.rbs +24 -14
  66. data/core/string.rbs +3171 -1241
  67. data/core/struct.rbs +1 -1
  68. data/core/symbol.rbs +17 -11
  69. data/core/thread.rbs +95 -33
  70. data/core/time.rbs +35 -9
  71. data/core/trace_point.rbs +7 -4
  72. data/core/unbound_method.rbs +14 -6
  73. data/docs/aliases.md +79 -0
  74. data/docs/collection.md +2 -2
  75. data/docs/encoding.md +56 -0
  76. data/docs/gem.md +0 -1
  77. data/docs/inline.md +470 -0
  78. data/docs/sigs.md +3 -3
  79. data/docs/syntax.md +33 -4
  80. data/docs/type_fingerprint.md +21 -0
  81. data/exe/rbs +1 -1
  82. data/ext/rbs_extension/ast_translation.c +77 -3
  83. data/ext/rbs_extension/ast_translation.h +3 -0
  84. data/ext/rbs_extension/class_constants.c +8 -2
  85. data/ext/rbs_extension/class_constants.h +4 -0
  86. data/ext/rbs_extension/extconf.rb +5 -1
  87. data/ext/rbs_extension/legacy_location.c +5 -5
  88. data/ext/rbs_extension/main.c +37 -20
  89. data/include/rbs/ast.h +85 -38
  90. data/include/rbs/defines.h +27 -0
  91. data/include/rbs/lexer.h +30 -11
  92. data/include/rbs/parser.h +6 -6
  93. data/include/rbs/string.h +0 -2
  94. data/include/rbs/util/rbs_allocator.h +34 -13
  95. data/include/rbs/util/rbs_assert.h +12 -1
  96. data/include/rbs/util/rbs_encoding.h +2 -0
  97. data/include/rbs/util/rbs_unescape.h +2 -1
  98. data/lib/rbs/ast/annotation.rb +1 -1
  99. data/lib/rbs/ast/comment.rb +1 -1
  100. data/lib/rbs/ast/declarations.rb +10 -10
  101. data/lib/rbs/ast/members.rb +14 -14
  102. data/lib/rbs/ast/ruby/annotations.rb +137 -0
  103. data/lib/rbs/ast/ruby/comment_block.rb +24 -0
  104. data/lib/rbs/ast/ruby/declarations.rb +198 -3
  105. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +4 -0
  106. data/lib/rbs/ast/ruby/members.rb +159 -1
  107. data/lib/rbs/ast/type_param.rb +24 -4
  108. data/lib/rbs/buffer.rb +20 -15
  109. data/lib/rbs/cli/diff.rb +16 -15
  110. data/lib/rbs/cli/validate.rb +38 -51
  111. data/lib/rbs/cli.rb +52 -19
  112. data/lib/rbs/collection/config/lockfile_generator.rb +8 -0
  113. data/lib/rbs/collection/sources/git.rb +1 -0
  114. data/lib/rbs/definition.rb +1 -1
  115. data/lib/rbs/definition_builder/ancestor_builder.rb +62 -9
  116. data/lib/rbs/definition_builder/method_builder.rb +20 -0
  117. data/lib/rbs/definition_builder.rb +91 -2
  118. data/lib/rbs/diff.rb +7 -1
  119. data/lib/rbs/environment.rb +227 -74
  120. data/lib/rbs/environment_loader.rb +0 -6
  121. data/lib/rbs/errors.rb +27 -7
  122. data/lib/rbs/inline_parser.rb +341 -5
  123. data/lib/rbs/location_aux.rb +1 -1
  124. data/lib/rbs/locator.rb +5 -1
  125. data/lib/rbs/method_type.rb +5 -3
  126. data/lib/rbs/parser_aux.rb +2 -2
  127. data/lib/rbs/prototype/rb.rb +2 -2
  128. data/lib/rbs/prototype/rbi.rb +2 -0
  129. data/lib/rbs/prototype/runtime.rb +8 -0
  130. data/lib/rbs/resolver/constant_resolver.rb +2 -2
  131. data/lib/rbs/resolver/type_name_resolver.rb +116 -38
  132. data/lib/rbs/subtractor.rb +3 -1
  133. data/lib/rbs/test/type_check.rb +16 -2
  134. data/lib/rbs/type_name.rb +1 -1
  135. data/lib/rbs/types.rb +27 -27
  136. data/lib/rbs/validator.rb +2 -2
  137. data/lib/rbs/version.rb +1 -1
  138. data/lib/rbs.rb +1 -1
  139. data/lib/rdoc/discover.rb +1 -1
  140. data/lib/rdoc_plugin/parser.rb +1 -1
  141. data/rbs.gemspec +3 -2
  142. data/schema/typeParam.json +17 -1
  143. data/sig/ast/ruby/annotations.rbs +124 -0
  144. data/sig/ast/ruby/comment_block.rbs +8 -0
  145. data/sig/ast/ruby/declarations.rbs +102 -4
  146. data/sig/ast/ruby/members.rbs +87 -1
  147. data/sig/cli/diff.rbs +5 -11
  148. data/sig/cli/validate.rbs +13 -4
  149. data/sig/cli.rbs +18 -18
  150. data/sig/definition.rbs +6 -1
  151. data/sig/environment.rbs +70 -12
  152. data/sig/errors.rbs +13 -6
  153. data/sig/inline_parser.rbs +39 -2
  154. data/sig/locator.rbs +0 -2
  155. data/sig/manifest.yaml +0 -1
  156. data/sig/method_builder.rbs +3 -1
  157. data/sig/method_types.rbs +1 -1
  158. data/sig/parser.rbs +16 -2
  159. data/sig/resolver/type_name_resolver.rbs +35 -7
  160. data/sig/source.rbs +3 -3
  161. data/sig/type_param.rbs +13 -8
  162. data/sig/types.rbs +4 -4
  163. data/src/ast.c +80 -1
  164. data/src/lexer.c +1392 -1313
  165. data/src/lexer.re +3 -0
  166. data/src/lexstate.c +58 -37
  167. data/src/location.c +4 -4
  168. data/src/parser.c +412 -145
  169. data/src/string.c +0 -48
  170. data/src/util/rbs_allocator.c +89 -71
  171. data/src/util/rbs_assert.c +1 -1
  172. data/src/util/rbs_buffer.c +2 -2
  173. data/src/util/rbs_constant_pool.c +10 -10
  174. data/src/util/rbs_encoding.c +4 -8
  175. data/src/util/rbs_unescape.c +56 -20
  176. data/stdlib/bigdecimal/0/big_decimal.rbs +100 -82
  177. data/stdlib/bigdecimal-math/0/big_math.rbs +169 -8
  178. data/stdlib/cgi/0/core.rbs +9 -393
  179. data/stdlib/cgi/0/manifest.yaml +1 -0
  180. data/stdlib/cgi-escape/0/escape.rbs +171 -0
  181. data/stdlib/coverage/0/coverage.rbs +3 -1
  182. data/stdlib/date/0/date.rbs +67 -59
  183. data/stdlib/date/0/date_time.rbs +1 -1
  184. data/stdlib/delegate/0/delegator.rbs +10 -7
  185. data/stdlib/digest/0/digest.rbs +110 -0
  186. data/stdlib/erb/0/erb.rbs +737 -347
  187. data/stdlib/fileutils/0/fileutils.rbs +20 -14
  188. data/stdlib/forwardable/0/forwardable.rbs +3 -0
  189. data/stdlib/json/0/json.rbs +82 -28
  190. data/stdlib/net-http/0/net-http.rbs +3 -0
  191. data/stdlib/objspace/0/objspace.rbs +9 -27
  192. data/stdlib/open-uri/0/open-uri.rbs +40 -0
  193. data/stdlib/open3/0/open3.rbs +459 -1
  194. data/stdlib/openssl/0/openssl.rbs +331 -228
  195. data/stdlib/optparse/0/optparse.rbs +8 -3
  196. data/stdlib/pathname/0/pathname.rbs +9 -1379
  197. data/stdlib/psych/0/psych.rbs +4 -4
  198. data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
  199. data/stdlib/rdoc/0/code_object.rbs +2 -1
  200. data/stdlib/rdoc/0/parser.rbs +1 -1
  201. data/stdlib/rdoc/0/rdoc.rbs +1 -1
  202. data/stdlib/rdoc/0/store.rbs +1 -1
  203. data/stdlib/resolv/0/resolv.rbs +25 -68
  204. data/stdlib/ripper/0/ripper.rbs +2 -2
  205. data/stdlib/securerandom/0/manifest.yaml +2 -0
  206. data/stdlib/securerandom/0/securerandom.rbs +6 -19
  207. data/stdlib/singleton/0/singleton.rbs +3 -0
  208. data/stdlib/socket/0/socket.rbs +13 -1
  209. data/stdlib/socket/0/tcp_socket.rbs +10 -2
  210. data/stdlib/stringio/0/stringio.rbs +1176 -85
  211. data/stdlib/strscan/0/string_scanner.rbs +31 -31
  212. data/stdlib/tempfile/0/tempfile.rbs +3 -3
  213. data/stdlib/time/0/time.rbs +1 -1
  214. data/stdlib/timeout/0/timeout.rbs +63 -7
  215. data/stdlib/tsort/0/cyclic.rbs +3 -0
  216. data/stdlib/uri/0/common.rbs +16 -2
  217. data/stdlib/uri/0/file.rbs +1 -1
  218. data/stdlib/uri/0/generic.rbs +24 -16
  219. data/stdlib/uri/0/rfc2396_parser.rbs +6 -7
  220. data/stdlib/zlib/0/gzip_reader.rbs +2 -2
  221. data/stdlib/zlib/0/gzip_writer.rbs +1 -1
  222. data/stdlib/zlib/0/zstream.rbs +1 -0
  223. metadata +30 -4
@@ -184,7 +184,8 @@ module FileUtils
184
184
 
185
185
  type mode = Integer | String
186
186
 
187
- type path = string | _ToPath
187
+ %a{deprecated: Use top-level `path` instead}
188
+ type path = ::path
188
189
 
189
190
  type pathlist = path | Array[path]
190
191
 
@@ -522,11 +523,13 @@ module FileUtils
522
523
  # symbolic links; other file types (FIFO streams, device files, etc.) are not
523
524
  # supported.
524
525
  #
525
- # Keyword arguments:
526
+ # Optional arguments:
526
527
  #
527
- # * `dereference_root: true` - if `src` is a symbolic link, follows the link.
528
- # * `preserve: true` - preserves file times.
529
- # * `remove_destination: true` - removes `dest` before copying files.
528
+ # * `dereference_root` - if `src` is a symbolic link, follows the link
529
+ # (`false` by default).
530
+ # * `preserve` - preserves file times (`false` by default).
531
+ # * `remove_destination` - removes `dest` before copying files (`false` by
532
+ # default).
530
533
  #
531
534
  # Related: [methods for copying](rdoc-ref:FileUtils@Copying).
532
535
  #
@@ -547,12 +550,13 @@ module FileUtils
547
550
  # FileUtils.copy_file('src0.txt', 'dest0.txt')
548
551
  # File.file?('dest0.txt') # => true
549
552
  #
550
- # Keyword arguments:
553
+ # Optional arguments:
551
554
  #
552
- # * `dereference: false` - if `src` is a symbolic link, does not follow the
553
- # link.
554
- # * `preserve: true` - preserves file times.
555
- # * `remove_destination: true` - removes `dest` before copying files.
555
+ # * `dereference` - if `src` is a symbolic link, follows the link (`true` by
556
+ # default).
557
+ # * `preserve` - preserves file times (`false` by default).
558
+ # * `remove_destination` - removes `dest` before copying files (`false` by
559
+ # default).
556
560
  #
557
561
  # Related: [methods for copying](rdoc-ref:FileUtils@Copying).
558
562
  #
@@ -963,13 +967,15 @@ module FileUtils
963
967
  # File.file?('dest1/dir1/t2.txt') # => true
964
968
  # File.file?('dest1/dir1/t3.txt') # => true
965
969
  #
966
- # Keyword arguments:
970
+ # Optional arguments:
967
971
  #
968
- # * `dereference_root: true` - dereferences `src` if it is a symbolic link.
969
- # * `remove_destination: true` - removes `dest` before creating links.
972
+ # * `dereference_root` - dereferences `src` if it is a symbolic link (`false`
973
+ # by default).
974
+ # * `remove_destination` - removes `dest` before creating links (`false` by
975
+ # default).
970
976
  #
971
977
  # Raises an exception if `dest` is the path to an existing file or directory and
972
- # keyword argument `remove_destination: true` is not given.
978
+ # optional argument `remove_destination` is not given.
973
979
  #
974
980
  # Related: FileUtils.ln (has different options).
975
981
  #
@@ -100,6 +100,9 @@ module Forwardable
100
100
  #
101
101
  VERSION: String
102
102
 
103
+ # <!-- rdoc-file=lib/forwardable.rb -->
104
+ # Version for backward compatibility
105
+ #
103
106
  FORWARDABLE_VERSION: String
104
107
 
105
108
  # <!--
@@ -1,5 +1,5 @@
1
1
  interface _ToJson
2
- def to_json: (?JSON::State state) -> String
2
+ def to_json: (?JSON::State? state) -> String
3
3
  end
4
4
 
5
5
  # <!-- rdoc-file=ext/json/lib/json/common.rb -->
@@ -199,6 +199,24 @@ end
199
199
  #
200
200
  # ---
201
201
  #
202
+ # Option `allow_duplicate_key` specifies whether duplicate keys in objects
203
+ # should be ignored or cause an error to be raised:
204
+ #
205
+ # When not specified:
206
+ # # The last value is used and a deprecation warning emitted.
207
+ # JSON.parse('{"a": 1, "a":2}') => {"a" => 2}
208
+ # # warning: detected duplicate keys in JSON object.
209
+ # # This will raise an error in json 3.0 unless enabled via `allow_duplicate_key: true`
210
+ #
211
+ # When set to ``true``
212
+ # # The last value is used.
213
+ # JSON.parse('{"a": 1, "a":2}') => {"a" => 2}
214
+ #
215
+ # When set to ``false``, the future default:
216
+ # JSON.parse('{"a": 1, "a":2}') => duplicate key at line 1 column 1 (JSON::ParserError)
217
+ #
218
+ # ---
219
+ #
202
220
  # Option `allow_nan` (boolean) specifies whether to allow NaN, Infinity, and
203
221
  # MinusInfinity in `source`; defaults to `false`.
204
222
  #
@@ -215,8 +233,22 @@ end
215
233
  # ruby = JSON.parse(source, {allow_nan: true})
216
234
  # ruby # => [NaN, Infinity, -Infinity]
217
235
  #
236
+ # ---
237
+ #
238
+ # Option `allow_trailing_comma` (boolean) specifies whether to allow trailing
239
+ # commas in objects and arrays; defaults to `false`.
240
+ #
241
+ # With the default, `false`:
242
+ # JSON.parse('[1,]') # unexpected character: ']' at line 1 column 4 (JSON::ParserError)
243
+ #
244
+ # When enabled:
245
+ # JSON.parse('[1,]', allow_trailing_comma: true) # => [1]
246
+ #
218
247
  # ###### Output Options
219
248
  #
249
+ # Option `freeze` (boolean) specifies whether the returned objects will be
250
+ # frozen; defaults to `false`.
251
+ #
220
252
  # Option `symbolize_names` (boolean) specifies whether returned Hash keys should
221
253
  # be Symbols; defaults to `false` (use Strings).
222
254
  #
@@ -345,6 +377,25 @@ end
345
377
  #
346
378
  # ---
347
379
  #
380
+ # Option `allow_duplicate_key` (boolean) specifies whether hashes with duplicate
381
+ # keys should be allowed or produce an error. defaults to emit a deprecation
382
+ # warning.
383
+ #
384
+ # With the default, (not set):
385
+ # Warning[:deprecated] = true
386
+ # JSON.generate({ foo: 1, "foo" => 2 })
387
+ # # warning: detected duplicate key "foo" in {foo: 1, "foo" => 2}.
388
+ # # This will raise an error in json 3.0 unless enabled via `allow_duplicate_key: true`
389
+ # # => '{"foo":1,"foo":2}'
390
+ #
391
+ # With `false`
392
+ # JSON.generate({ foo: 1, "foo" => 2 }, allow_duplicate_key: false)
393
+ # # detected duplicate key "foo" in {foo: 1, "foo" => 2} (JSON::GeneratorError)
394
+ #
395
+ # In version 3.0, `false` will become the default.
396
+ #
397
+ # ---
398
+ #
348
399
  # Option `max_nesting` (Integer) specifies the maximum nesting depth in `obj`;
349
400
  # defaults to `100`.
350
401
  #
@@ -420,6 +471,9 @@ end
420
471
  #
421
472
  # ## JSON Additions
422
473
  #
474
+ # Note that JSON Additions must only be used with trusted data, and is
475
+ # deprecated.
476
+ #
423
477
  # When you "round trip" a non-String object from Ruby to JSON and back, you have
424
478
  # a new String, instead of the object you began with:
425
479
  # ruby0 = Range.new(0, 2)
@@ -708,8 +762,6 @@ module JSON
708
762
  #
709
763
  def self.create_id=: (_ToS create_id) -> _ToS
710
764
 
711
- def self.deep_const_get: (interned path) -> untyped
712
-
713
765
  # <!--
714
766
  # rdoc-file=ext/json/lib/json/common.rb
715
767
  # - JSON.dump(obj, io = nil, limit = nil)
@@ -786,7 +838,7 @@ module JSON
786
838
  # -->
787
839
  # Returns a String containing the generated JSON data.
788
840
  #
789
- # See also JSON.fast_generate, JSON.pretty_generate.
841
+ # See also JSON.pretty_generate.
790
842
  #
791
843
  # Argument `obj` is the Ruby object to be converted to JSON.
792
844
  #
@@ -828,6 +880,7 @@ module JSON
828
880
 
829
881
  # <!--
830
882
  # rdoc-file=ext/json/lib/json/common.rb
883
+ # - JSON.load(source, options = {}) -> object
831
884
  # - JSON.load(source, proc = nil, options = {}) -> object
832
885
  # -->
833
886
  # Returns the Ruby objects created by parsing the given `source`.
@@ -940,6 +993,7 @@ module JSON
940
993
  # when Array
941
994
  # obj.map! {|v| deserialize_obj v }
942
995
  # end
996
+ # obj
943
997
  # })
944
998
  # pp ruby
945
999
  #
@@ -1172,7 +1226,7 @@ module Kernel
1172
1226
 
1173
1227
  # <!--
1174
1228
  # rdoc-file=ext/json/lib/json/common.rb
1175
- # - JSON(object, *args)
1229
+ # - JSON(object, opts = nil)
1176
1230
  # -->
1177
1231
  # If *object* is string-like, parse the string and return the parsed result as a
1178
1232
  # Ruby data structure. Otherwise, generate a JSON text from the Ruby data
@@ -1191,28 +1245,28 @@ class Object
1191
1245
  # it to a JSON string, and returns the result. This is a fallback, if no
1192
1246
  # special method #to_json was defined for some object.
1193
1247
  #
1194
- def to_json: (?JSON::State state) -> String
1248
+ def to_json: (?JSON::State? state) -> String
1195
1249
  end
1196
1250
 
1197
1251
  %a{annotate:rdoc:skip}
1198
1252
  class NilClass
1199
1253
  # Returns a JSON string for nil: 'null'.
1200
1254
  #
1201
- def to_json: (?JSON::State state) -> String
1255
+ def to_json: (?JSON::State? state) -> String
1202
1256
  end
1203
1257
 
1204
1258
  %a{annotate:rdoc:skip}
1205
1259
  class TrueClass
1206
1260
  # Returns a JSON string for true: 'true'.
1207
1261
  #
1208
- def to_json: (?JSON::State state) -> String
1262
+ def to_json: (?JSON::State? state) -> String
1209
1263
  end
1210
1264
 
1211
1265
  %a{annotate:rdoc:skip}
1212
1266
  class FalseClass
1213
1267
  # Returns a JSON string for false: 'false'.
1214
1268
  #
1215
- def to_json: (?JSON::State state) -> String
1269
+ def to_json: (?JSON::State? state) -> String
1216
1270
  end
1217
1271
 
1218
1272
  %a{annotate:rdoc:skip}
@@ -1221,21 +1275,21 @@ class String
1221
1275
  # returns a JSON string encoded with UTF16 big endian characters as
1222
1276
  # \u????.
1223
1277
  #
1224
- def to_json: (?JSON::State state) -> String
1278
+ def to_json: (?JSON::State? state) -> String
1225
1279
  end
1226
1280
 
1227
1281
  %a{annotate:rdoc:skip}
1228
1282
  class Integer
1229
1283
  # Returns a JSON string representation for this Integer number.
1230
1284
  #
1231
- def to_json: (?JSON::State state) -> String
1285
+ def to_json: (?JSON::State? state) -> String
1232
1286
  end
1233
1287
 
1234
1288
  %a{annotate:rdoc:skip}
1235
1289
  class Float
1236
1290
  # Returns a JSON string representation for this Float number.
1237
1291
  #
1238
- def to_json: (?JSON::State state) -> String
1292
+ def to_json: (?JSON::State? state) -> String
1239
1293
  end
1240
1294
 
1241
1295
  %a{annotate:rdoc:skip}
@@ -1245,7 +1299,7 @@ class Hash[unchecked out K, unchecked out V]
1245
1299
  # _state_ is a JSON::State object, that can also be used to configure the
1246
1300
  # produced JSON string output further.
1247
1301
  #
1248
- def to_json: (?JSON::State state) -> String
1302
+ def to_json: (?JSON::State? state) -> String
1249
1303
  end
1250
1304
 
1251
1305
  %a{annotate:rdoc:skip}
@@ -1255,7 +1309,7 @@ class Array[unchecked out Elem]
1255
1309
  # _state_ is a JSON::State object, that can also be used to configure the
1256
1310
  # produced JSON string output further.
1257
1311
  #
1258
- def to_json: (?JSON::State state) -> String
1312
+ def to_json: (?JSON::State? state) -> String
1259
1313
  end
1260
1314
 
1261
1315
  %a{annotate:rdoc:skip}
@@ -1309,7 +1363,7 @@ class BigDecimal
1309
1363
  # {"json_class":"BigDecimal","b":"36:0.2e1"}
1310
1364
  # {"json_class":"BigDecimal","b":"27:0.2e1"}
1311
1365
  #
1312
- def to_json: (?JSON::State state) -> String
1366
+ def to_json: (?JSON::State? state) -> String
1313
1367
  end
1314
1368
 
1315
1369
  %a{annotate:rdoc:skip}
@@ -1358,7 +1412,7 @@ class Complex
1358
1412
  # {"json_class":"Complex","r":2,"i":0}
1359
1413
  # {"json_class":"Complex","r":2.0,"i":4}
1360
1414
  #
1361
- def to_json: (?JSON::State state) -> String
1415
+ def to_json: (?JSON::State? state) -> String
1362
1416
  end
1363
1417
 
1364
1418
  %a{annotate:rdoc:skip}
@@ -1405,7 +1459,7 @@ class Date
1405
1459
  #
1406
1460
  # {"json_class":"Date","y":2023,"m":11,"d":21,"sg":2299161.0}
1407
1461
  #
1408
- def to_json: (?JSON::State state) -> String
1462
+ def to_json: (?JSON::State? state) -> String
1409
1463
  end
1410
1464
 
1411
1465
  %a{annotate:rdoc:skip}
@@ -1451,7 +1505,7 @@ class DateTime
1451
1505
  #
1452
1506
  # {"json_class":"DateTime","y":2023,"m":11,"d":21,"sg":2299161.0}
1453
1507
  #
1454
- def to_json: (?JSON::State state) -> String
1508
+ def to_json: (?JSON::State? state) -> String
1455
1509
  end
1456
1510
 
1457
1511
  %a{annotate:rdoc:skip}
@@ -1496,7 +1550,7 @@ class Exception
1496
1550
  #
1497
1551
  # {"json_class":"Exception","m":"Foo","b":null}
1498
1552
  #
1499
- def to_json: (?JSON::State state) -> String
1553
+ def to_json: (?JSON::State? state) -> String
1500
1554
  end
1501
1555
 
1502
1556
  %a{annotate:rdoc:skip}
@@ -1544,7 +1598,7 @@ class OpenStruct
1544
1598
  #
1545
1599
  # {"json_class":"OpenStruct","t":{'name':'Rowdy',"age":null}}
1546
1600
  #
1547
- def to_json: (?JSON::State state) -> String
1601
+ def to_json: (?JSON::State? state) -> String
1548
1602
  end
1549
1603
 
1550
1604
  %a{annotate:rdoc:skip}
@@ -1597,7 +1651,7 @@ class Range[out Elem]
1597
1651
  # {"json_class":"Range","a":[1,4,true]}
1598
1652
  # {"json_class":"Range","a":["a","d",false]}
1599
1653
  #
1600
- def to_json: (?JSON::State state) -> String
1654
+ def to_json: (?JSON::State? state) -> String
1601
1655
  end
1602
1656
 
1603
1657
  %a{annotate:rdoc:skip}
@@ -1644,7 +1698,7 @@ class Rational
1644
1698
  #
1645
1699
  # {"json_class":"Rational","n":2,"d":3}
1646
1700
  #
1647
- def to_json: (?JSON::State state) -> String
1701
+ def to_json: (?JSON::State? state) -> String
1648
1702
  end
1649
1703
 
1650
1704
  %a{annotate:rdoc:skip}
@@ -1690,7 +1744,7 @@ class Regexp
1690
1744
  #
1691
1745
  # {"json_class":"Regexp","o":0,"s":"foo"}
1692
1746
  #
1693
- def to_json: (?JSON::State state) -> String
1747
+ def to_json: (?JSON::State? state) -> String
1694
1748
  end
1695
1749
 
1696
1750
  %a{annotate:rdoc:skip}
@@ -1736,7 +1790,7 @@ class Set[unchecked out A]
1736
1790
  #
1737
1791
  # {"json_class":"Set","a":["foo","bar","baz"]}
1738
1792
  #
1739
- def to_json: (?JSON::State state) -> String
1793
+ def to_json: (?JSON::State? state) -> String
1740
1794
  end
1741
1795
 
1742
1796
  %a{annotate:rdoc:skip}
@@ -1785,7 +1839,7 @@ class Struct[Elem]
1785
1839
  #
1786
1840
  # {"json_class":"Struct","t":{'name':'Rowdy',"age":null}}
1787
1841
  #
1788
- def to_json: (?JSON::State state) -> String
1842
+ def to_json: (?JSON::State? state) -> String
1789
1843
  end
1790
1844
 
1791
1845
  %a{annotate:rdoc:skip}
@@ -1820,7 +1874,7 @@ class Symbol
1820
1874
 
1821
1875
  # <!--
1822
1876
  # rdoc-file=ext/json/lib/json/add/symbol.rb
1823
- # - to_json(*a)
1877
+ # - to_json(state = nil, *a)
1824
1878
  # -->
1825
1879
  # Returns a JSON string representing `self`:
1826
1880
  #
@@ -1831,7 +1885,7 @@ class Symbol
1831
1885
  #
1832
1886
  # # {"json_class":"Symbol","s":"foo"}
1833
1887
  #
1834
- def to_json: (?JSON::State state) -> String
1888
+ def to_json: (?JSON::State? state) -> String
1835
1889
  end
1836
1890
 
1837
1891
  %a{annotate:rdoc:skip}
@@ -1878,5 +1932,5 @@ class Time
1878
1932
  #
1879
1933
  # {"json_class":"Time","s":1700931678,"n":980650786}
1880
1934
  #
1881
- def to_json: (?JSON::State state) -> String
1935
+ def to_json: (?JSON::State? state) -> String
1882
1936
  end
@@ -4047,6 +4047,9 @@ module Net
4047
4047
  alias entity body
4048
4048
  end
4049
4049
 
4050
+ # <!-- rdoc-file=lib/net/http/responses.rb -->
4051
+ # Unknown HTTP response
4052
+ #
4050
4053
  class HTTPUnknownResponse < HTTPResponse
4051
4054
  HAS_BODY: bool
4052
4055
 
@@ -126,29 +126,6 @@ module ObjectSpace
126
126
  #
127
127
  def self?.count_imemo_objects: (?Hash[Symbol, Integer] result_hash) -> Hash[Symbol, Integer]
128
128
 
129
- # <!--
130
- # rdoc-file=ext/objspace/objspace.c
131
- # - ObjectSpace.count_nodes([result_hash]) -> hash
132
- # -->
133
- # Counts nodes for each node type.
134
- #
135
- # This method is only for MRI developers interested in performance and memory
136
- # usage of Ruby programs.
137
- #
138
- # It returns a hash as:
139
- #
140
- # {:NODE_METHOD=>2027, :NODE_FBODY=>1927, :NODE_CFUNC=>1798, ...}
141
- #
142
- # If the optional argument, result_hash, is given, it is overwritten and
143
- # returned. This is intended to avoid probe effect.
144
- #
145
- # Note: The contents of the returned hash is implementation defined. It may be
146
- # changed in future.
147
- #
148
- # This method is only expected to work with C Ruby.
149
- #
150
- def self?.count_nodes: (?Hash[Symbol, Integer] result_hash) -> Hash[Symbol, Integer]
151
-
152
129
  # <!--
153
130
  # rdoc-file=ext/objspace/objspace.c
154
131
  # - ObjectSpace.count_objects_size([result_hash]) -> hash
@@ -332,9 +309,11 @@ module ObjectSpace
332
309
  # information as only a **HINT**. Especially, the size of `T_DATA` may not be
333
310
  # correct.
334
311
  #
335
- # This method is only expected to work with C Ruby.
312
+ # This method is only expected to work with CRuby.
336
313
  #
337
- # From Ruby 2.2, memsize_of(obj) returns a memory size includes sizeof(RVALUE).
314
+ # From Ruby 3.2 with Variable Width Allocation, it returns the actual slot size
315
+ # used plus any additional memory allocated outside the slot (such as external
316
+ # strings, arrays, or hash tables).
338
317
  #
339
318
  def self?.memsize_of: (untyped) -> Integer
340
319
 
@@ -409,7 +388,7 @@ module ObjectSpace
409
388
  # ObjectSpace.reachable_objects_from(1)
410
389
  # #=> nil # 1 is not markable (heap managed) object
411
390
  #
412
- def self?.reachable_objects_from: (untyped) -> ([ untyped ] | nil)
391
+ def self?.reachable_objects_from: (untyped) -> (Array[untyped] | nil)
413
392
 
414
393
  # <!--
415
394
  # rdoc-file=ext/objspace/objspace.c
@@ -461,8 +440,11 @@ module ObjectSpace
461
440
 
462
441
  # <!--
463
442
  # rdoc-file=ext/objspace/object_tracing.c
464
- # - trace_object_allocations_debug_start()
443
+ # - trace_object_allocations_debug_start
465
444
  # -->
445
+ # Starts tracing object allocations for GC debugging. If you encounter the BUG
446
+ # "... is T_NONE" (and so on) on your application, please try this method at the
447
+ # beginning of your app.
466
448
  #
467
449
  def self?.trace_object_allocations_debug_start: () -> void
468
450
 
@@ -83,6 +83,46 @@ end
83
83
  # : Tanaka Akira <akr@m17n.org>
84
84
  #
85
85
  module OpenURI
86
+ # <!-- rdoc-file=lib/open-uri.rb -->
87
+ # Raised on HTTP session failure
88
+ #
89
+ class HTTPError < StandardError
90
+ # <!--
91
+ # rdoc-file=lib/open-uri.rb
92
+ # - new(message, io)
93
+ # -->
94
+ #
95
+ def initialize: (String message, (StringIO & OpenURI::Meta) io) -> void
96
+
97
+ # <!-- rdoc-file=lib/open-uri.rb -->
98
+ # StringIO having the received data
99
+ #
100
+ attr_reader io: StringIO & OpenURI::Meta
101
+ end
102
+
103
+ # <!-- rdoc-file=lib/open-uri.rb -->
104
+ # Raised on redirection, only occurs when `redirect` option for HTTP is `false`.
105
+ #
106
+ class HTTPRedirect < HTTPError
107
+ # <!--
108
+ # rdoc-file=lib/open-uri.rb
109
+ # - new(message, io, uri)
110
+ # -->
111
+ #
112
+ def initialize: (String message, (StringIO & OpenURI::Meta) io, URI uri) -> void
113
+
114
+ # <!-- rdoc-file=lib/open-uri.rb -->
115
+ # URI to redirect
116
+ #
117
+ attr_reader uri: URI
118
+ end
119
+
120
+ # <!-- rdoc-file=lib/open-uri.rb -->
121
+ # Raised on too many redirection,
122
+ #
123
+ class TooManyRedirects < HTTPError
124
+ end
125
+
86
126
  # <!-- rdoc-file=lib/open-uri.rb -->
87
127
  # Mixin for holding meta-information.
88
128
  #