rbs 0.16.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/Rakefile +7 -1
- data/core/array.rbs +1 -1
- data/core/builtin.rbs +2 -2
- data/core/dir.rbs +1 -1
- data/core/enumerable.rbs +41 -40
- data/core/enumerator.rbs +5 -5
- data/core/hash.rbs +8 -8
- data/core/io.rbs +1 -1
- data/core/range.rbs +1 -1
- data/core/struct.rbs +1 -1
- data/lib/rbs/definition.rb +9 -4
- data/lib/rbs/definition_builder.rb +48 -15
- data/lib/rbs/parser.rb +306 -301
- data/lib/rbs/parser.y +15 -8
- data/lib/rbs/prototype/rb.rb +9 -3
- data/lib/rbs/version.rb +1 -1
- data/sig/definition.rbs +8 -3
- data/sig/definition_builder.rbs +3 -2
- data/stdlib/csv/0/csv.rbs +3 -3
- data/stdlib/dbm/0/dbm.rbs +1 -1
- data/stdlib/prime/0/prime.rbs +1 -1
- data/stdlib/set/0/set.rbs +10 -10
- data/stdlib/tsort/0/cyclic.rbs +4 -0
- data/stdlib/tsort/0/interfaces.rbs +19 -0
- data/stdlib/tsort/0/tsort.rbs +363 -0
- data/steep/Gemfile.lock +9 -9
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f458be96f0cfc3e45e51bb77f4d42aafba7f1fee62e0ed8695eb6a95b85189b2
|
4
|
+
data.tar.gz: 9b84c8860182155f4e5979e668a953d1b8191754f01c6443d549fc14b5be1908
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0c7616abdb3a3d4e08212014aebad858e113acf265641e4f657b2d48b9e20ec8ac7744a18f90459086be39953eb7ebef9d32acd3b22362e31d6e12e83251baf
|
7
|
+
data.tar.gz: ee12553e0611d2b8826d9687ab63fcc38bfb67435bcf537950b31ef6070c26d85fcf8d956ccc1285072e6513facdbd43521935ae9372a11cae6f100e16691084
|
data/.github/workflows/ruby.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.17.0 (2020-11-14)
|
6
|
+
|
7
|
+
* 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))
|
8
|
+
* Parser error handling improvement ([#463](https://github.com/ruby/rbs/pull/463), [#475](https://github.com/ruby/rbs/pull/475))
|
9
|
+
* Hash spread syntax handling improvement with `prototype rb` ([#465](https://github.com/ruby/rbs/pull/465))
|
10
|
+
|
5
11
|
## 0.16.0 (2020-11-05)
|
6
12
|
|
7
13
|
* 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
|
-
| () ->
|
49
|
+
| () -> Enumerator[User | Bot, void] # Method can be overloaded.
|
50
50
|
end
|
51
51
|
end
|
52
52
|
```
|
data/Rakefile
CHANGED
@@ -29,7 +29,7 @@ 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"]
|
@@ -60,6 +60,12 @@ task :test => :parser
|
|
60
60
|
task :stdlib_test => :parser
|
61
61
|
task :build => :parser
|
62
62
|
|
63
|
+
task :confirm_parser do
|
64
|
+
puts "Testing if parser.rb is updated with respect to parser.y"
|
65
|
+
sh "racc -v -o lib/rbs/parser.rb lib/rbs/parser.y"
|
66
|
+
sh "git diff --exit-code lib/rbs/parser.rb"
|
67
|
+
end
|
68
|
+
|
63
69
|
namespace :generate do
|
64
70
|
task :stdlib_test, [:class] do |_task, args|
|
65
71
|
klass = args.fetch(:class) do
|
data/core/array.rbs
CHANGED
data/core/builtin.rbs
CHANGED
data/core/dir.rbs
CHANGED
data/core/enumerable.rbs
CHANGED
@@ -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
|
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,
|
69
|
+
| (?Integer n) -> ::Enumerator[Elem, NilClass]
|
70
70
|
|
71
71
|
def detect: (?Proc ifnone) { (Elem) -> boolish } -> Elem?
|
72
|
-
| (?Proc ifnone) -> ::Enumerator[Elem,
|
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,
|
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],
|
80
|
+
| (Integer n) -> ::Enumerator[::Array[Elem], NilClass]
|
81
81
|
|
82
|
-
def each_with_index: () { (Elem arg0, Integer arg1) -> untyped } ->
|
83
|
-
| () -> ::Enumerator[[ Elem, Integer ],
|
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 ],
|
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,
|
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,
|
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
|
-
| (
|
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,
|
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
|
-
| (
|
161
|
-
| (
|
160
|
+
| (Integer arg0) -> ::Array[Elem]
|
161
|
+
| (Integer arg0) { (Elem arg0, Elem arg1) -> Integer } -> ::Array[Elem]
|
162
162
|
|
163
|
-
def max_by: () -> ::Enumerator[Elem,
|
163
|
+
def max_by: () -> ::Enumerator[Elem, Elem?]
|
164
164
|
| () { (Elem arg0) -> (Comparable | ::Array[untyped]) } -> Elem?
|
165
|
-
| (
|
166
|
-
| (
|
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
|
-
| (
|
190
|
-
| (
|
189
|
+
| (Integer arg0) -> ::Array[Elem]
|
190
|
+
| (Integer arg0) { (Elem arg0, Elem arg1) -> Integer } -> ::Array[Elem]
|
191
191
|
|
192
|
-
def min_by: () -> ::Enumerator[Elem,
|
192
|
+
def min_by: () -> ::Enumerator[Elem, Elem?]
|
193
193
|
| () { (Elem arg0) -> (Comparable | ::Array[untyped]) } -> Elem?
|
194
|
-
| (
|
195
|
-
| (
|
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]) } ->
|
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,
|
255
|
+
| () -> ::Enumerator[Elem, [ ::Array[Elem], ::Array[Elem] ]]
|
256
256
|
|
257
257
|
def reject: () { (Elem) -> boolish } -> ::Array[Elem]
|
258
|
-
| () -> ::Enumerator[Elem,
|
258
|
+
| () -> ::Enumerator[Elem, ::Array[Elem]]
|
259
259
|
|
260
|
-
def reverse_each: () { (Elem arg0) -> untyped } ->
|
261
|
-
| () -> ::Enumerator[Elem,
|
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,
|
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,
|
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],
|
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
|
323
|
-
| () -> ::Enumerator[Elem,
|
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,
|
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,
|
385
|
+
| () -> ::Enumerator[Elem, ::Array[untyped]]
|
385
386
|
|
386
|
-
def chain: (*self enumerables) -> ::Enumerator::Chain[Elem
|
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,
|
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
|
396
|
-
| [U, Elem2
|
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,
|
399
|
-
|
|
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
|
|
data/core/enumerator.rbs
CHANGED
@@ -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
|
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
|
246
|
-
include Enumerable[Elem
|
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
|
261
|
-
include Enumerable[Elem
|
260
|
+
class Enumerator::Chain[out Elem] < Object
|
261
|
+
include Enumerable[Elem]
|
262
262
|
end
|
data/core/hash.rbs
CHANGED
@@ -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]
|
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[
|
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[
|
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[
|
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[
|
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).
|
@@ -720,8 +720,8 @@ class Hash[unchecked out K, unchecked out V] < Object
|
|
720
720
|
#
|
721
721
|
# Hash#update is an alias for Hash#merge!.
|
722
722
|
#
|
723
|
-
def merge!:
|
724
|
-
|
|
723
|
+
def merge!: (*::Hash[K, V] other_hashes) -> self
|
724
|
+
| (*::Hash[K, V] other_hashes) { (K key, V oldval, V newval) -> (V) } -> self
|
725
725
|
|
726
726
|
# Searches through the hash comparing *obj* with the value using `==`. Returns
|
727
727
|
# the first key-value pair (two-element array) that matches. See also
|
@@ -770,7 +770,7 @@ class Hash[unchecked out K, unchecked out V] < Object
|
|
770
770
|
# h = { "a" => 100, "b" => 200 }
|
771
771
|
# h.replace({ "c" => 300, "d" => 400 }) #=> {"c"=>300, "d"=>400}
|
772
772
|
#
|
773
|
-
def replace:
|
773
|
+
def replace: (Hash[K, V]) -> self
|
774
774
|
|
775
775
|
# Returns a new hash consisting of entries for which the block returns true.
|
776
776
|
#
|
data/core/io.rbs
CHANGED
data/core/range.rbs
CHANGED
data/core/struct.rbs
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
# struct member which is either a quoted string ( `"name"` ) or a
|
28
28
|
# [Symbol](https://ruby-doc.org/core-2.6.3/Symbol.html) ( `:name` ).
|
29
29
|
class Struct[Elem] < Object
|
30
|
-
include Enumerable[Elem
|
30
|
+
include Enumerable[Elem]
|
31
31
|
|
32
32
|
type attribute_name = Symbol | String
|
33
33
|
|
data/lib/rbs/definition.rb
CHANGED
@@ -60,12 +60,14 @@ module RBS
|
|
60
60
|
attr_reader :defs
|
61
61
|
attr_reader :accessibility
|
62
62
|
attr_reader :extra_annotations
|
63
|
+
attr_reader :alias_of
|
63
64
|
|
64
|
-
def initialize(super_method:, defs:, accessibility:, annotations: [])
|
65
|
+
def initialize(super_method:, defs:, accessibility:, annotations: [], alias_of:)
|
65
66
|
@super_method = super_method
|
66
67
|
@defs = defs
|
67
68
|
@accessibility = accessibility
|
68
69
|
@extra_annotations = annotations
|
70
|
+
@alias_of = alias_of
|
69
71
|
end
|
70
72
|
|
71
73
|
def defined_in
|
@@ -110,7 +112,8 @@ module RBS
|
|
110
112
|
self.class.new(
|
111
113
|
super_method: super_method&.sub(s),
|
112
114
|
defs: defs.map {|defn| defn.update(type: defn.type.sub(s)) },
|
113
|
-
accessibility: @accessibility
|
115
|
+
accessibility: @accessibility,
|
116
|
+
alias_of: alias_of
|
114
117
|
)
|
115
118
|
end
|
116
119
|
|
@@ -118,7 +121,8 @@ module RBS
|
|
118
121
|
self.class.new(
|
119
122
|
super_method: super_method&.map_type(&block),
|
120
123
|
defs: defs.map {|defn| defn.update(type: defn.type.map_type(&block)) },
|
121
|
-
accessibility: @accessibility
|
124
|
+
accessibility: @accessibility,
|
125
|
+
alias_of: alias_of
|
122
126
|
)
|
123
127
|
end
|
124
128
|
|
@@ -126,7 +130,8 @@ module RBS
|
|
126
130
|
self.class.new(
|
127
131
|
super_method: super_method,
|
128
132
|
defs: defs.map {|defn| defn.update(type: yield(defn.type)) },
|
129
|
-
accessibility: @accessibility
|
133
|
+
accessibility: @accessibility,
|
134
|
+
alias_of: alias_of
|
130
135
|
)
|
131
136
|
end
|
132
137
|
end
|