Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Enumerable#to_h type #462

Merged
merged 1 commit into from
Nov 8, 2020

Conversation

pocke
Copy link
Member

@pocke pocke commented Nov 7, 2020

Enumerable#to_h actually receives a block, but the type wasn't aware of the block.
So this pull request adds a method type to be aware of the block argument.

By the way, other to_hs support the block argument.

rbs/core/hash.rbs

Lines 857 to 858 in 967a421

def to_h: () -> Hash[K, V]
| [A, B] () { (K, V) -> [ A, B ] } -> Hash[A, B]

rbs/core/array.rbs

Lines 1855 to 1856 in 967a421

def to_h: () -> Hash[untyped, untyped]
| [T, S] () { (Elem) -> [T, S] } -> Hash[T, S]

Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@soutaro soutaro merged commit aa06bbc into ruby:master Nov 8, 2020
@pocke pocke deleted the Update-Enumerable-to_h-type branch November 8, 2020 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants