Project

General

Profile

Actions

Bug #10653

closed

do-end block in ternary operator is syntax error

Added by yancya (Shinta Koyanagi) almost 10 years ago. Updated almost 9 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
[ruby-dev:48790]

Description

  • For example
ruby -v -e 'true ? 1.tap do |n| p n end : 0'
  • Result by 2.1.5
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0]
1
  • Result by 2.2.0
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
-e:1: syntax error, unexpected keyword_do_cond, expecting ':'
true ? 1.tap do |n| p n end : 0
               ^
-e:1: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
true ? 1.tap do |n| p n end : 0
                       ^

Related issues 2 (0 open2 closed)

Related to Ruby master - Feature #4276: Allow use of quotes in symbol syntactic sugar for hashesClosedmatz (Yukihiro Matsumoto)01/13/2011Actions
Related to Ruby master - Bug #11456: Hash リテラル中で rescue をもちいると SyntaxError になるClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0