Enumerator#initialize support nil, #call and #to_int#1904
Open
ksss wants to merge 1 commit intoruby:masterfrom
Open
Enumerator#initialize support nil, #call and #to_int#1904ksss wants to merge 1 commit intoruby:masterfrom
nil, #call and #to_int#1904ksss wants to merge 1 commit intoruby:masterfrom
Conversation
nil, #call and #to_intnil, #call and #to_int
ParadoxV5
reviewed
Jun 21, 2024
| # object. | ||
| # | ||
| def initialize: (?Integer arg0) { (Enumerator::Yielder arg0) -> Return } -> void | ||
| def initialize: (?(nil | _Call | ::_ToInt) arg0) { (Enumerator::Yielder arg0) -> Return } -> void |
Contributor
There was a problem hiding this comment.
Suggested change
| def initialize: (?(nil | _Call | ::_ToInt) arg0) { (Enumerator::Yielder arg0) -> Return } -> void | |
| def initialize: (?(int? | _Call) size) { (Yielder yielder) -> Return } -> void |
Comment on lines
+272
to
+274
| interface _Call | ||
| def call: () -> untyped | ||
| end |
Contributor
There was a problem hiding this comment.
Enumerator.new(->{'hi'}) {}.size #=> "hi"
Suggested change
| interface _Call | |
| def call: () -> untyped | |
| end | |
| interface _Size | |
| def call: () -> (Integer | Float)? | |
| end |
Relevant: #420 (comment)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Argument of
Enumerator#initializeallowsnil,#calland#to_intobject.Included
Float::INFINITYin#to_int.https://github.com/ruby/ruby/blob/ac9e84df3d0b06e62498aafbca99e8f8475ec142/enumerator.c#L437-L451