Project

General

Profile

Bug #15416 » method_call_with_args_and_no_parens_in_array.patch

shuujii (Shuji KOBAYASHI), 12/15/2018 02:38 AM

View differences:

parse.y
2090 2090
		;
2091 2091

  
2092 2092
aref_args	: none
2093
		| command
2094
		    {
2095
		    /*%%%*/
2096
			value_expr($1);
2097
			$$ = NEW_LIST($1, &@$);
2098
		    /*% %*/
2099
		    /*% ripper: args_add!(args_new!, $1) %*/
2100
		    }
2093 2101
		| args trailer
2094 2102
		    {
2095 2103
			$$ = $1;
test/ruby/test_syntax.rb
1279 1279
    assert_valid_syntax('obj::foo (1) {}')
1280 1280
  end
1281 1281

  
1282
  def test_method_call_with_args_and_no_parens_in_array
1283
    assert_equal(["1"], [sprintf "1"])
1284
    assert_equal(["2"], [sprintf "%d", 2])
1285
  end
1286

  
1282 1287
  private
1283 1288

  
1284 1289
  def not_label(x) @result = x; @not_label ||= nil end