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

Updated by hsbt (Hiroshi SHIBATA) over 9 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) over 9 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) over 9 years ago

  • Related to Bug #9669: Inconsistent SyntaxError in Ruby 2.1 mandatory keyword arguments definition without parentheses. added

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Backport set to 2.0.0: DONTNEED, 2.1: REQUIRED

Updated by nobu (Nobuyoshi Nakada) over 9 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) over 9 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) over 9 years ago

  • Has duplicate Bug #10288: Parser incompatibility between 2.1.2 and 2.1.3 added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0