Project

General

Profile

Actions

Bug #10279

closed

Syntax error on Hash with symbol syntax and nested expression: 2.1.3 regression

Added by jackmontaach (Jack Montaach) over 9 years ago. Updated over 9 years ago.

Status:
Closed
Target version:
ruby -v:
2.1.3
[ruby-core:65211]

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

Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #9669: Inconsistent SyntaxError in Ruby 2.1 mandatory keyword arguments definition without parentheses.Closed03/25/2014Actions
Has duplicate Ruby master - Bug #10288: Parser incompatibility between 2.1.2 and 2.1.3Closednagachika (Tomoyuki Chikanaga)09/24/2014Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0