aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--parse.y2
-rw-r--r--test/ruby/test_parse.rb11
2 files changed, 12 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index 4f94b0eb81..15be84cc4e 100644
--- a/parse.y
+++ b/parse.y
@@ -8468,7 +8468,7 @@ parser_yylex(struct parser_params *parser)
"an argument list, not a decomposed argument");
}
else if (lex_state == (EXPR_END|EXPR_LABEL) && space_seen) {
- rb_warning0("don't put space before argument parentheses");
+ c = tLPAREN_ARG;
}
paren_nest++;
COND_PUSH(0);
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index f92bb49e05..36ff776db9 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -1054,6 +1054,17 @@ x = __ENCODING__
assert_not_match(/unexpected tSTRING_END/, e)
end
+ def test_lparenarg
+ o = Struct.new(:x).new
+ def o.i(x)
+ self.x = x
+ end
+ o.instance_eval {i (-1.3).abs}
+ assert_equal(1.3, o.x)
+ o.instance_eval {i = 0; i (-1.3).abs}
+ assert_equal(1.3, o.x)
+ end
+
=begin
def test_past_scope_variable
assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}}