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

ruby/ruby@e369884 #1007

Open
iliabylich opened this issue Apr 14, 2024 · 1 comment
Open

ruby/ruby@e369884 #1007

iliabylich opened this issue Apr 14, 2024 · 1 comment
Labels

Comments

@iliabylich
Copy link
Collaborator

ruby/ruby@e369884

@Earlopain
Copy link
Contributor

Earlopain commented Dec 17, 2024

Disallow anonymous block within argument forwarding

For parser, this is already the case since argument forwarding was introduced:

$ ruby -cve 'def f(...); g(&); end'
ruby 3.1.6p260 (2024-05-29 revision a777087be6) [x86_64-linux]
Syntax OK

$ ruby-parse --31 -e "def f(...); g(&); end"
(fragment:0):1:15: error: no anonymous block parameter
(fragment:0):1: def f(...); g(&); end
(fragment:0):1:               ^

I guess, should be allowed for those earlier versions but I'm not going to look into it further than this for now.

def test_anonymous_blockarg_with_arg_forwarding
  assert_diagnoses(
    [:error, :no_anonymous_blockarg],
    %q{def foo(...); bar(&); end},
    %q{                  ^ location},
    SINCE_3_1)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants