From: nobu@...
Date: 2014-09-23T13:00:41+00:00
Subject: [ruby-core:65242] [ruby-trunk - Bug #10279] [Closed] Syntax error on Hash with symbol syntax and nested expression: 2.1.3 regression

Issue #10279 has been updated by Nobuyoshi Nakada.

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]

----------------------------------------
Bug #10279: Syntax error on Hash with symbol syntax and nested expression: 2.1.3 regression 
https://bugs.ruby-lang.org/issues/10279#change-49072

* Author: Jack Montaach
* Status: Closed
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category: syntax
* Target version: next minor
* ruby -v: 2.1.3
* Backport: 2.0.0: DONTNEED, 2.1: REQUIRED
----------------------------------------
The following gives syntax error on ruby 2.1.3

~~~ruby
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"}
~~~




-- 
https://bugs.ruby-lang.org/