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

Allow keyword argument for Object#enum_for #1327

Merged
merged 1 commit into from
May 12, 2023
Merged

Conversation

ksss
Copy link
Collaborator

@ksss ksss commented May 9, 2023

Example

enum_for(:instance_exec, x: 123){ |x:| p x}.size
#=> 123

Real case

lib/rbs/file_finder.rb:8:13: [error] Cannot find compatible overloading of method `enum_for` of type `singleton(::RBS::FileFinder)`
│ Method types:
│   def enum_for: (::Symbol, *untyped) ?{ (*untyped) -> ::Integer } -> ::Enumerator[untyped, untyped]
│               | () ?{ () -> ::Integer } -> ::Enumerator[untyped, self]
│
│ Diagnostic ID: Ruby::UnresolvedOverloading
│
└       return enum_for(__method__, path, immediate: immediate, skip_hidden: skip_hidden) unless block
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

example
```rb
enum_for(:instance_exec, x: 123){ |x:| p x}.size
\#=> 123
```
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 added this pull request to the merge queue May 12, 2023
Merged via the queue into ruby:master with commit 6627d33 May 12, 2023
@ksss ksss deleted the enum_for branch May 12, 2023 04:43
@soutaro soutaro added this to the RBS 3.2 milestone Jul 18, 2023
@soutaro soutaro added the Released PRs already included in the released version label Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Released PRs already included in the released version
Development

Successfully merging this pull request may close these issues.

2 participants