Bug #10653
do-end block in ternary operator is syntax error
ステータス: | Closed | ||
---|---|---|---|
優先度: | Normal | ||
担当者: | |||
ruby -v: | ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14] | Backport: | 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONE |
説明
- 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 ^
関連するチケット
関係しているリビジョン
parse.y: fix block after conditional
- parse.y: fix syntax error at do-block after a conditional operator. separate label-allowed and after-a-label states from others as bit flags. [Bug #10653]
merge revision(s) 50409,51616,51617,51624: [Backport #10653] [Backport #11456]
parse.y: %-string cannot be a label * parse.y (parser_yylex): %-string cannot be a label even if
terminated by single/double quotes.
* parse.y: fix syntax error at do-block after a conditional
operator. separate label-allowed and after-a-label states from
others as bit flags. [Bug #10653]
* parse.y (IS_BEG): include labeled argument state, which was EXPR_LABELARG. [Bug #11456]
履歴
#1
Nobuyoshi Nakada が12ヶ月前に更新
- 関連している Feature #4276: Allow use of quotes in symbol syntactic sugar for hashes を追加
#2
Nobuyoshi Nakada が4ヶ月前に更新
- Backport を 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN から 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED に変更
#3
Nobuyoshi Nakada が4ヶ月前に更新
- ステータス を Open から Closed に変更
#4
Nobuyoshi Nakada が4ヶ月前に更新
- 関連している Bug #11456: Hash リテラル中で rescue をもちいると SyntaxError になる を追加
#5
Tomoyuki Chikanaga が2ヶ月前に更新
#6
Tomoyuki Chikanaga が2ヶ月前に更新
r51616 should be backported too?
#7
Tomoyuki Chikanaga が2ヶ月前に更新
- Backport を 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED から 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONE に変更
r50409, r51616, r51617 and r51624 were backported into ruby_2_2
branch at r52046.
With r50409 a minor incompatibility is introduced ({ %w"key": 0 } cause SyntaxError).
I'm not confident the incompatibility is essential part of this fixes, but the accurate surgery is required to eliminate the incompatibility. I gave up.