[ruby-dev:49219] [Ruby trunk - Bug #10653] do-end block in ternary operator is syntax error
From:
nobu@...
Date:
2015-08-17 11:32:46 UTC
List:
ruby-dev #49219
Issue #10653 has been updated by Nobuyoshi Nakada.
Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED
----------------------------------------
Bug #10653: do-end block in ternary operator is syntax error
https://bugs.ruby-lang.org/issues/10653#change-53834
* Author: Shinta Koyanagi
* Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* ruby -v: ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
* Backport: 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED
----------------------------------------
- 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
^
```
--
https://bugs.ruby-lang.org/