rbs 3.0.0.dev.2 → 3.0.0.dev.3

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 (112) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +2 -1
  3. data/.github/workflows/ruby.yml +4 -0
  4. data/Gemfile.lock +11 -11
  5. data/Rakefile +2 -2
  6. data/Steepfile +1 -1
  7. data/core/array.rbs +573 -423
  8. data/core/basic_object.rbs +11 -39
  9. data/core/binding.rbs +1 -1
  10. data/core/builtin.rbs +8 -0
  11. data/core/class.rbs +37 -0
  12. data/core/comparable.rbs +7 -18
  13. data/core/complex.rbs +2 -2
  14. data/core/data.rbs +419 -0
  15. data/core/dir.rbs +52 -104
  16. data/core/encoding.rbs +22 -181
  17. data/core/enumerable.rbs +212 -175
  18. data/core/enumerator/product.rbs +96 -0
  19. data/core/enumerator.rbs +57 -8
  20. data/core/errors.rbs +8 -2
  21. data/core/exception.rbs +41 -0
  22. data/core/fiber.rbs +95 -12
  23. data/core/file.rbs +840 -275
  24. data/core/file_test.rbs +34 -19
  25. data/core/float.rbs +40 -96
  26. data/core/gc.rbs +15 -3
  27. data/core/hash.rbs +113 -175
  28. data/core/integer.rbs +85 -145
  29. data/core/io/buffer.rbs +187 -60
  30. data/core/io/wait.rbs +28 -16
  31. data/core/io.rbs +1859 -1389
  32. data/core/kernel.rbs +525 -961
  33. data/core/match_data.rbs +306 -142
  34. data/core/math.rbs +506 -234
  35. data/core/method.rbs +0 -24
  36. data/core/module.rbs +110 -17
  37. data/core/nil_class.rbs +2 -0
  38. data/core/numeric.rbs +76 -144
  39. data/core/object.rbs +88 -212
  40. data/core/proc.rbs +17 -5
  41. data/core/process.rbs +22 -5
  42. data/core/ractor.rbs +1 -1
  43. data/core/random.rbs +20 -3
  44. data/core/range.rbs +91 -89
  45. data/core/rational.rbs +2 -3
  46. data/core/rbs/unnamed/argf.rbs +177 -120
  47. data/core/rbs/unnamed/env_class.rbs +89 -163
  48. data/core/rbs/unnamed/random.rbs +36 -12
  49. data/core/refinement.rbs +8 -0
  50. data/core/regexp.rbs +462 -272
  51. data/core/ruby_vm.rbs +210 -0
  52. data/{stdlib/set/0 → core}/set.rbs +43 -47
  53. data/core/string.rbs +1403 -1332
  54. data/core/string_io.rbs +191 -107
  55. data/core/struct.rbs +67 -63
  56. data/core/symbol.rbs +187 -201
  57. data/core/thread.rbs +40 -35
  58. data/core/time.rbs +902 -826
  59. data/core/trace_point.rbs +55 -6
  60. data/core/unbound_method.rbs +48 -24
  61. data/docs/collection.md +4 -0
  62. data/docs/syntax.md +55 -0
  63. data/ext/rbs_extension/parser.c +5 -6
  64. data/lib/rbs/cli.rb +6 -1
  65. data/lib/rbs/collection/cleaner.rb +8 -1
  66. data/lib/rbs/collection/config/lockfile.rb +3 -1
  67. data/lib/rbs/collection/config/lockfile_generator.rb +16 -14
  68. data/lib/rbs/collection/config.rb +1 -1
  69. data/lib/rbs/collection/sources/git.rb +9 -2
  70. data/lib/rbs/collection/sources/local.rb +79 -0
  71. data/lib/rbs/collection/sources.rb +8 -1
  72. data/lib/rbs/environment.rb +6 -5
  73. data/lib/rbs/environment_loader.rb +3 -2
  74. data/lib/rbs/errors.rb +18 -0
  75. data/lib/rbs/locator.rb +26 -7
  76. data/lib/rbs/sorter.rb +2 -2
  77. data/lib/rbs/version.rb +1 -1
  78. data/sig/collection/sources.rbs +32 -3
  79. data/sig/environment.rbs +2 -3
  80. data/sig/locator.rbs +14 -2
  81. data/sig/shims/{abstract_syntax_tree.rbs → _abstract_syntax_tree.rbs} +0 -0
  82. data/stdlib/bigdecimal/0/big_decimal.rbs +16 -13
  83. data/stdlib/cgi/0/core.rbs +16 -0
  84. data/stdlib/coverage/0/coverage.rbs +50 -8
  85. data/stdlib/csv/0/csv.rbs +1 -1
  86. data/stdlib/date/0/date.rbs +856 -726
  87. data/stdlib/date/0/date_time.rbs +83 -210
  88. data/stdlib/erb/0/erb.rbs +13 -36
  89. data/stdlib/etc/0/etc.rbs +127 -20
  90. data/stdlib/fileutils/0/fileutils.rbs +1290 -381
  91. data/stdlib/logger/0/logger.rbs +466 -316
  92. data/stdlib/net-http/0/net-http.rbs +2211 -534
  93. data/stdlib/nkf/0/nkf.rbs +5 -5
  94. data/stdlib/objspace/0/objspace.rbs +31 -14
  95. data/stdlib/openssl/0/openssl.rbs +11 -7
  96. data/stdlib/optparse/0/optparse.rbs +20 -17
  97. data/stdlib/pathname/0/pathname.rbs +21 -4
  98. data/stdlib/pstore/0/pstore.rbs +378 -154
  99. data/stdlib/pty/0/pty.rbs +24 -8
  100. data/stdlib/ripper/0/ripper.rbs +1650 -0
  101. data/stdlib/socket/0/addrinfo.rbs +9 -15
  102. data/stdlib/socket/0/socket.rbs +36 -3
  103. data/stdlib/strscan/0/string_scanner.rbs +7 -5
  104. data/stdlib/tempfile/0/tempfile.rbs +104 -44
  105. data/stdlib/time/0/time.rbs +2 -2
  106. data/stdlib/uri/0/file.rbs +5 -0
  107. data/stdlib/uri/0/generic.rbs +2 -2
  108. data/stdlib/yaml/0/yaml.rbs +2 -2
  109. data/stdlib/zlib/0/zlib.rbs +1 -1
  110. metadata +8 -6
  111. data/core/deprecated.rbs +0 -9
  112. data/sig/shims/ripper.rbs +0 -8
data/core/range.rbs CHANGED
@@ -4,7 +4,7 @@
4
4
  #
5
5
  # You can create an Range object explicitly with:
6
6
  #
7
- # * A [range literal](doc/syntax/literals_rdoc.html#label-Range+Literals):
7
+ # * A [range literal](rdoc-ref:syntax/literals.rdoc@Range+Literals):
8
8
  #
9
9
  # # Ranges that use '..' to include the given end value.
10
10
  # (1..4).to_a # => [1, 2, 3, 4]
@@ -58,9 +58,9 @@
58
58
  #
59
59
  # Range.new(1, nil) # => 1..
60
60
  #
61
- # The literal for an endless range may be written with either two dots or
62
- # three. The range has the same elements, either way. But note that the two are
63
- # not equal:
61
+ # The literal for an endless range may be written with either two dots or three.
62
+ # The range has the same elements, either way. But note that the two are not
63
+ # equal:
64
64
  #
65
65
  # r0 = (1..) # => 1..
66
66
  # r1 = (1...) # => 1...
@@ -84,6 +84,15 @@
84
84
  # end
85
85
  # a # => [2, 4, 6, 8, 10]
86
86
  #
87
+ # A range can be both beginless and endless. For literal beginless, endless
88
+ # ranges, at least the beginning or end of the range must be given as an
89
+ # explicit nil value. It is recommended to use an explicit nil beginning and
90
+ # implicit nil end, since that is what Ruby uses for Range#inspect:
91
+ #
92
+ # (nil..) # => (nil..)
93
+ # (..nil) # => (nil..)
94
+ # (nil..nil) # => (nil..)
95
+ #
87
96
  # ## Ranges and Other Classes
88
97
  #
89
98
  # An object may be put into a range if its class implements instance method
@@ -118,9 +127,8 @@
118
127
  # ## Ranges and User-Defined Classes
119
128
  #
120
129
  # A user-defined class that is to be used in a range must implement instance
121
- # `<=>`; see [Integer#<=>](Integer.html#label-method-i-3C-3D-3E). To make
122
- # iteration available, it must also implement instance method `succ`; see
123
- # Integer#succ.
130
+ # `<=>`; see Integer#<=>. To make iteration available, it must also implement
131
+ # instance method `succ`; see Integer#succ.
124
132
  #
125
133
  # The class below implements both `<=>` and `succ`, and so can be used both to
126
134
  # construct ranges and to iterate over them. Note that the Comparable module is
@@ -156,113 +164,66 @@
156
164
  #
157
165
  # First, what's elsewhere. Class Range:
158
166
  #
159
- # * Inherits from [class
160
- # Object](Object.html#class-Object-label-What-27s+Here).
161
- # * Includes [module
162
- # Enumerable](Enumerable.html#module-Enumerable-label-What-27s+Here), which
167
+ # * Inherits from [class Object](rdoc-ref:Object@What-27s+Here).
168
+ # * Includes [module Enumerable](rdoc-ref:Enumerable@What-27s+Here), which
163
169
  # provides dozens of additional methods.
164
170
  #
165
171
  #
166
172
  # Here, class Range provides methods that are useful for:
167
173
  #
168
- # * [Creating a Range](#class-Range-label-Methods+for+Creating+a+Range)
169
- # * [Querying](#class-Range-label-Methods+for+Querying)
170
- # * [Comparing](#class-Range-label-Methods+for+Comparing)
171
- # * [Iterating](#class-Range-label-Methods+for+Iterating)
172
- # * [Converting](#class-Range-label-Methods+for+Converting)
174
+ # * [Creating a Range](rdoc-ref:Range@Methods+for+Creating+a+Range)
175
+ # * [Querying](rdoc-ref:Range@Methods+for+Querying)
176
+ # * [Comparing](rdoc-ref:Range@Methods+for+Comparing)
177
+ # * [Iterating](rdoc-ref:Range@Methods+for+Iterating)
178
+ # * [Converting](rdoc-ref:Range@Methods+for+Converting)
173
179
  #
174
180
  #
175
181
  # ### Methods for Creating a Range
176
182
  #
177
- # ::new
178
- # : Returns a new range.
179
- #
183
+ # * ::new: Returns a new range.
180
184
  #
181
185
  #
182
186
  # ### Methods for Querying
183
187
  #
184
- # #begin
185
- # : Returns the begin value given for `self`.
186
- #
187
- # #bsearch
188
- # : Returns an element from `self` selected by a binary search.
189
- #
190
- # #count
191
- # : Returns a count of elements in `self`.
192
- #
193
- # #end
194
- # : Returns the end value given for `self`.
195
- #
196
- # #exclude_end?
197
- # : Returns whether the end object is excluded.
198
- #
199
- # #first
200
- # : Returns the first elements of `self`.
201
- #
202
- # #hash
203
- # : Returns the integer hash code.
204
- #
205
- # #last
206
- # : Returns the last elements of `self`.
207
- #
208
- # #max
209
- # : Returns the maximum values in `self`.
210
- #
211
- # #min
212
- # : Returns the minimum values in `self`.
213
- #
214
- # #minmax
215
- # : Returns the minimum and maximum values in `self`.
216
- #
217
- # #size
218
- # : Returns the count of elements in `self`.
219
- #
188
+ # * #begin: Returns the begin value given for `self`.
189
+ # * #bsearch: Returns an element from `self` selected by a binary search.
190
+ # * #count: Returns a count of elements in `self`.
191
+ # * #end: Returns the end value given for `self`.
192
+ # * #exclude_end?: Returns whether the end object is excluded.
193
+ # * #first: Returns the first elements of `self`.
194
+ # * #hash: Returns the integer hash code.
195
+ # * #last: Returns the last elements of `self`.
196
+ # * #max: Returns the maximum values in `self`.
197
+ # * #min: Returns the minimum values in `self`.
198
+ # * #minmax: Returns the minimum and maximum values in `self`.
199
+ # * #size: Returns the count of elements in `self`.
220
200
  #
221
201
  #
222
202
  # ### Methods for Comparing
223
203
  #
224
- # [#==](#method-i-3D-3D)
225
- # : Returns whether a given object is equal to `self` (uses #==).
226
- #
227
- # #===
228
- # : Returns whether the given object is between the begin and end values.
229
- #
230
- # #cover?
231
- # : Returns whether a given object is within `self`.
232
- #
233
- # #eql?
234
- # : Returns whether a given object is equal to `self` (uses #eql?).
235
- #
236
- # #include? (aliased as #member?)
237
- # : Returns whether a given object is an element of `self`.
238
- #
204
+ # * #==: Returns whether a given object is equal to `self` (uses #==).
205
+ # * #===: Returns whether the given object is between the begin and end
206
+ # values.
207
+ # * #cover?: Returns whether a given object is within `self`.
208
+ # * #eql?: Returns whether a given object is equal to `self` (uses #eql?).
209
+ # * #include? (aliased as #member?): Returns whether a given object is an
210
+ # element of `self`.
239
211
  #
240
212
  #
241
213
  # ### Methods for Iterating
242
214
  #
243
- # #%
244
- # : Requires argument `n`; calls the block with each `n`-th element of
245
- # `self`.
246
- #
247
- # #each
248
- # : Calls the block with each element of `self`.
249
- #
250
- # #step
251
- # : Takes optional argument `n` (defaults to 1); calls the block with each
252
- # `n`-th element of `self`.
253
- #
215
+ # * #%: Requires argument `n`; calls the block with each `n`-th element of
216
+ # `self`.
217
+ # * #each: Calls the block with each element of `self`.
218
+ # * #step: Takes optional argument `n` (defaults to 1); calls the block with
219
+ # each `n`-th element of `self`.
254
220
  #
255
221
  #
256
222
  # ### Methods for Converting
257
223
  #
258
- # #inspect
259
- # : Returns a string representation of `self` (uses #inspect).
260
- #
261
- # #to_a (aliased as #entries)
262
- # : Returns elements of `self` in an array.
263
- #
264
- # #to_s
265
- # : Returns a string representation of `self` (uses #to_s).
224
+ # * #inspect: Returns a string representation of `self` (uses #inspect).
225
+ # * #to_a (aliased as #entries): Returns elements of `self` in an array.
226
+ # * #to_s: Returns a string representation of `self` (uses #to_s).
266
227
  #
267
228
  class Range[out Elem] < Object
268
229
  include Enumerable[Elem]
@@ -445,6 +406,47 @@ class Range[out Elem] < Object
445
406
  # comparable.
446
407
  #
447
408
  #
409
+ # Beginless ranges cover all values of the same type before the end, excluding
410
+ # the end for exclusive ranges. Beginless ranges cover ranges that end before
411
+ # the end of the beginless range, or at the end of the beginless range for
412
+ # inclusive ranges.
413
+ #
414
+ # (..2).cover?(1) # => true
415
+ # (..2).cover?(2) # => true
416
+ # (..2).cover?(3) # => false
417
+ # (...2).cover?(2) # => false
418
+ # (..2).cover?("2") # => false
419
+ # (..2).cover?(..2) # => true
420
+ # (..2).cover?(...2) # => true
421
+ # (..2).cover?(.."2") # => false
422
+ # (...2).cover?(..2) # => false
423
+ #
424
+ # Endless ranges cover all values of the same type after the beginning. Endless
425
+ # exclusive ranges do not cover endless inclusive ranges.
426
+ #
427
+ # (2..).cover?(1) # => false
428
+ # (2..).cover?(3) # => true
429
+ # (2...).cover?(3) # => true
430
+ # (2..).cover?(2) # => true
431
+ # (2..).cover?("2") # => false
432
+ # (2..).cover?(2..) # => true
433
+ # (2..).cover?(2...) # => true
434
+ # (2..).cover?("2"..) # => false
435
+ # (2...).cover?(2..) # => false
436
+ # (2...).cover?(3...) # => true
437
+ # (2...).cover?(3..) # => false
438
+ # (3..).cover?(2..) # => false
439
+ #
440
+ # Ranges that are both beginless and endless cover all values and ranges, and
441
+ # return true for all arguments, with the exception that beginless and endless
442
+ # exclusive ranges do not cover endless inclusive ranges.
443
+ #
444
+ # (nil...).cover?(Object.new) # => true
445
+ # (nil...).cover?(nil...) # => true
446
+ # (nil..).cover?(nil...) # => true
447
+ # (nil...).cover?(nil..) # => false
448
+ # (nil...).cover?(1..) # => false
449
+ #
448
450
  # Related: Range#include?.
449
451
  #
450
452
  def cover?: (untyped obj) -> bool
data/core/rational.rbs CHANGED
@@ -5,13 +5,12 @@
5
5
  #
6
6
  # You can create a Rational object explicitly with:
7
7
  #
8
- # * A [rational
9
- # literal](doc/syntax/literals_rdoc.html#label-Rational+Literals).
8
+ # * A [rational literal](rdoc-ref:syntax/literals.rdoc@Rational+Literals).
10
9
  #
11
10
  #
12
11
  # You can convert certain objects to Rationals with:
13
12
  #
14
- # * Method [Rational](Kernel.html#method-i-Rational).
13
+ # * Method #Rational.
15
14
  #
16
15
  #
17
16
  # Examples