Project

General

Profile

Bug #10279

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

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

Status:
Closed
Priority:
Normal
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

Related to Ruby trunk - Bug #9669: Inconsistent SyntaxError in Ruby 2.1 mandatory keyword arguments definition without parentheses.Closed03/25/2014Actions
Has duplicate Ruby trunk - Bug #10288: Parser incompatibility between 2.1.2 and 2.1.3Closed09/24/2014Actions

Associated revisions

Revision 08248c93
Added by nobu (Nobuyoshi Nakada) over 4 years ago

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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 47696
Added by nobu (Nobuyoshi Nakada) over 4 years ago

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]

Revision 47696
Added by nobu (Nobuyoshi Nakada) over 4 years ago

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]

Revision 47696
Added by nobu (Nobuyoshi Nakada) over 4 years ago

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]

Revision 47696
Added by nobu (Nobuyoshi Nakada) over 4 years ago

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]

Revision 47696
Added by nobu (Nobuyoshi Nakada) over 4 years ago

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]

Revision 47696
Added by nobu (Nobuyoshi Nakada) over 4 years ago

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]

Revision b2477430
Added by nagachika (Tomoyuki Chikanaga) over 4 years ago

merge revision(s) r47696,r47697: [Backport #10279]

    * parse.y (parse_ident): just after a label, new expression should
      start, cannot be a modifier.  [ruby-core:65211] [Bug #10279]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@47703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 47703
Added by nagachika (Tomoyuki Chikanaga) over 4 years ago

merge revision(s) r47696,r47697: [Backport #10279]

* parse.y (parse_ident): just after a label, new expression should
  start, cannot be a modifier.  [ruby-core:65211] [Bug #10279]

History

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

  • Backport set to 2.0.0: DONTNEED, 2.1: REQUIRED

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

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

Also available in: Atom PDF