Skip to content

Commit

Permalink
Merge pull request #2006 from ParadoxV5/2004-enum-each
Browse files Browse the repository at this point in the history
Use generic class definitions with default types in `top`/`Enumerator``::_Each`
  • Loading branch information
soutaro committed Sep 15, 2024
2 parents c64bc1d + 84de697 commit 65f4290
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions core/builtin.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ interface _Inspect
def inspect: () -> String
end

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

interface _EachEntry[out A]
def each_entry: () { (A) -> void } -> self
interface _EachEntry[out E]
def each_entry: () { (E) -> void } -> self
end

interface _Reader
Expand Down
2 changes: 1 addition & 1 deletion core/enumerator.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class Enumerator[unchecked out Elem, out Return = void] < Object

# A convenience interface for `each` with optional block
#
interface _Each[out E, out R]
interface _Each[out E, out R = self]
def each: () { (E) -> void } -> R
| () -> Enumerator[E, R]
end
Expand Down

0 comments on commit 65f4290

Please sign in to comment.