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

Raise UnsupportedSyntax if a proc object is given as block-pass-argument #1245

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tk0miya
Copy link
Contributor

@tk0miya tk0miya commented Sep 30, 2024

At present, users will see BlockTypeMismatch diagnostic when a proc object is passed as block-pass-argument. We'll usually see the diagnostic with &method idiom.

[1, 2, 3].map(&method(:puts))

But there is nothing to do from the user side because such a call is not invalid. It seems like a false positive.

This changes the diagnostic type for the case to UnsupportedSyntax. It notifies users that the source code is valid and that change is unnecessary.

refs: #149

At present, users will see BlockTypeMismatch diagnostic when a proc
object is passed as block-pass-argument.  We'll usually see the diagnostic
with `&method` idiom.

```ruby
[1, 2, 3].map(&method(:puts))
```

But there is nothing to do from the user side because such a call is
not invalid.  It seems like a false positive.

This changes the diagnostic type for the case to UnsupportedSyntax.  It
notifies users that the source code is valid and that change is
unnecessary.

refs: soutaro#149
@tk0miya tk0miya force-pushed the type_construction/proc_for_block_pass_argument branch from f9cc947 to f6a81e8 Compare September 30, 2024 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant