parser
parser copied to clipboard
ruby/ruby@e369884
https://github.com/ruby/ruby/commit/e36988450e9e9ccccb41c72135f1e57790920668
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