diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-04-12 16:07:49 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-04-12 16:07:49 +0900 |
commit | e36988450e9e9ccccb41c72135f1e57790920668 (patch) | |
tree | 2a671b2f464701bedbdc69ded905f90c7991a0b3 /test/ruby | |
parent | 971b552735f46cbda7345e8de60a2037ee10e259 (diff) |
[Bug #20423] Disallow anonymous block within argument forwarding
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_compile_prism.rb | 9 | ||||
-rw-r--r-- | test/ruby/test_syntax.rb | 1 |
2 files changed, 1 insertions, 9 deletions
diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index eef909eb07..d13b150f93 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -1839,15 +1839,6 @@ end o.bar { :ok } RUBY - - # Test anonymous block forwarding from argument forwarding - assert_prism_eval(<<~RUBY) - o = Object.new - def o.foo = yield - def o.bar(...) = foo(&) - - o.bar { :ok } - RUBY end def test_BlockLocalVariableNode diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 7cc5e542a7..44162f06cb 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -190,6 +190,7 @@ class TestSyntax < Test::Unit::TestCase assert_syntax_error("def f(...); g(0, *); end", /no anonymous rest parameter/) assert_syntax_error("def f(...); g(**); end", /no anonymous keyword rest parameter/) assert_syntax_error("def f(...); g(x: 1, **); end", /no anonymous keyword rest parameter/) + assert_syntax_error("def f(...); g(&); end", /no anonymous block parameter/) end def test_newline_in_block_parameters |