rbs 3.1.3 → 3.2.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +0 -6
  3. data/CHANGELOG.md +68 -0
  4. data/Gemfile +0 -6
  5. data/Gemfile.lock +12 -21
  6. data/README.md +1 -1
  7. data/Rakefile +44 -0
  8. data/Steepfile +3 -3
  9. data/core/array.rbs +0 -8
  10. data/core/builtin.rbs +28 -8
  11. data/core/constants.rbs +13 -5
  12. data/core/exception.rbs +1 -1
  13. data/core/global_variables.rbs +27 -27
  14. data/core/io.rbs +163 -172
  15. data/core/kernel.rbs +7 -4
  16. data/core/module.rbs +34 -32
  17. data/core/object.rbs +2 -2
  18. data/core/string_io.rbs +9 -0
  19. data/core/thread.rbs +25 -1
  20. data/core/time.rbs +3 -3
  21. data/docs/CONTRIBUTING.md +1 -1
  22. data/docs/rbs_by_example.md +16 -35
  23. data/docs/repo.md +1 -1
  24. data/docs/sigs.md +7 -7
  25. data/docs/stdlib.md +2 -3
  26. data/docs/syntax.md +40 -40
  27. data/lib/rbs/cli.rb +15 -4
  28. data/lib/rbs/collection/installer.rb +5 -2
  29. data/lib/rbs/collection/sources/stdlib.rb +5 -1
  30. data/lib/rbs/errors.rb +8 -1
  31. data/lib/rbs/file_finder.rb +1 -1
  32. data/lib/rbs/prototype/rb.rb +64 -6
  33. data/lib/rbs/prototype/rbi.rb +2 -6
  34. data/lib/rbs/prototype/runtime.rb +29 -8
  35. data/lib/rbs/subtractor.rb +17 -0
  36. data/lib/rbs/type_name.rb +4 -4
  37. data/lib/rbs/version.rb +1 -1
  38. data/rbs.gemspec +1 -1
  39. data/schema/decls.json +1 -1
  40. data/sig/errors.rbs +54 -0
  41. data/sig/parser.rbs +2 -2
  42. data/sig/prototype/rb.rbs +9 -1
  43. data/sig/subtractor.rbs +4 -0
  44. data/stdlib/logger/0/logger.rbs +1 -1
  45. data/stdlib/observable/0/observable.rbs +219 -0
  46. data/stdlib/uri/0/common.rbs +24 -0
  47. data/stdlib/zlib/0/buf_error.rbs +79 -0
  48. data/stdlib/zlib/0/data_error.rbs +79 -0
  49. data/stdlib/zlib/0/deflate.rbs +276 -0
  50. data/stdlib/zlib/0/error.rbs +89 -0
  51. data/stdlib/zlib/0/gzip_file/crc_error.rbs +115 -0
  52. data/stdlib/zlib/0/gzip_file/error.rbs +128 -0
  53. data/stdlib/zlib/0/gzip_file/length_error.rbs +115 -0
  54. data/stdlib/zlib/0/gzip_file/no_footer.rbs +114 -0
  55. data/stdlib/zlib/0/gzip_file.rbs +228 -0
  56. data/stdlib/zlib/0/gzip_reader.rbs +362 -0
  57. data/stdlib/zlib/0/gzip_writer.rbs +237 -0
  58. data/stdlib/zlib/0/inflate.rbs +249 -0
  59. data/stdlib/zlib/0/mem_error.rbs +79 -0
  60. data/stdlib/zlib/0/need_dict.rbs +82 -0
  61. data/stdlib/zlib/0/stream_end.rbs +80 -0
  62. data/stdlib/zlib/0/stream_error.rbs +80 -0
  63. data/stdlib/zlib/0/version_error.rbs +80 -0
  64. data/stdlib/zlib/0/zstream.rbs +270 -0
  65. metadata +24 -8
  66. data/stdlib/prime/0/integer-extension.rbs +0 -41
  67. data/stdlib/prime/0/manifest.yaml +0 -2
  68. data/stdlib/prime/0/prime.rbs +0 -372
data/core/io.rbs CHANGED
@@ -694,7 +694,7 @@ class IO < Object
694
694
  # # ...
695
695
  # f.gets # won't cause Errno::EBADF
696
696
  #
697
- def autoclose=: (boolish) -> untyped
697
+ def autoclose=: (boolish bool) -> boolish
698
698
 
699
699
  # <!--
700
700
  # rdoc-file=io.c
@@ -756,7 +756,7 @@ class IO < Object
756
756
  #
757
757
  # Related: IO#close_read, IO#close_write, IO#closed?.
758
758
  #
759
- def close: () -> NilClass
759
+ def close: () -> nil
760
760
 
761
761
  # <!--
762
762
  # rdoc-file=io.c
@@ -775,7 +775,7 @@ class IO < Object
775
775
  # (via system() method for example). If you really needs file descriptor
776
776
  # inheritance to child process, use spawn()'s argument such as fd=>fd.
777
777
  #
778
- def close_on_exec=: (boolish) -> untyped
778
+ def close_on_exec=: (boolish bool) -> nil
779
779
 
780
780
  # <!--
781
781
  # rdoc-file=io.c
@@ -821,7 +821,7 @@ class IO < Object
821
821
  #
822
822
  # Related: IO#close, IO#close_write, IO#closed?.
823
823
  #
824
- def close_read: () -> NilClass
824
+ def close_read: () -> nil
825
825
 
826
826
  # <!--
827
827
  # rdoc-file=io.c
@@ -853,7 +853,7 @@ class IO < Object
853
853
  #
854
854
  # Related: IO#close, IO#close_read, IO#closed?.
855
855
  #
856
- def close_write: () -> NilClass
856
+ def close_write: () -> nil
857
857
 
858
858
  # <!--
859
859
  # rdoc-file=io.c
@@ -880,113 +880,6 @@ class IO < Object
880
880
  #
881
881
  def closed?: () -> bool
882
882
 
883
- # <!--
884
- # rdoc-file=io.c
885
- # - each_line(sep = $/, chomp: false) {|line| ... } -> self
886
- # - each_line(limit, chomp: false) {|line| ... } -> self
887
- # - each_line(sep, limit, chomp: false) {|line| ... } -> self
888
- # - each_line -> enumerator
889
- # -->
890
- # Calls the block with each remaining line read from the stream; returns `self`.
891
- # Does nothing if already at end-of-stream; See [Line IO](rdoc-ref:IO@Line+IO).
892
- #
893
- # With no arguments given, reads lines as determined by line separator `$/`:
894
- #
895
- # f = File.new('t.txt')
896
- # f.each_line {|line| p line }
897
- # f.each_line {|line| fail 'Cannot happen' }
898
- # f.close
899
- #
900
- # Output:
901
- #
902
- # "First line\n"
903
- # "Second line\n"
904
- # "\n"
905
- # "Fourth line\n"
906
- # "Fifth line\n"
907
- #
908
- # With only string argument `sep` given, reads lines as determined by line
909
- # separator `sep`; see [Line Separator](rdoc-ref:IO@Line+Separator):
910
- #
911
- # f = File.new('t.txt')
912
- # f.each_line('li') {|line| p line }
913
- # f.close
914
- #
915
- # Output:
916
- #
917
- # "First li"
918
- # "ne\nSecond li"
919
- # "ne\n\nFourth li"
920
- # "ne\nFifth li"
921
- # "ne\n"
922
- #
923
- # The two special values for `sep` are honored:
924
- #
925
- # f = File.new('t.txt')
926
- # # Get all into one string.
927
- # f.each_line(nil) {|line| p line }
928
- # f.close
929
- #
930
- # Output:
931
- #
932
- # "First line\nSecond line\n\nFourth line\nFifth line\n"
933
- #
934
- # f.rewind
935
- # # Get paragraphs (up to two line separators).
936
- # f.each_line('') {|line| p line }
937
- #
938
- # Output:
939
- #
940
- # "First line\nSecond line\n\n"
941
- # "Fourth line\nFifth line\n"
942
- #
943
- # With only integer argument `limit` given, limits the number of bytes in each
944
- # line; see [Line Limit](rdoc-ref:IO@Line+Limit):
945
- #
946
- # f = File.new('t.txt')
947
- # f.each_line(8) {|line| p line }
948
- # f.close
949
- #
950
- # Output:
951
- #
952
- # "First li"
953
- # "ne\n"
954
- # "Second l"
955
- # "ine\n"
956
- # "\n"
957
- # "Fourth l"
958
- # "ine\n"
959
- # "Fifth li"
960
- # "ne\n"
961
- #
962
- # With arguments `sep` and `limit` given, combines the two behaviors:
963
- #
964
- # * Calls with the next line as determined by line separator `sep`.
965
- # * But returns no more bytes than are allowed by the limit.
966
- #
967
- #
968
- # Optional keyword argument `chomp` specifies whether line separators are to be
969
- # omitted:
970
- #
971
- # f = File.new('t.txt')
972
- # f.each_line(chomp: true) {|line| p line }
973
- # f.close
974
- #
975
- # Output:
976
- #
977
- # "First line"
978
- # "Second line"
979
- # ""
980
- # "Fourth line"
981
- # "Fifth line"
982
- #
983
- # Returns an Enumerator if no block is given.
984
- #
985
- # IO#each is an alias for IO#each_line.
986
- #
987
- def each: (?String sep, ?Integer limit) { (String arg0) -> untyped } -> self
988
- | (?String sep, ?Integer limit) -> ::Enumerator[String, self]
989
-
990
883
  # <!--
991
884
  # rdoc-file=io.c
992
885
  # - each_byte {|byte| ... } -> self
@@ -1005,7 +898,7 @@ class IO < Object
1005
898
  #
1006
899
  # Related: IO#each_char, IO#each_codepoint.
1007
900
  #
1008
- def each_byte: () { (Integer arg0) -> untyped } -> self
901
+ def each_byte: () { (Integer byte) -> void } -> self
1009
902
  | () -> ::Enumerator[Integer, self]
1010
903
 
1011
904
  # <!--
@@ -1026,7 +919,7 @@ class IO < Object
1026
919
  #
1027
920
  # Related: IO#each_byte, IO#each_codepoint.
1028
921
  #
1029
- def each_char: () { (String arg0) -> untyped } -> self
922
+ def each_char: () { (String c) -> void } -> self
1030
923
  | () -> ::Enumerator[String, self]
1031
924
 
1032
925
  # <!--
@@ -1046,7 +939,7 @@ class IO < Object
1046
939
  #
1047
940
  # Related: IO#each_byte, IO#each_char.
1048
941
  #
1049
- def each_codepoint: () { (Integer arg0) -> untyped } -> self
942
+ def each_codepoint: () { (Integer c) -> void } -> self
1050
943
  | () -> ::Enumerator[Integer, self]
1051
944
 
1052
945
  # <!--
@@ -1101,7 +994,7 @@ class IO < Object
1101
994
  #
1102
995
  # Not implemented on all platforms.
1103
996
  #
1104
- def fcntl: (Integer integer_cmd, String | Integer arg) -> Integer
997
+ def fcntl: (Integer integer_cmd, String | Integer argument) -> Integer
1105
998
 
1106
999
  # <!--
1107
1000
  # rdoc-file=io.c
@@ -1309,7 +1202,7 @@ class IO < Object
1309
1202
  # IO.new(fd, internal_encoding: nil) # => #<IO:fd 3>
1310
1203
  # IO.new(fd, autoclose: true) # => #<IO:fd 3>
1311
1204
  #
1312
- def initialize: (int fd, ?string | int mode, ?path: string?, **untyped opts) -> void
1205
+ def initialize: ( int fd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String) -> void
1313
1206
 
1314
1207
  # <!--
1315
1208
  # rdoc-file=io.c
@@ -1349,7 +1242,7 @@ class IO < Object
1349
1242
  #
1350
1243
  # Not implemented on all platforms.
1351
1244
  #
1352
- def ioctl: (Integer integer_cmd, String | Integer arg) -> Integer
1245
+ def ioctl: (Integer integer_cmd, String | Integer argument) -> Integer
1353
1246
 
1354
1247
  # <!--
1355
1248
  # rdoc-file=io.c
@@ -1383,7 +1276,7 @@ class IO < Object
1383
1276
  # Sets and returns the line number for the stream; see [Line
1384
1277
  # Number](rdoc-ref:IO@Line+Number).
1385
1278
  #
1386
- def lineno=: (Integer arg0) -> Integer
1279
+ def lineno=: (Integer integer) -> Integer
1387
1280
 
1388
1281
  # <!--
1389
1282
  # rdoc-file=io.c
@@ -1421,22 +1314,6 @@ class IO < Object
1421
1314
  #
1422
1315
  def pid: () -> Integer
1423
1316
 
1424
- # <!-- rdoc-file=io.c -->
1425
- # Returns the current position (in bytes) in `self` (see
1426
- # [Position](rdoc-ref:IO@Position)):
1427
- #
1428
- # f = File.open('t.txt')
1429
- # f.tell # => 0
1430
- # f.gets # => "First line\n"
1431
- # f.tell # => 12
1432
- # f.close
1433
- #
1434
- # Related: IO#pos=, IO#seek.
1435
- #
1436
- # IO#pos is an alias for IO#tell.
1437
- #
1438
- def pos: () -> Integer
1439
-
1440
1317
  # <!--
1441
1318
  # rdoc-file=io.c
1442
1319
  # - pos = new_position -> new_position
@@ -1452,7 +1329,7 @@ class IO < Object
1452
1329
  #
1453
1330
  # Related: IO#seek, IO#tell.
1454
1331
  #
1455
- def pos=: (Integer arg0) -> Integer
1332
+ def pos=: (Integer new_position) -> Integer
1456
1333
 
1457
1334
  # <!--
1458
1335
  # rdoc-file=io.c
@@ -1508,7 +1385,7 @@ class IO < Object
1508
1385
  # f.print
1509
1386
  # f.close
1510
1387
  #
1511
- def print: (*untyped arg0) -> NilClass
1388
+ def print: (*untyped objects) -> nil
1512
1389
 
1513
1390
  # <!--
1514
1391
  # rdoc-file=io.c
@@ -1519,7 +1396,7 @@ class IO < Object
1519
1396
  # For details on `format_string`, see [Format
1520
1397
  # Specifications](rdoc-ref:format_specifications.rdoc).
1521
1398
  #
1522
- def printf: (String format_string, *untyped arg0) -> NilClass
1399
+ def printf: (String format_string, *untyped objects) -> nil
1523
1400
 
1524
1401
  # <!--
1525
1402
  # rdoc-file=io.c
@@ -1539,7 +1416,7 @@ class IO < Object
1539
1416
  #
1540
1417
  # AA
1541
1418
  #
1542
- def putc: (Numeric | String arg0) -> untyped
1419
+ def putc: (Numeric | String object) -> (Numeric | String)
1543
1420
 
1544
1421
  # <!--
1545
1422
  # rdoc-file=io.c
@@ -1586,7 +1463,7 @@ class IO < Object
1586
1463
  # # Nested arrays.
1587
1464
  # show([[[0, 1], 2, 3], 4, 5]) # => "0\n1\n2\n3\n4\n5\n"
1588
1465
  #
1589
- def puts: (*untyped arg0) -> NilClass
1466
+ def puts: (*untyped objects) -> nil
1590
1467
 
1591
1468
  # <!--
1592
1469
  # rdoc-file=io.c
@@ -2132,7 +2009,7 @@ class IO < Object
2132
2009
  #
2133
2010
  # Related: IO#fsync.
2134
2011
  #
2135
- def sync=: (boolish) -> untyped
2012
+ def sync=: (boolish boolean) -> boolish
2136
2013
 
2137
2014
  # <!--
2138
2015
  # rdoc-file=io.c
@@ -2172,7 +2049,7 @@ class IO < Object
2172
2049
  #
2173
2050
  # This methods should not be used with other stream-writer methods.
2174
2051
  #
2175
- def syswrite: (_ToS arg0) -> Integer
2052
+ def syswrite: (_ToS object) -> Integer
2176
2053
 
2177
2054
  # <!--
2178
2055
  # rdoc-file=io.c
@@ -2193,6 +2070,22 @@ class IO < Object
2193
2070
  #
2194
2071
  def tell: () -> Integer
2195
2072
 
2073
+ # <!-- rdoc-file=io.c -->
2074
+ # Returns the current position (in bytes) in `self` (see
2075
+ # [Position](rdoc-ref:IO@Position)):
2076
+ #
2077
+ # f = File.open('t.txt')
2078
+ # f.tell # => 0
2079
+ # f.gets # => "First line\n"
2080
+ # f.tell # => 12
2081
+ # f.close
2082
+ #
2083
+ # Related: IO#pos=, IO#seek.
2084
+ #
2085
+ # IO#pos is an alias for IO#tell.
2086
+ #
2087
+ alias pos tell
2088
+
2196
2089
  # <!--
2197
2090
  # rdoc-file=io.c
2198
2091
  # - timeout -> duration or nil
@@ -2219,7 +2112,7 @@ class IO < Object
2219
2112
  # effort to prevent an application from hanging on slow I/O operations, such as
2220
2113
  # those that occur during a slowloris attack.
2221
2114
  #
2222
- def timeout=: (Numeric?) -> void
2115
+ def timeout=: (Numeric? duration) -> void
2223
2116
 
2224
2117
  # <!--
2225
2118
  # rdoc-file=io.c
@@ -2240,7 +2133,7 @@ class IO < Object
2240
2133
  #
2241
2134
  # IO#tty? is an alias for IO#isatty.
2242
2135
  #
2243
- def tty?: () -> bool
2136
+ alias tty? isatty
2244
2137
 
2245
2138
  # <!--
2246
2139
  # rdoc-file=io.c
@@ -2280,7 +2173,7 @@ class IO < Object
2280
2173
  # f.read # => "BCDE012"
2281
2174
  # f.close
2282
2175
  #
2283
- def ungetbyte: (String | Integer arg0) -> NilClass
2176
+ def ungetbyte: (String | Integer object) -> nil
2284
2177
 
2285
2178
  # <!--
2286
2179
  # rdoc-file=io.c
@@ -2323,7 +2216,7 @@ class IO < Object
2323
2216
  # f.getc.ord # => 1090
2324
2217
  # f.close
2325
2218
  #
2326
- def ungetc: (String arg0) -> NilClass
2219
+ def ungetc: (String object) -> nil
2327
2220
 
2328
2221
  # <!--
2329
2222
  # rdoc-file=io.c
@@ -2647,7 +2540,10 @@ class IO < Object
2647
2540
  #
2648
2541
  # Raises exceptions that IO.pipe and Kernel.spawn raise.
2649
2542
  #
2650
- def self.popen: (*untyped args) -> untyped
2543
+ def self.popen: (string cmd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?unsetenv_others: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: Kernel::redirect_fd, ?out: Kernel::redirect_fd, ?err: Kernel::redirect_fd, ?close_others: boolish, ?chdir: String) -> instance
2544
+ | (Hash[string, string?] env, string cmd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?unsetenv_others: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: Kernel::redirect_fd, ?out: Kernel::redirect_fd, ?err: Kernel::redirect_fd, ?close_others: boolish, ?chdir: String) -> instance
2545
+ | [X] (string cmd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?unsetenv_others: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: Kernel::redirect_fd, ?out: Kernel::redirect_fd, ?err: Kernel::redirect_fd, ?close_others: boolish, ?chdir: String) { (instance) -> X } -> X
2546
+ | [X] (Hash[string, string?] env, string cmd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?unsetenv_others: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: Kernel::redirect_fd, ?out: Kernel::redirect_fd, ?err: Kernel::redirect_fd, ?close_others: boolish, ?chdir: String) { (instance) -> X } -> X
2651
2547
 
2652
2548
  # <!--
2653
2549
  # rdoc-file=io.c
@@ -2740,8 +2636,8 @@ class IO < Object
2740
2636
  #
2741
2637
  # Returns an Enumerator if no block is given.
2742
2638
  #
2743
- def self.foreach: (string | _ToPath path, ?String sep, ?Integer limit, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode, ?chomp: boolish) { (String line) -> void } -> nil
2744
- | (string | _ToPath path, ?String sep, ?Integer limit, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode, ?chomp: boolish) -> ::Enumerator[String, nil]
2639
+ def self.foreach: (string | _ToPath path, ?String sep, ?Integer limit, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?chomp: boolish) { (String line) -> void } -> nil
2640
+ | (string | _ToPath path, ?String sep, ?Integer limit, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?chomp: boolish) -> ::Enumerator[String, nil]
2745
2641
 
2746
2642
  # <!--
2747
2643
  # rdoc-file=io.c
@@ -2821,8 +2717,8 @@ class IO < Object
2821
2717
  # Sending message to parent
2822
2718
  # Parent got: <Hi Dad>
2823
2719
  #
2824
- def self.pipe: (?String | Encoding ext_or_ext_int_enc, ?String | Encoding int_enc, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode, ?chomp: boolish) -> [IO, IO]
2825
- | [X] (?String | Encoding ext_or_ext_int_enc, ?String | Encoding int_enc, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode, ?chomp: boolish) { (IO read_io, IO write_io) -> X } -> X
2720
+ def self.pipe: (?String | Encoding | nil ext_or_ext_int_enc, ?String | Encoding | nil int_enc, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?chomp: boolish) -> [IO, IO]
2721
+ | [X] (?String | Encoding | nil ext_or_ext_int_enc, ?String | Encoding | nil int_enc, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?chomp: boolish) { (IO read_io, IO write_io) -> X } -> X
2826
2722
 
2827
2723
  # <!--
2828
2724
  # rdoc-file=io.c
@@ -2879,7 +2775,7 @@ class IO < Object
2879
2775
  # * [Open Options](rdoc-ref:IO@Open+Options).
2880
2776
  # * [Encoding options](rdoc-ref:encodings.rdoc@Encoding+Options).
2881
2777
  #
2882
- def self.read: (String name, ?Integer length, ?Integer offset, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode) -> String
2778
+ def self.read: (String name, ?Integer length, ?Integer offset, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String) -> String
2883
2779
 
2884
2780
  # <!--
2885
2781
  # rdoc-file=io.c
@@ -2950,7 +2846,7 @@ class IO < Object
2950
2846
  # * [Encoding options](rdoc-ref:encodings.rdoc@Encoding+Options).
2951
2847
  # * [Line Options](rdoc-ref:IO@Line+Options).
2952
2848
  #
2953
- def self.readlines: (String | _ToPath name, ?String sep, ?Integer limit, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode, ?chomp: boolish) -> ::Array[String]
2849
+ def self.readlines: (String | _ToPath name, ?String sep, ?Integer limit, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String, ?chomp: boolish) -> ::Array[String]
2954
2850
 
2955
2851
  # <!--
2956
2852
  # rdoc-file=io.c
@@ -3121,7 +3017,8 @@ class IO < Object
3121
3017
  # IO.try_convert(ARGF) # => #<IO:<STDIN>>
3122
3018
  # IO.try_convert('STDOUT') # => nil
3123
3019
  #
3124
- def self.try_convert: (untyped arg0) -> IO?
3020
+ def self.try_convert: (_ToIO obj) -> IO
3021
+ | (untyped obj) -> IO?
3125
3022
 
3126
3023
  # <!--
3127
3024
  # rdoc-file=io.c
@@ -3182,7 +3079,7 @@ class IO < Object
3182
3079
  # * [Open Options](rdoc-ref:IO@Open+Options).
3183
3080
  # * [Encoding options](rdoc-ref:encodings.rdoc@Encoding+Options).
3184
3081
  #
3185
- def self.write: (String name, _ToS arg0, ?Integer offset, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode) -> Integer
3082
+ def self.write: (String path, _ToS data, ?Integer offset, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String) -> Integer
3186
3083
 
3187
3084
  # <!--
3188
3085
  # rdoc-file=io.c
@@ -3204,17 +3101,8 @@ class IO < Object
3204
3101
  # With a block given, calls the block with the IO object and returns the block's
3205
3102
  # value.
3206
3103
  #
3207
- def self.open: (int fd, ?string | int mode, ?path: string?, **untyped opts) -> instance
3208
- | [A] (int fd, ?string | int mode, ?path: string?, **untyped opts) { (instance) -> A } -> A
3209
-
3210
- def bytes: () { (Integer arg0) -> untyped } -> self
3211
- | () -> ::Enumerator[Integer, self]
3212
-
3213
- def chars: () { (String arg0) -> untyped } -> self
3214
- | () -> ::Enumerator[String, self]
3215
-
3216
- def codepoints: () { (Integer arg0) -> untyped } -> self
3217
- | () -> ::Enumerator[Integer, self]
3104
+ def self.open: (int fd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String) -> instance
3105
+ | [X] (int fd, ?string | int mode, ?path: string?, ?external_encoding: String | Encoding | nil, ?internal_encoding: String | Encoding | nil, ?encoding: String | Encoding | nil, ?textmode: boolish, ?binmode: boolish, ?autoclose: boolish, ?mode: String) { (instance) -> X } -> X
3218
3106
 
3219
3107
  # <!-- rdoc-file=io.c -->
3220
3108
  # Calls the block with each remaining line read from the stream; returns `self`.
@@ -3314,9 +3202,115 @@ class IO < Object
3314
3202
  #
3315
3203
  # IO#each is an alias for IO#each_line.
3316
3204
  #
3317
- def each_line: (?String sep, ?Integer limit) { (String arg0) -> untyped } -> self
3205
+ def each_line: (?String sep, ?Integer limit) { (String line) -> void } -> self
3318
3206
  | (?String sep, ?Integer limit) -> ::Enumerator[String, self]
3319
3207
 
3208
+ # <!--
3209
+ # rdoc-file=io.c
3210
+ # - each_line(sep = $/, chomp: false) {|line| ... } -> self
3211
+ # - each_line(limit, chomp: false) {|line| ... } -> self
3212
+ # - each_line(sep, limit, chomp: false) {|line| ... } -> self
3213
+ # - each_line -> enumerator
3214
+ # -->
3215
+ # Calls the block with each remaining line read from the stream; returns `self`.
3216
+ # Does nothing if already at end-of-stream; See [Line IO](rdoc-ref:IO@Line+IO).
3217
+ #
3218
+ # With no arguments given, reads lines as determined by line separator `$/`:
3219
+ #
3220
+ # f = File.new('t.txt')
3221
+ # f.each_line {|line| p line }
3222
+ # f.each_line {|line| fail 'Cannot happen' }
3223
+ # f.close
3224
+ #
3225
+ # Output:
3226
+ #
3227
+ # "First line\n"
3228
+ # "Second line\n"
3229
+ # "\n"
3230
+ # "Fourth line\n"
3231
+ # "Fifth line\n"
3232
+ #
3233
+ # With only string argument `sep` given, reads lines as determined by line
3234
+ # separator `sep`; see [Line Separator](rdoc-ref:IO@Line+Separator):
3235
+ #
3236
+ # f = File.new('t.txt')
3237
+ # f.each_line('li') {|line| p line }
3238
+ # f.close
3239
+ #
3240
+ # Output:
3241
+ #
3242
+ # "First li"
3243
+ # "ne\nSecond li"
3244
+ # "ne\n\nFourth li"
3245
+ # "ne\nFifth li"
3246
+ # "ne\n"
3247
+ #
3248
+ # The two special values for `sep` are honored:
3249
+ #
3250
+ # f = File.new('t.txt')
3251
+ # # Get all into one string.
3252
+ # f.each_line(nil) {|line| p line }
3253
+ # f.close
3254
+ #
3255
+ # Output:
3256
+ #
3257
+ # "First line\nSecond line\n\nFourth line\nFifth line\n"
3258
+ #
3259
+ # f.rewind
3260
+ # # Get paragraphs (up to two line separators).
3261
+ # f.each_line('') {|line| p line }
3262
+ #
3263
+ # Output:
3264
+ #
3265
+ # "First line\nSecond line\n\n"
3266
+ # "Fourth line\nFifth line\n"
3267
+ #
3268
+ # With only integer argument `limit` given, limits the number of bytes in each
3269
+ # line; see [Line Limit](rdoc-ref:IO@Line+Limit):
3270
+ #
3271
+ # f = File.new('t.txt')
3272
+ # f.each_line(8) {|line| p line }
3273
+ # f.close
3274
+ #
3275
+ # Output:
3276
+ #
3277
+ # "First li"
3278
+ # "ne\n"
3279
+ # "Second l"
3280
+ # "ine\n"
3281
+ # "\n"
3282
+ # "Fourth l"
3283
+ # "ine\n"
3284
+ # "Fifth li"
3285
+ # "ne\n"
3286
+ #
3287
+ # With arguments `sep` and `limit` given, combines the two behaviors:
3288
+ #
3289
+ # * Calls with the next line as determined by line separator `sep`.
3290
+ # * But returns no more bytes than are allowed by the limit.
3291
+ #
3292
+ #
3293
+ # Optional keyword argument `chomp` specifies whether line separators are to be
3294
+ # omitted:
3295
+ #
3296
+ # f = File.new('t.txt')
3297
+ # f.each_line(chomp: true) {|line| p line }
3298
+ # f.close
3299
+ #
3300
+ # Output:
3301
+ #
3302
+ # "First line"
3303
+ # "Second line"
3304
+ # ""
3305
+ # "Fourth line"
3306
+ # "Fifth line"
3307
+ #
3308
+ # Returns an Enumerator if no block is given.
3309
+ #
3310
+ # IO#each is an alias for IO#each_line.
3311
+ #
3312
+ alias each each_line
3313
+
3320
3314
  # <!-- rdoc-file=io.c -->
3321
3315
  # Returns `true` if the stream is positioned at its end, `false` otherwise; see
3322
3316
  # [Position](rdoc-ref:IO@Position):
@@ -3350,10 +3344,7 @@ class IO < Object
3350
3344
  #
3351
3345
  # IO#eof? is an alias for IO#eof.
3352
3346
  #
3353
- def eof?: () -> bool
3354
-
3355
- def lines: (?String sep, ?Integer limit) { (String arg0) -> untyped } -> self
3356
- | (?String sep, ?Integer limit) -> ::Enumerator[String, self]
3347
+ alias eof? eof
3357
3348
 
3358
3349
  # <!-- rdoc-file=io.c -->
3359
3350
  # Returns the integer file descriptor for the stream:
@@ -3366,7 +3357,7 @@ class IO < Object
3366
3357
  #
3367
3358
  # IO#to_i is an alias for IO#fileno.
3368
3359
  #
3369
- def to_i: () -> Integer
3360
+ alias to_i fileno
3370
3361
  end
3371
3362
 
3372
3363
  IO::APPEND: Integer
data/core/kernel.rbs CHANGED
@@ -807,7 +807,7 @@ module Kernel : BasicObject
807
807
  #
808
808
  # Process.exit!(true)
809
809
  #
810
- def self?.exit!: (Integer | TrueClass | FalseClass status) -> bot
810
+ def self?.exit!: (?Integer | TrueClass | FalseClass status) -> bot
811
811
 
812
812
  # <!-- rdoc-file=eval.c -->
813
813
  # With no arguments, raises the exception in `$!` or raises a RuntimeError if
@@ -1241,7 +1241,8 @@ module Kernel : BasicObject
1241
1241
  # [0..4, 0..4, 0..4]
1242
1242
  #
1243
1243
  def self?.p: [T] (T arg0) -> T
1244
- | (*untyped arg0) -> Array[untyped]
1244
+ | (untyped, untyped, *untyped) -> Array[untyped]
1245
+ | () -> nil
1245
1246
 
1246
1247
  # <!--
1247
1248
  # rdoc-file=lib/pp.rb
@@ -1252,7 +1253,8 @@ module Kernel : BasicObject
1252
1253
  # pp returns argument(s).
1253
1254
  #
1254
1255
  def self?.pp: [T] (T arg0) -> T
1255
- | (*untyped arg0) -> Array[untyped]
1256
+ | (untyped, untyped, *untyped) -> Array[untyped]
1257
+ | () -> nil
1256
1258
 
1257
1259
  # <!--
1258
1260
  # rdoc-file=random.c
@@ -1770,7 +1772,8 @@ module Kernel : BasicObject
1770
1772
  # exec "echo", "*" # echoes an asterisk
1771
1773
  # # never get here
1772
1774
  #
1773
- def self?.exec: (*String args) -> bot
1775
+ def self?.exec: (String command, *String args, ?unsetenv_others: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: boolish, ?chdir: String) -> bot
1776
+ | (Hash[string, string?] env, String command, *String args, ?unsetenv_others: boolish, ?pgroup: true | Integer, ?umask: Integer, ?in: redirect_fd, ?out: redirect_fd, ?err: redirect_fd, ?close_others: boolish, ?chdir: String) -> bot
1774
1777
 
1775
1778
  type redirect_fd = Integer | :in | :out | :err | IO | String | [ String ] | [ String, string | int ] | [ String, string | int, int ] | [ :child, int ] | :close
1776
1779