rbs 3.1.3 → 3.2.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 (73) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +0 -6
  3. data/CHANGELOG.md +82 -0
  4. data/Gemfile +0 -6
  5. data/Gemfile.lock +12 -21
  6. data/README.md +1 -1
  7. data/Rakefile +45 -1
  8. data/Steepfile +3 -3
  9. data/core/array.rbs +0 -8
  10. data/core/binding.rbs +7 -69
  11. data/core/builtin.rbs +33 -8
  12. data/core/constants.rbs +13 -5
  13. data/core/dir.rbs +25 -25
  14. data/core/errno.rbs +474 -590
  15. data/core/exception.rbs +1 -1
  16. data/core/global_variables.rbs +27 -27
  17. data/core/io.rbs +163 -172
  18. data/core/kernel.rbs +58 -38
  19. data/core/module.rbs +34 -32
  20. data/core/object.rbs +3 -7
  21. data/core/string_io.rbs +9 -0
  22. data/core/thread.rbs +25 -1
  23. data/core/time.rbs +3 -3
  24. data/core/warning.rbs +3 -1
  25. data/docs/CONTRIBUTING.md +1 -1
  26. data/docs/rbs_by_example.md +16 -35
  27. data/docs/repo.md +1 -1
  28. data/docs/sigs.md +7 -7
  29. data/docs/stdlib.md +2 -3
  30. data/docs/syntax.md +40 -40
  31. data/lib/rbs/cli.rb +15 -4
  32. data/lib/rbs/collection/config/lockfile_generator.rb +6 -2
  33. data/lib/rbs/collection/installer.rb +5 -2
  34. data/lib/rbs/collection/sources/stdlib.rb +5 -1
  35. data/lib/rbs/errors.rb +8 -1
  36. data/lib/rbs/file_finder.rb +1 -1
  37. data/lib/rbs/prototype/rb.rb +64 -6
  38. data/lib/rbs/prototype/rbi.rb +2 -6
  39. data/lib/rbs/prototype/runtime.rb +29 -8
  40. data/lib/rbs/subtractor.rb +17 -0
  41. data/lib/rbs/type_name.rb +4 -4
  42. data/lib/rbs/version.rb +1 -1
  43. data/rbs.gemspec +1 -1
  44. data/schema/decls.json +1 -1
  45. data/sig/errors.rbs +54 -0
  46. data/sig/parser.rbs +2 -2
  47. data/sig/prototype/rb.rbs +9 -1
  48. data/sig/subtractor.rbs +4 -0
  49. data/stdlib/logger/0/logger.rbs +1 -1
  50. data/stdlib/observable/0/observable.rbs +219 -0
  51. data/stdlib/uri/0/common.rbs +24 -0
  52. data/stdlib/zlib/0/buf_error.rbs +79 -0
  53. data/stdlib/zlib/0/data_error.rbs +79 -0
  54. data/stdlib/zlib/0/deflate.rbs +276 -0
  55. data/stdlib/zlib/0/error.rbs +89 -0
  56. data/stdlib/zlib/0/gzip_file/crc_error.rbs +115 -0
  57. data/stdlib/zlib/0/gzip_file/error.rbs +128 -0
  58. data/stdlib/zlib/0/gzip_file/length_error.rbs +115 -0
  59. data/stdlib/zlib/0/gzip_file/no_footer.rbs +114 -0
  60. data/stdlib/zlib/0/gzip_file.rbs +228 -0
  61. data/stdlib/zlib/0/gzip_reader.rbs +362 -0
  62. data/stdlib/zlib/0/gzip_writer.rbs +237 -0
  63. data/stdlib/zlib/0/inflate.rbs +249 -0
  64. data/stdlib/zlib/0/mem_error.rbs +79 -0
  65. data/stdlib/zlib/0/need_dict.rbs +82 -0
  66. data/stdlib/zlib/0/stream_end.rbs +80 -0
  67. data/stdlib/zlib/0/stream_error.rbs +80 -0
  68. data/stdlib/zlib/0/version_error.rbs +80 -0
  69. data/stdlib/zlib/0/zstream.rbs +270 -0
  70. metadata +22 -6
  71. data/stdlib/prime/0/integer-extension.rbs +0 -41
  72. data/stdlib/prime/0/manifest.yaml +0 -2
  73. data/stdlib/prime/0/prime.rbs +0 -372
data/core/dir.rbs CHANGED
@@ -102,7 +102,7 @@ class Dir
102
102
  # The optional *encoding* keyword argument specifies the encoding of the
103
103
  # directory. If not specified, the filesystem encoding is used.
104
104
  #
105
- def initialize: (string, ?encoding: encoding | nil) -> void
105
+ def initialize: (path dir, ?encoding: encoding?) -> self
106
106
 
107
107
  # <!--
108
108
  # rdoc-file=dir.rb
@@ -110,7 +110,7 @@ class Dir
110
110
  # -->
111
111
  # Equivalent to calling `Dir.glob([`*string,...*`], 0)`.
112
112
  #
113
- def self.[]: (*string patterns, ?base: string) ?{ (String path) -> void } -> Array[String]
113
+ def self.[]: (*path patterns, ?base: path?, ?sort: bool) -> Array[String]
114
114
 
115
115
  # <!--
116
116
  # rdoc-file=dir.c
@@ -149,8 +149,8 @@ class Dir
149
149
  # /tmp
150
150
  # /var/spool/mail
151
151
  #
152
- def self.chdir: (?string) -> void
153
- | [U] (?string) { (String) -> U } -> U
152
+ def self.chdir: (?path dir) -> 0
153
+ | [U] (?path dir) { (String dir) -> U } -> U
154
154
 
155
155
  # <!--
156
156
  # rdoc-file=dir.c
@@ -166,7 +166,7 @@ class Dir
166
166
  #
167
167
  # Dir.children("testdir") #=> ["config.h", "main.rb"]
168
168
  #
169
- def self.children: (string dirname, ?encoding: string | Encoding | nil enc) -> Array[String]
169
+ def self.children: (path dirname, ?encoding: encoding?) -> Array[String]
170
170
 
171
171
  # <!--
172
172
  # rdoc-file=dir.c
@@ -176,7 +176,7 @@ class Dir
176
176
  # may make this call. Not available on all platforms. On Unix systems, see
177
177
  # `chroot(2)` for more information.
178
178
  #
179
- def self.chroot: (string) -> void
179
+ def self.chroot: (path root) -> 0
180
180
 
181
181
  # <!--
182
182
  # rdoc-file=dir.c
@@ -187,7 +187,7 @@ class Dir
187
187
  # Deletes the named directory. Raises a subclass of SystemCallError if the
188
188
  # directory isn't empty.
189
189
  #
190
- def self.delete: (string) -> void
190
+ def self.delete: (path dirname) -> 0
191
191
 
192
192
  # <!--
193
193
  # rdoc-file=dir.c
@@ -208,8 +208,8 @@ class Dir
208
208
  # Got config.h
209
209
  # Got main.rb
210
210
  #
211
- def self.each_child: (string dirname, ?encoding: string | Encoding | nil enc) -> Enumerator[String, void]
212
- | (string dirname, ?encoding: string | Encoding | nil enc) { (String filename) -> void } -> void
211
+ def self.each_child: (path dirname, ?encoding: encoding?) -> Enumerator[String, nil]
212
+ | (path dirname, ?encoding: encoding?) { (String filename) -> void } -> nil
213
213
 
214
214
  # <!--
215
215
  # rdoc-file=dir.c
@@ -218,7 +218,7 @@ class Dir
218
218
  # Returns `true` if the named file is an empty directory, `false` if it is not a
219
219
  # directory or non-empty.
220
220
  #
221
- def self.empty?: (string path_name) -> bool
221
+ def self.empty?: (path path_name) -> bool
222
222
 
223
223
  # <!--
224
224
  # rdoc-file=dir.c
@@ -233,7 +233,7 @@ class Dir
233
233
  #
234
234
  # Dir.entries("testdir") #=> [".", "..", "config.h", "main.rb"]
235
235
  #
236
- def self.entries: (string dirname, ?encoding: encoding | nil enc) -> ::Array[String]
236
+ def self.entries: (path dirname, ?encoding: encoding?) -> Array[String]
237
237
 
238
238
  # <!--
239
239
  # rdoc-file=dir.c
@@ -241,7 +241,7 @@ class Dir
241
241
  # -->
242
242
  # Returns `true` if the named file is a directory, `false` otherwise.
243
243
  #
244
- def self.exist?: (string file) -> bool
244
+ def self.exist?: (path | _ToIO file_name) -> bool
245
245
 
246
246
  # <!--
247
247
  # rdoc-file=dir.c
@@ -371,8 +371,8 @@ class Dir
371
371
  #
372
372
  # Dir.glob("**/lib/*.rb") #=> ["lib/song.rb"]
373
373
  #
374
- def self.glob: (string | ::Array[string] pattern, ?Integer flags, ?base: string) -> ::Array[String]
375
- | (string | ::Array[string] pattern, ?Integer flags, ?base: string) { (String) -> void } -> void
374
+ def self.glob: (_ToAry[path] | path pattern, ?int flags, ?base: path?, ?sort: bool) -> Array[String]
375
+ | (_ToAry[path] | path pattern, ?int flags, ?base: path?, ?sort: bool) { (String pathname) -> void } -> nil
376
376
 
377
377
  # <!--
378
378
  # rdoc-file=dir.c
@@ -381,7 +381,7 @@ class Dir
381
381
  # -->
382
382
  # Returns the home directory of the current user or the named user if given.
383
383
  #
384
- def self.home: (?string user) -> String
384
+ def self.home: (?string? user) -> String
385
385
 
386
386
  # <!--
387
387
  # rdoc-file=dir.c
@@ -395,7 +395,7 @@ class Dir
395
395
  #
396
396
  # Dir.mkdir(File.join(Dir.home, ".foo"), 0700) #=> 0
397
397
  #
398
- def self.mkdir: (string, ?Integer permissions) -> void
398
+ def self.mkdir: (path dirname, ?int permissions) -> 0
399
399
 
400
400
  # <!--
401
401
  # rdoc-file=dir.rb
@@ -411,8 +411,8 @@ class Dir
411
411
  # passed *aDir* as a parameter. The directory is closed at the end of the block,
412
412
  # and Dir::open returns the value of the block.
413
413
  #
414
- def self.open: (string, ?encoding: encoding | nil) -> Dir
415
- | [U] (string, ?encoding: encoding | nil) { (Dir) -> U } -> U
414
+ def self.open: (path dirname, ?encoding: encoding?) -> instance
415
+ | [U] (path dirname, ?encoding: encoding?) { (instance) -> U } -> U
416
416
 
417
417
  # <!--
418
418
  # rdoc-file=dir.c
@@ -425,7 +425,7 @@ class Dir
425
425
  # Dir.getwd #=> "/tmp"
426
426
  # Dir.pwd #=> "/tmp"
427
427
  #
428
- def self.pwd: () -> String
428
+ alias self.pwd self.getwd
429
429
 
430
430
  # <!--
431
431
  # rdoc-file=dir.c
@@ -473,7 +473,7 @@ class Dir
473
473
  # d = Dir.new("testdir")
474
474
  # d.close #=> nil
475
475
  #
476
- def close: () -> void
476
+ def close: () -> nil
477
477
 
478
478
  # <!--
479
479
  # rdoc-file=dir.c
@@ -496,7 +496,7 @@ class Dir
496
496
  # Got main.rb
497
497
  #
498
498
  def each: () { (String) -> void } -> self
499
- | () -> ::Enumerator[String, self]
499
+ | () -> Enumerator[String, self]
500
500
 
501
501
  # <!--
502
502
  # rdoc-file=dir.c
@@ -517,7 +517,7 @@ class Dir
517
517
  # Got main.rb
518
518
  #
519
519
  def each_child: () { (String) -> void } -> self
520
- | () -> ::Enumerator[String, self]
520
+ | () -> Enumerator[String, self]
521
521
 
522
522
  # <!--
523
523
  # rdoc-file=dir.c
@@ -577,7 +577,7 @@ class Dir
577
577
  # d.pos = i #=> 12
578
578
  # d.read #=> ".."
579
579
  #
580
- def pos=: (Integer pos) -> Integer
580
+ def pos=: [U < _ToInt] (U pos) -> U
581
581
 
582
582
  # <!--
583
583
  # rdoc-file=dir.c
@@ -620,7 +620,7 @@ class Dir
620
620
  # d.seek(i) #=> #<Dir:0x401b3c40>
621
621
  # d.read #=> ".."
622
622
  #
623
- def seek: (Integer) -> self
623
+ def seek: (int pos) -> self
624
624
 
625
625
  # <!--
626
626
  # rdoc-file=dir.c
@@ -634,7 +634,7 @@ class Dir
634
634
  # d.read #=> "."
635
635
  # d.tell #=> 12
636
636
  #
637
- def tell: () -> Integer
637
+ alias tell pos
638
638
 
639
639
  # <!-- rdoc-file=dir.c -->
640
640
  # Returns the path parameter passed to *dir*'s constructor.