Actions
Bug #10279
closedSyntax error on Hash with symbol syntax and nested expression: 2.1.3 regression
Description
The following gives syntax error on ruby 2.1.3
h = { key: if true
"yes"
else
"no"
end }
puts h.inspect
/usr/local/rvm/rubies/ruby-2.1.3/bin/ruby x.rb
x.rb:1: syntax error, unexpected modifier_if
h = { key: if true
^
x.rb:3: syntax error, unexpected keyword_else, expecting end-of-input
/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby x.rb
{:key=>"yes"}
Updated by hsbt (Hiroshi SHIBATA) about 10 years ago
trunk is same behaviour:
ruby 2.2.0preview1 (2014-09-17 trunk 47616) [x86_64-darwin13]
10279.rb:1: syntax error, unexpected modifier_if
h = { key: if true
Updated by nobu (Nobuyoshi Nakada) about 10 years ago
- Description updated (diff)
- Category changed from core to syntax
- Status changed from Open to Assigned
- Assignee changed from matz (Yukihiro Matsumoto) to nobu (Nobuyoshi Nakada)
Updated by nobu (Nobuyoshi Nakada) about 10 years ago
- Related to Bug #9669: Inconsistent SyntaxError in Ruby 2.1 mandatory keyword arguments definition without parentheses. added
Updated by nobu (Nobuyoshi Nakada) about 10 years ago
- Backport set to 2.0.0: DONTNEED, 2.1: REQUIRED
Updated by nobu (Nobuyoshi Nakada) about 10 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
Applied in changeset r47696.
parse.y: label cannot be followed by a modifier
- parse.y (parse_ident): just after a label, new expression should
start, cannot be a modifier. [ruby-core:65211] [Bug #10279]
Updated by nagachika (Tomoyuki Chikanaga) about 10 years ago
- Backport changed from 2.0.0: DONTNEED, 2.1: REQUIRED to 2.0.0: DONTNEED, 2.1: DONE
Backported r47696 and r47697 into ruby_2_1
branch at r47703.
Updated by usa (Usaku NAKAMURA) about 10 years ago
- Has duplicate Bug #10288: Parser incompatibility between 2.1.2 and 2.1.3 added
Actions
Like0
Like0Like0Like0Like0Like0Like0Like0