ruby-changes:44854
From: nobu <ko1@a...>
Date: Tue, 29 Nov 2016 19:47:48 +0900 (JST)
Subject: [ruby-changes:44854] nobu:r56927 (trunk): parse.y: ambiguous parentheses
nobu 2016-11-29 19:47:43 +0900 (Tue, 29 Nov 2016) New Revision: 56927 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56927 Log: parse.y: ambiguous parentheses * parse.y (parser_yylex): warn ambiguous parentheses after a space in method definitions. Modified files: trunk/ext/date/lib/date.rb trunk/ext/openssl/lib/openssl/buffering.rb trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 56926) +++ parse.y (revision 56927) @@ -8520,6 +8520,10 @@ parser_yylex(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L8520 else if (IS_SPCARG(-1)) { c = tLPAREN_ARG; } + else if (IS_lex_state(EXPR_ENDFN) && space_seen) { + rb_warning0("parentheses after method name is interpreted as"); + rb_warning0("an argument list, not a decomposed argument"); + } paren_nest++; COND_PUSH(0); CMDARG_PUSH(0); Index: ext/date/lib/date.rb =================================================================== --- ext/date/lib/date.rb (revision 56926) +++ ext/date/lib/date.rb (revision 56927) @@ -15,17 +15,17 @@ class Date https://github.com/ruby/ruby/blob/trunk/ext/date/lib/date.rb#L15 protected :d - def zero? () false end - def finite? () false end - def infinite? () d.nonzero? end - def nan? () d.zero? end + def zero?() false end + def finite?() false end + def infinite?() d.nonzero? end + def nan?() d.zero? end def abs() self.class.new end - def -@ () self.class.new(-d) end - def +@ () self.class.new(+d) end + def -@() self.class.new(-d) end + def +@() self.class.new(+d) end - def <=> (other) + def <=>(other) case other when Infinity; return d <=> other.d when Numeric; return d Index: ext/openssl/lib/openssl/buffering.rb =================================================================== --- ext/openssl/lib/openssl/buffering.rb (revision 56926) +++ ext/openssl/lib/openssl/buffering.rb (revision 56927) @@ -381,7 +381,7 @@ module OpenSSL::Buffering https://github.com/ruby/ruby/blob/trunk/ext/openssl/lib/openssl/buffering.rb#L381 # Writes +s+ to the stream. +s+ will be converted to a String using # String#to_s. - def << (s) + def <<(s) do_write(s) self end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/