rbs 0.16.0 → 0.20.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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -1
  3. data/CHANGELOG.md +30 -0
  4. data/README.md +1 -1
  5. data/Rakefile +12 -1
  6. data/core/array.rbs +1 -1
  7. data/core/builtin.rbs +2 -2
  8. data/core/dir.rbs +1 -1
  9. data/core/enumerable.rbs +41 -40
  10. data/core/enumerator.rbs +5 -5
  11. data/core/file.rbs +0 -4
  12. data/core/hash.rbs +9 -11
  13. data/core/io.rbs +1 -1
  14. data/core/object_space.rbs +98 -0
  15. data/core/range.rbs +1 -1
  16. data/core/struct.rbs +1 -1
  17. data/core/time.rbs +0 -12
  18. data/lib/rbs/ast/members.rb +9 -3
  19. data/lib/rbs/definition.rb +9 -4
  20. data/lib/rbs/definition_builder.rb +123 -71
  21. data/lib/rbs/environment.rb +3 -0
  22. data/lib/rbs/environment_loader.rb +1 -1
  23. data/lib/rbs/environment_walker.rb +70 -35
  24. data/lib/rbs/method_type.rb +1 -31
  25. data/lib/rbs/parser.rb +944 -879
  26. data/lib/rbs/parser.y +110 -63
  27. data/lib/rbs/prototype/rb.rb +163 -23
  28. data/lib/rbs/prototype/rbi.rb +5 -5
  29. data/lib/rbs/prototype/runtime.rb +2 -1
  30. data/lib/rbs/test/hook.rb +30 -17
  31. data/lib/rbs/test/type_check.rb +6 -1
  32. data/lib/rbs/types.rb +63 -6
  33. data/lib/rbs/version.rb +1 -1
  34. data/lib/rbs/writer.rb +9 -1
  35. data/schema/members.json +5 -1
  36. data/sig/definition.rbs +8 -3
  37. data/sig/definition_builder.rbs +6 -2
  38. data/sig/members.rbs +4 -1
  39. data/sig/method_types.rbs +3 -16
  40. data/sig/types.rbs +17 -1
  41. data/stdlib/csv/0/csv.rbs +3 -3
  42. data/stdlib/dbm/0/dbm.rbs +1 -3
  43. data/stdlib/monitor/0/monitor.rbs +119 -0
  44. data/stdlib/prime/0/prime.rbs +1 -1
  45. data/stdlib/set/0/set.rbs +10 -10
  46. data/stdlib/singleton/0/singleton.rbs +111 -0
  47. data/stdlib/tsort/0/cyclic.rbs +4 -0
  48. data/stdlib/tsort/0/interfaces.rbs +19 -0
  49. data/stdlib/tsort/0/tsort.rbs +371 -0
  50. data/stdlib/yaml/0/dbm.rbs +221 -0
  51. data/stdlib/yaml/0/store.rbs +53 -0
  52. data/steep/Gemfile.lock +12 -12
  53. metadata +11 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5062396fb965f4d6f07ceee4f6b82ef22a12c20897d82c6615d6765d5bf43b7f
4
- data.tar.gz: 8b30dd2d71e12d56501bafc2ab4ca1d604befbc3ef797f02234b6d6acc95ac71
3
+ metadata.gz: 5c422fed696c791b7cd4cbaa9c78cbdf28634d6152a1bd4496f801c539d74ac6
4
+ data.tar.gz: 46012d3a5b09cb2a529620813c71d6a730b26078d409565320a60297e4153bb4
5
5
  SHA512:
6
- metadata.gz: ec6b6090f0a93cbfbe2f4ffe5f5bbce253425f3f85a55dcabec2943f724a81c637c441820236aa1dcbff6104d1fe7d215e4cb38ac76c5f827677167e437761f5
7
- data.tar.gz: 301d1c5a305dce97dfdd6d89c39a4deafcedc405535b13b1846b3d03af83a87747cc44ade7a0148b96af7d07d7a53b4eb7c8954344ae11d574f69ca81c3eb7a8
6
+ metadata.gz: 59f566eba0bb6398ee0cd4432403750ee8d3ce7e5916c61089c5c5032fff723259be3880aac88aec22d4ecaffff96c1190b18483a60feac517b3b6845bc8dae9
7
+ data.tar.gz: a12d3d389eead680ff98886eff428a6b2fe4e1c3cab408866be1aa34e6a5cd3737391f370655a9798c04e73062bb0170c5be2525c66c4bf3b8aa69d21dc17750
@@ -18,7 +18,7 @@ jobs:
18
18
  job:
19
19
  - test
20
20
  - stdlib_test
21
- - rubocop validate test_doc build test_generate_stdlib
21
+ - rubocop validate test_doc build test_generate_stdlib confirm_parser
22
22
  container:
23
23
  image: rubylang/ruby:${{ matrix.container_tag }}
24
24
  steps:
@@ -2,6 +2,36 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 0.20.0 (2020-12-06)
6
+
7
+ * Signature updates for `TSort`, `DBM`, `Time`, and `Hash` ([#496](https://github.com/ruby/rbs/pull/496), [#497](https://github.com/ruby/rbs/pull/497), [#499](https://github.com/ruby/rbs/pull/499), [#507](https://github.com/ruby/rbs/pull/507))
8
+ * Add _singleton attribute_ syntax ([#502](https://github.com/ruby/rbs/pull/502), [#506](https://github.com/ruby/rbs/pull/506), [#505](https://github.com/ruby/rbs/pull/505))
9
+ * Proc types with blocks ([#503](https://github.com/ruby/rbs/pull/503))
10
+ * Add support for escape sequences in string literal types ([#501](https://github.com/ruby/rbs/pull/501))
11
+ * Fix runtime type checking of blocks with keyword args ([#500](https://github.com/ruby/rbs/pull/500))
12
+
13
+ ## 0.19.0 (2020-12-02)
14
+
15
+ * Signature updates for `Monitor` and File ([#485](https://github.com/ruby/rbs/pull/485), [#495](https://github.com/ruby/rbs/pull/495))
16
+
17
+ ## 0.18.1 (2020-12-01)
18
+
19
+ * Fix `EnvironmentWalker#each_type_name` ([#494](https://github.com/ruby/rbs/pull/494))
20
+
21
+ ## 0.18.0 (2020-12-01)
22
+
23
+ * Signature updates for `YAML`, `ObjectSpace`, and `Singleton` ([#408](https://github.com/ruby/rbs/pull/408), [#477](https://github.com/ruby/rbs/pull/477), [#482](https://github.com/ruby/rbs/pull/482))
24
+ * `prototype rb` improvements ([#492](https://github.com/ruby/rbs/pull/492), [#487](https://github.com/ruby/rbs/pull/487), [#486](https://github.com/ruby/rbs/pull/486), [#481](https://github.com/ruby/rbs/pull/481))
25
+ * Runtime type checker improvements ([#488](https://github.com/ruby/rbs/pull/488), [#489](https://github.com/ruby/rbs/pull/489), [#490](https://github.com/ruby/rbs/pull/490))
26
+ * Update `DependencyWalker` API to receive _Node_ objects instead of `TypeName` ([#484](https://github.com/ruby/rbs/pull/484))
27
+ * Assume encoding of RBS files to be UTF-8 ([#493](https://github.com/ruby/rbs/pull/493))
28
+
29
+ ## 0.17.0 (2020-11-14)
30
+
31
+ * Signature updates for `Enumerable`, `Hash`, and `TSort` ([#462](https://github.com/ruby/rbs/pull/462), [#468](https://github.com/ruby/rbs/pull/468), [#471](https://github.com/ruby/rbs/pull/471), [#472](https://github.com/ruby/rbs/pull/472), [#473](https://github.com/ruby/rbs/pull/473), [#474](https://github.com/ruby/rbs/pull/474))
32
+ * Parser error handling improvement ([#463](https://github.com/ruby/rbs/pull/463), [#475](https://github.com/ruby/rbs/pull/475))
33
+ * Hash spread syntax handling improvement with `prototype rb` ([#465](https://github.com/ruby/rbs/pull/465))
34
+
5
35
  ## 0.16.0 (2020-11-05)
6
36
 
7
37
  * Signature update for `DBM` ([#441](https://github.com/ruby/rbs/pull/441))
data/README.md CHANGED
@@ -46,7 +46,7 @@ module ChatApp
46
46
  def initialize: (name: String) -> void
47
47
 
48
48
  def each_member: () { (User | Bot) -> void } -> void # `{` and `}` means block.
49
- | () -> Enumerable[User | Bot, void] # Method can be overloaded.
49
+ | () -> Enumerator[User | Bot, void] # Method can be overloaded.
50
50
  end
51
51
  end
52
52
  ```
data/Rakefile CHANGED
@@ -29,13 +29,18 @@ task :validate => :parser do
29
29
 
30
30
  FileList["stdlib/*"].each do |path|
31
31
  next if path =~ %r{stdlib/builtin}
32
-
32
+
33
33
  lib = [File.basename(path).to_s]
34
34
 
35
35
  if lib == ["bigdecimal-math"]
36
36
  lib << "bigdecimal"
37
37
  end
38
38
 
39
+ if lib == ["yaml"]
40
+ lib << "dbm"
41
+ lib << "pstore"
42
+ end
43
+
39
44
  sh "#{ruby} #{rbs} #{lib.map {|l| "-r #{l}"}.join(" ")} validate --silent"
40
45
  end
41
46
  end
@@ -60,6 +65,12 @@ task :test => :parser
60
65
  task :stdlib_test => :parser
61
66
  task :build => :parser
62
67
 
68
+ task :confirm_parser do
69
+ puts "Testing if parser.rb is updated with respect to parser.y"
70
+ sh "racc -v -o lib/rbs/parser.rb lib/rbs/parser.y"
71
+ sh "git diff --exit-code lib/rbs/parser.rb"
72
+ end
73
+
63
74
  namespace :generate do
64
75
  task :stdlib_test, [:class] do |_task, args|
65
76
  klass = args.fetch(:class) do
@@ -234,7 +234,7 @@
234
234
  # for pack.c
235
235
  #
236
236
  class Array[unchecked out Elem] < Object
237
- include Enumerable[Elem, self]
237
+ include Enumerable[Elem]
238
238
 
239
239
  # Returns a new array.
240
240
  #
@@ -26,8 +26,8 @@ interface _ToPath
26
26
  def to_path: () -> String
27
27
  end
28
28
 
29
- interface _Each[out A, out B]
30
- def each: { (A) -> void } -> B
29
+ interface _Each[out A]
30
+ def each: { (A) -> void } -> void
31
31
  end
32
32
 
33
33
  interface _Reader
@@ -7,7 +7,7 @@
7
7
  # itself (`.`).
8
8
  #
9
9
  class Dir
10
- include Enumerable[String, Dir]
10
+ include Enumerable[String]
11
11
 
12
12
  # Returns a new directory object for the named directory.
13
13
  #
@@ -5,7 +5,7 @@
5
5
  # objects in the collection must also implement a meaningful `<=>`
6
6
  # operator, as these methods rely on an ordering between members of the
7
7
  # collection.
8
- module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
8
+ module Enumerable[unchecked out Elem]: _Each[Elem]
9
9
  # Passes each element of the collection to the given block. The method
10
10
  # returns `true` if the block never returns `false` or `nil` . If the
11
11
  # block is not given, Ruby adds an implicit block of `{ |obj| obj }` which
@@ -66,24 +66,24 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
66
66
  | () { (Elem) -> boolish } -> Integer
67
67
 
68
68
  def cycle: (?Integer n) { (Elem arg0) -> untyped } -> NilClass
69
- | (?Integer n) -> ::Enumerator[Elem, Return]
69
+ | (?Integer n) -> ::Enumerator[Elem, NilClass]
70
70
 
71
71
  def detect: (?Proc ifnone) { (Elem) -> boolish } -> Elem?
72
- | (?Proc ifnone) -> ::Enumerator[Elem, Return]
72
+ | (?Proc ifnone) -> ::Enumerator[Elem, Elem?]
73
73
 
74
74
  def drop: (Integer n) -> ::Array[Elem]
75
75
 
76
76
  def drop_while: () { (Elem) -> boolish } -> ::Array[Elem]
77
- | () -> ::Enumerator[Elem, Return]
77
+ | () -> ::Enumerator[Elem, ::Array[Elem]]
78
78
 
79
79
  def each_cons: (Integer n) { (::Array[Elem] arg0) -> untyped } -> NilClass
80
- | (Integer n) -> ::Enumerator[::Array[Elem], Return]
80
+ | (Integer n) -> ::Enumerator[::Array[Elem], NilClass]
81
81
 
82
- def each_with_index: () { (Elem arg0, Integer arg1) -> untyped } -> ::Enumerable[Elem, Return]
83
- | () -> ::Enumerator[[ Elem, Integer ], Return]
82
+ def each_with_index: () { (Elem arg0, Integer arg1) -> untyped } -> void
83
+ | () -> ::Enumerator[[ Elem, Integer ], void]
84
84
 
85
85
  def each_with_object: [U] (U arg0) { (Elem arg0, untyped arg1) -> untyped } -> U
86
- | [U] (U arg0) -> ::Enumerator[[ Elem, U ], Return]
86
+ | [U] (U arg0) -> ::Enumerator[[ Elem, U ], U]
87
87
 
88
88
  # Returns an array containing the items in *enum* .
89
89
  #
@@ -97,14 +97,14 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
97
97
  def entries: () -> ::Array[Elem]
98
98
 
99
99
  def find_all: () { (Elem) -> boolish } -> ::Array[Elem]
100
- | () -> ::Enumerator[Elem, Return]
100
+ | () -> ::Enumerator[Elem, ::Array[Elem]]
101
101
 
102
102
  alias select find_all
103
103
  alias filter find_all
104
104
 
105
105
  def find_index: (?untyped value) -> Integer?
106
106
  | () { (Elem) -> boolish } -> Integer?
107
- | () -> ::Enumerator[Elem, Return]
107
+ | () -> ::Enumerator[Elem, Integer?]
108
108
 
109
109
  # Returns the first element, or the first `n` elements, of the enumerable.
110
110
  # If the enumerable is empty, the first form returns `nil`, and the
@@ -118,7 +118,7 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
118
118
  # [].first(10) #=> []
119
119
  # ```
120
120
  def first: () -> Elem?
121
- | (?Integer n) -> ::Array[Elem]?
121
+ | (Integer n) -> ::Array[Elem]?
122
122
 
123
123
  def grep: (untyped arg0) -> ::Array[Elem]
124
124
  | [U] (untyped arg0) { (Elem arg0) -> U } -> ::Array[U]
@@ -127,7 +127,7 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
127
127
  | [U] (untyped arg0) { (Elem arg0) -> U } -> ::Array[U]
128
128
 
129
129
  def group_by: [U] () { (Elem arg0) -> U } -> ::Hash[U, ::Array[Elem]]
130
- | () -> ::Enumerator[Elem, Return]
130
+ | () -> ::Enumerator[Elem, ::Array[Elem]]
131
131
 
132
132
  def `include?`: (untyped arg0) -> bool
133
133
 
@@ -157,13 +157,13 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
157
157
  # ```
158
158
  def max: () -> Elem?
159
159
  | () { (Elem arg0, Elem arg1) -> Integer } -> Elem?
160
- | (?Integer arg0) -> ::Array[Elem]
161
- | (?Integer arg0) { (Elem arg0, Elem arg1) -> Integer } -> ::Array[Elem]
160
+ | (Integer arg0) -> ::Array[Elem]
161
+ | (Integer arg0) { (Elem arg0, Elem arg1) -> Integer } -> ::Array[Elem]
162
162
 
163
- def max_by: () -> ::Enumerator[Elem, Return]
163
+ def max_by: () -> ::Enumerator[Elem, Elem?]
164
164
  | () { (Elem arg0) -> (Comparable | ::Array[untyped]) } -> Elem?
165
- | (?Integer arg0) -> ::Enumerator[Elem, Return]
166
- | (?Integer arg0) { (Elem arg0) -> (Comparable | ::Array[untyped]) } -> ::Array[Elem]
165
+ | (Integer arg0) -> ::Enumerator[Elem, ::Array[Elem]]
166
+ | (Integer arg0) { (Elem arg0) -> (Comparable | ::Array[untyped]) } -> ::Array[Elem]
167
167
 
168
168
  # Returns the object in *enum* with the minimum value. The first form
169
169
  # assumes all objects implement `Comparable` ; the second uses the block
@@ -186,13 +186,13 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
186
186
  # ```
187
187
  def min: () -> Elem?
188
188
  | () { (Elem arg0, Elem arg1) -> Integer } -> Elem?
189
- | (?Integer arg0) -> ::Array[Elem]
190
- | (?Integer arg0) { (Elem arg0, Elem arg1) -> Integer } -> ::Array[Elem]
189
+ | (Integer arg0) -> ::Array[Elem]
190
+ | (Integer arg0) { (Elem arg0, Elem arg1) -> Integer } -> ::Array[Elem]
191
191
 
192
- def min_by: () -> ::Enumerator[Elem, Return]
192
+ def min_by: () -> ::Enumerator[Elem, Elem?]
193
193
  | () { (Elem arg0) -> (Comparable | ::Array[untyped]) } -> Elem?
194
- | (?Integer arg0) -> ::Enumerator[Elem, Return]
195
- | (?Integer arg0) { (Elem arg0) -> (Comparable | ::Array[untyped]) } -> ::Array[Elem]
194
+ | (Integer arg0) -> ::Enumerator[Elem, ::Array[Elem]]
195
+ | (Integer arg0) { (Elem arg0) -> (Comparable | ::Array[untyped]) } -> ::Array[Elem]
196
196
 
197
197
  # Returns a two element array which contains the minimum and the maximum
198
198
  # value in the enumerable. The first form assumes all objects implement
@@ -207,7 +207,7 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
207
207
  | () { (Elem arg0, Elem arg1) -> Integer } -> [ Elem?, Elem? ]
208
208
 
209
209
  def minmax_by: () -> [ Elem?, Elem? ]
210
- | () { (Elem arg0) -> (Comparable | ::Array[untyped]) } -> ::Enumerator[Elem, Return]
210
+ | () { (Elem arg0) -> (Comparable | ::Array[untyped]) } -> [ Elem?, Elem? ]
211
211
 
212
212
  # Passes each element of the collection to the given block. The method
213
213
  # returns `true` if the block never returns `true` for all elements. If
@@ -252,13 +252,13 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
252
252
  | () { (Elem) -> boolish } -> bool
253
253
 
254
254
  def partition: () { (Elem) -> boolish } -> [ ::Array[Elem], ::Array[Elem] ]
255
- | () -> ::Enumerator[Elem, Return]
255
+ | () -> ::Enumerator[Elem, [ ::Array[Elem], ::Array[Elem] ]]
256
256
 
257
257
  def reject: () { (Elem) -> boolish } -> ::Array[Elem]
258
- | () -> ::Enumerator[Elem, Return]
258
+ | () -> ::Enumerator[Elem, ::Array[Elem]]
259
259
 
260
- def reverse_each: () { (Elem arg0) -> untyped } -> ::Enumerator[Elem, Return]
261
- | () -> ::Enumerator[Elem, Return]
260
+ def reverse_each: () { (Elem arg0) -> untyped } -> void
261
+ | () -> ::Enumerator[Elem, void]
262
262
 
263
263
  # Returns an array containing the items in *enum* sorted.
264
264
  #
@@ -284,12 +284,12 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
284
284
  | () { (Elem arg0, Elem arg1) -> Integer } -> ::Array[Elem]
285
285
 
286
286
  def sort_by: () { (Elem arg0) -> (Comparable | ::Array[untyped]) } -> ::Array[Elem]
287
- | () -> ::Enumerator[Elem, Return]
287
+ | () -> ::Enumerator[Elem, ::Array[Elem]]
288
288
 
289
289
  def take: (Integer n) -> ::Array[Elem]?
290
290
 
291
291
  def take_while: () { (Elem) -> boolish } -> ::Array[Elem]
292
- | () -> ::Enumerator[Elem, Return]
292
+ | () -> ::Enumerator[Elem, ::Array[Elem]]
293
293
 
294
294
  # Implemented in C++
295
295
  # Returns the result of interpreting *enum* as a list of `[key, value]`
@@ -306,9 +306,10 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
306
306
  # #=> {1=>1, 2=>4, 3=>9, 4=>16, 5=>25}
307
307
  # ```
308
308
  def to_h: () -> ::Hash[untyped, untyped]
309
+ | [T, U] () { (Elem) -> [T, U] } -> ::Hash[T, U]
309
310
 
310
311
  def each_slice: (Integer n) { (::Array[Elem]) -> untyped } -> NilClass
311
- | (Integer n) -> ::Enumerator[::Array[Elem], Return]
312
+ | (Integer n) -> ::Enumerator[::Array[Elem], NilClass]
312
313
 
313
314
  interface _NotFound[T]
314
315
  def call: () -> T
@@ -319,8 +320,8 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
319
320
  | [T] (_NotFound[T] ifnone) { (Elem) -> boolish } -> (Elem | T)
320
321
  | [T] (_NotFound[T] ifnone) -> ::Enumerator[Elem, Elem | T]
321
322
 
322
- def flat_map: [U] () { (Elem arg0) -> U } -> U
323
- | () -> ::Enumerator[Elem, Return]
323
+ def flat_map: [U] () { (Elem) -> (Array[U] | U) } -> Array[U]
324
+ | () -> ::Enumerator[Elem, Array[untyped]]
324
325
 
325
326
  def map: [U] () { (Elem arg0) -> U } -> ::Array[U]
326
327
  | () -> ::Enumerator[Elem, ::Array[untyped]]
@@ -370,7 +371,7 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
370
371
  # # show pythagorean triples less than 100
371
372
  # p pythagorean_triples.take_while { |*, z| z < 100 }.force
372
373
  # ```
373
- def lazy: () -> Enumerator::Lazy[Elem, Return]
374
+ def lazy: () -> Enumerator::Lazy[Elem, void]
374
375
 
375
376
  def uniq: () -> ::Array[Elem]
376
377
  | () { (Elem item) -> untyped } -> ::Array[Elem]
@@ -381,22 +382,22 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
381
382
  | [U] (?U arg0) { (Elem arg0) -> U } -> U
382
383
 
383
384
  def filter_map: [U] () { (Elem elem) -> (nil | false | U) } -> ::Array[U]
384
- | () -> ::Enumerator[Elem, Return]
385
+ | () -> ::Enumerator[Elem, ::Array[untyped]]
385
386
 
386
- def chain: (*self enumerables) -> ::Enumerator::Chain[Elem, ::Array[self]]
387
+ def chain: (*self enumerables) -> ::Enumerator::Chain[Elem]
387
388
 
388
389
  def tally: () -> ::Hash[Elem, Integer]
389
390
 
390
- def each_entry: () -> ::Enumerator[Elem, Return]
391
+ def each_entry: () -> ::Enumerator[Elem, self]
391
392
  | () { (Elem arg0) -> untyped } -> self
392
393
 
393
394
  # variadic type parameter is not supported yet
394
395
  # https://github.com/ruby/rbs/issues/21
395
- def zip: [Elem2, Return2] (::Enumerable[Elem2, Return2] enum) -> ::Array[[Elem, Elem2 | nil]]
396
- | [U, Elem2, Return2] (::Enumerable[Elem2, Return2]) { ([Elem, Elem2 | nil]) -> U } -> nil
396
+ def zip: [Elem2] (::Enumerable[Elem2] enum) -> ::Array[[Elem, Elem2 | nil]]
397
+ | [U, Elem2] (::Enumerable[Elem2]) { ([Elem, Elem2 | nil]) -> U } -> nil
397
398
 
398
- def chunk: () -> ::Enumerator[Elem, Return]
399
- | [U] () { (Elem elt) -> U } -> ::Enumerator[[U, Array[Elem]], void]
399
+ def chunk: [U] () { (Elem elt) -> U } -> ::Enumerator[[U, Array[Elem]], void]
400
+ | () -> ::Enumerator[Elem, Enumerator[untyped, untyped]]
400
401
 
401
402
  def chunk_while: () { (Elem elt_before, Elem elt_after) -> boolish } -> ::Enumerator[::Array[Elem], void]
402
403
 
@@ -96,7 +96,7 @@
96
96
  # # => [], [:b], [1], [:b, 1], [1, 2], [:b, 1, 2], 3
97
97
  # ```
98
98
  class Enumerator[unchecked out Elem, out Return] < Object
99
- include Enumerable[Elem, Return]
99
+ include Enumerable[Elem]
100
100
 
101
101
  def each: () { (Elem arg0) -> untyped } -> Return
102
102
  | () -> self
@@ -242,8 +242,8 @@ class Enumerator[unchecked out Elem, out Return] < Object
242
242
  | [U] (U arg0) -> ::Enumerator[[ Elem, U ], Return]
243
243
  end
244
244
 
245
- class Enumerator::Generator[out Elem, out Return] < Object
246
- include Enumerable[Elem, Return]
245
+ class Enumerator::Generator[out Elem] < Object
246
+ include Enumerable[Elem]
247
247
  end
248
248
 
249
249
  class Enumerator::Lazy[out Elem, out Return] < Enumerator[Elem, Return]
@@ -257,6 +257,6 @@ class Enumerator::Yielder < Object
257
257
  def to_proc: () -> Proc
258
258
  end
259
259
 
260
- class Enumerator::Chain[out Elem, out Return] < Object
261
- include Enumerable[Elem, Return]
260
+ class Enumerator::Chain[out Elem] < Object
261
+ include Enumerable[Elem]
262
262
  end
@@ -192,10 +192,6 @@ class File < IO
192
192
  #
193
193
  def self.exist?: (string | _ToPath | IO file_name) -> bool
194
194
 
195
- # Deprecated method. Don't use.
196
- #
197
- alias self.exists? self.exist?
198
-
199
195
  # Converts a pathname to an absolute pathname. Relative paths are referenced
200
196
  # from the current working directory of the process unless `dir_string` is
201
197
  # given, in which case it will be used as the starting point. The given pathname
@@ -106,7 +106,7 @@
106
106
  # See also Object#hash and Object#eql?
107
107
  #
108
108
  class Hash[unchecked out K, unchecked out V] < Object
109
- include Enumerable[[K, V], Hash[K, V]]
109
+ include Enumerable[[K, V]]
110
110
 
111
111
  # Creates a new hash populated with the given objects.
112
112
  #
@@ -143,7 +143,7 @@ class Hash[unchecked out K, unchecked out V] < Object
143
143
  # h2 < h1 #=> false
144
144
  # h1 < h1 #=> false
145
145
  #
146
- def <: (::Hash[K, V]) -> bool
146
+ def <: [A, B] (::Hash[A, B]) -> bool
147
147
 
148
148
  # Returns `true` if *hash* is subset of *other* or equals to *other*.
149
149
  #
@@ -153,7 +153,7 @@ class Hash[unchecked out K, unchecked out V] < Object
153
153
  # h2 <= h1 #=> false
154
154
  # h1 <= h1 #=> true
155
155
  #
156
- def <=: (::Hash[K, V]) -> bool
156
+ def <=: [A, B] (::Hash[A, B]) -> bool
157
157
 
158
158
  # Equality---Two hashes are equal if they each contain the same number of keys
159
159
  # and if each key-value pair is equal to (according to Object#==) the
@@ -183,7 +183,7 @@ class Hash[unchecked out K, unchecked out V] < Object
183
183
  # h2 > h1 #=> true
184
184
  # h1 > h1 #=> false
185
185
  #
186
- def >: (::Hash[K, V]) -> bool
186
+ def >: [A, B] (::Hash[A, B]) -> bool
187
187
 
188
188
  # Returns `true` if *other* is subset of *hash* or equals to *hash*.
189
189
  #
@@ -193,7 +193,7 @@ class Hash[unchecked out K, unchecked out V] < Object
193
193
  # h2 >= h1 #=> true
194
194
  # h1 >= h1 #=> true
195
195
  #
196
- def >=: (::Hash[K, V]) -> bool
196
+ def >=: [A, B] (::Hash[A, B]) -> bool
197
197
 
198
198
  # Element Reference---Retrieves the *value* object corresponding to the *key*
199
199
  # object. If not found, returns the default value (see Hash::new for details).
@@ -563,8 +563,6 @@ class Hash[unchecked out K, unchecked out V] < Object
563
563
  #
564
564
  alias include? has_key?
565
565
 
566
- def index: (V) -> K?
567
-
568
566
  # Return the contents of this hash as a string.
569
567
  #
570
568
  # h = { "c" => 300, "a" => 100, "d" => 400, "c" => 300 }
@@ -615,7 +613,7 @@ class Hash[unchecked out K, unchecked out V] < Object
615
613
  # h.key(300) #=> "c"
616
614
  # h.key(999) #=> nil
617
615
  #
618
- alias key index
616
+ def key: (V) -> K?
619
617
 
620
618
  # Returns `true` if the given key is present in *hsh*.
621
619
  #
@@ -720,8 +718,8 @@ class Hash[unchecked out K, unchecked out V] < Object
720
718
  #
721
719
  # Hash#update is an alias for Hash#merge!.
722
720
  #
723
- def merge!: [A, B] (*::Hash[A, B] other_hashes) -> ::Hash[A | K, B | V]
724
- | [A, B, C] (*::Hash[A, B] other_hashes) { (K key, V oldval, B newval) -> (C) } -> ::Hash[A | K, B | V | C]
721
+ def merge!: (*::Hash[K, V] other_hashes) -> self
722
+ | (*::Hash[K, V] other_hashes) { (K key, V oldval, V newval) -> (V) } -> self
725
723
 
726
724
  # Searches through the hash comparing *obj* with the value using `==`. Returns
727
725
  # the first key-value pair (two-element array) that matches. See also
@@ -770,7 +768,7 @@ class Hash[unchecked out K, unchecked out V] < Object
770
768
  # h = { "a" => 100, "b" => 200 }
771
769
  # h.replace({ "c" => 300, "d" => 400 }) #=> {"c"=>300, "d"=>400}
772
770
  #
773
- def replace: [A, B] (Hash[A, B] | _ToHash[A, B]) -> Hash[A, B]
771
+ def replace: (Hash[K, V]) -> self
774
772
 
775
773
  # Returns a new hash consisting of entries for which the block returns true.
776
774
  #