From 6dccc53368652ba5fe0392d0ca8425c79727344a Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 19 Jan 2017 01:38:59 +0000 Subject: parse.y: warn space * parse.y (parser_yylex): warn parentheses after space. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'parse.y') diff --git a/parse.y b/parse.y index 8a800bbd50..0a070ed4bc 100644 --- a/parse.y +++ b/parse.y @@ -8536,11 +8536,18 @@ parser_yylex(struct parser_params *parser) } else if (IS_SPCARG(-1)) { c = tLPAREN_ARG; + if (lex_state == EXPR_ARG) { + rb_warning0("parentheses after method name and a space is interpreted as " + "an argument list, not a parenthesed argument"); + } } else if (IS_lex_state(EXPR_ENDFN) && space_seen && !lambda_beginning_p()) { rb_warning0("parentheses after method name is interpreted as " "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"); + } paren_nest++; COND_PUSH(0); CMDARG_PUSH(0); -- cgit v1.2.3