@@ -77,6 +77,7 @@ def test_script_lines_encoding
7777 def test_anonymous_block_forwarding
7878 assert_syntax_error ( "def b; c(&); end" , /no anonymous block parameter/ )
7979 assert_syntax_error ( "def b(&) ->(&) {c(&)} end" , /anonymous block parameter is also used/ )
80+ assert_valid_syntax ( "def b(&) ->() {c(&)} end" )
8081 assert_separately ( [ ] , "#{ <<-"begin;" } \n #{ <<-'end;' } " )
8182 begin;
8283 def b(&); c(&) end
@@ -147,6 +148,9 @@ def test_anonymous_rest_forwarding
147148 assert_syntax_error ( "def b(*) ->(*) {c(*)} end" , /anonymous rest parameter is also used/ )
148149 assert_syntax_error ( "def b(a, *) ->(*) {c(1, *)} end" , /anonymous rest parameter is also used/ )
149150 assert_syntax_error ( "def b(*) ->(a, *) {c(*)} end" , /anonymous rest parameter is also used/ )
151+ assert_valid_syntax ( "def b(*) ->() {c(*)} end" )
152+ assert_valid_syntax ( "def b(a, *) ->() {c(1, *)} end" )
153+ assert_valid_syntax ( "def b(*) ->(a) {c(*)} end" )
150154 assert_separately ( [ ] , "#{ <<-"begin;" } \n #{ <<-'end;' } " )
151155 begin;
152156 def b(*); c(*) end
@@ -163,6 +167,9 @@ def test_anonymous_keyword_rest_forwarding
163167 assert_syntax_error ( "def b(**) ->(**) {c(**)} end" , /anonymous keyword rest parameter is also used/ )
164168 assert_syntax_error ( "def b(k:, **) ->(**) {c(k: 1, **)} end" , /anonymous keyword rest parameter is also used/ )
165169 assert_syntax_error ( "def b(**) ->(k:, **) {c(**)} end" , /anonymous keyword rest parameter is also used/ )
170+ assert_valid_syntax ( "def b(**) ->() {c(**)} end" )
171+ assert_valid_syntax ( "def b(k:, **) ->() {c(k: 1, **)} end" )
172+ assert_valid_syntax ( "def b(**) ->(k:) {c(**)} end" )
166173 assert_separately ( [ ] , "#{ <<-"begin;" } \n #{ <<-'end;' } " )
167174 begin;
168175 def b(**); c(**) end
0 commit comments