Skip to content

Commit 65f4290

Browse files
authored
Merge pull request #2006 from ParadoxV5/2004-enum-each
Use generic class definitions with default types in `top`/`Enumerator``::_Each`
2 parents c64bc1d + 84de697 commit 65f4290

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

core/builtin.rbs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,12 @@ interface _Inspect
170170
def inspect: () -> String
171171
end
172172

173-
interface _Each[out A]
174-
def each: () { (A) -> void } -> void
173+
interface _Each[out E, out R = void]
174+
def each: () { (E) -> void } -> R
175175
end
176176

177-
interface _EachEntry[out A]
178-
def each_entry: () { (A) -> void } -> self
177+
interface _EachEntry[out E]
178+
def each_entry: () { (E) -> void } -> self
179179
end
180180

181181
interface _Reader

core/enumerator.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class Enumerator[unchecked out Elem, out Return = void] < Object
132132

133133
# A convenience interface for `each` with optional block
134134
#
135-
interface _Each[out E, out R]
135+
interface _Each[out E, out R = self]
136136
def each: () { (E) -> void } -> R
137137
| () -> Enumerator[E, R]
138138
end

0 commit comments

Comments
 (0)