Project

General

Profile

Actions

Bug #14023

closed

SyntaxError on array argument and block

Added by k0kubun (Takashi Kokubun) over 6 years ago. Updated over 6 years ago.

Status:
Rejected
Target version:
ruby -v:
ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-darwin16]
[ruby-core:83334]

Description

$ RBENV_VERSION=2.4.2 ruby -v
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16]

$ RBENV_VERSION=2.4.2 ruby -c -e 'a [] {}'
Syntax OK

$ RBENV_VERSION=2.5.0-preview1 ruby -v
ruby 2.5.0preview1 (2017-10-10 trunk 60153) [x86_64-darwin16]

$ RBENV_VERSION=2.5.0-preview1 ruby -c -e 'a [] {}'
-e:1: syntax error, unexpected '{', expecting end-of-input
a [] {}
     ^

Is this intentional? This causes syntax error on https://github.com/plataformatec/devise/blob/v4.2.0/app/controllers/devise/sessions_controller.rb#L5.


Related issues 4 (0 open4 closed)

Related to Ruby master - Bug #13547: [].delete 1 { 'NG' }ClosedActions
Related to Ruby master - Bug #13691: Word- and symbol array literals not valid where regular array isRejectedActions
Is duplicate of Ruby master - Bug #505: 1.upto 2 {|i| p i }Closedmatz (Yukihiro Matsumoto)08/27/2008Actions
Has duplicate Ruby master - Bug #14433: Error with Trailblazer Wrap using ruby 2.5.0Third Party's IssueActions
Actions #1

Updated by wanabe (_ wanabe) over 6 years ago

  • Related to Bug #13547: [].delete 1 { 'NG' } added
Actions #2

Updated by wanabe (_ wanabe) over 6 years ago

  • Related to Bug #13691: Word- and symbol array literals not valid where regular array is added

Updated by naruse (Yui NARUSE) over 6 years ago

  • Status changed from Open to Assigned
  • Assignee set to nobu (Nobuyoshi Nakada)

This seems regression caused by Bug #13547

% RBENV_VERSION=2.3.5 ruby -c -e 'a [] {}'
Syntax OK
% RBENV_VERSION=2.3.5 ruby -c -e '1.upto 2 {|i|p i}'
-e:1: syntax error, unexpected '{', expecting end-of-input
1.upto 2 {|i|p i}
          ^

%  RBENV_VERSION=2.4.1 ruby -c -e 'a [] {}'
Syntax OK
%  RBENV_VERSION=2.4.1 ruby -c -e '1.upto 2 {|i|p i}'
Syntax OK

% ~/local/ruby/bin/ruby -c -e 'a [] {}'
-e:1: syntax error, unexpected '{', expecting end-of-input
a [] {}
     ^
% ~/local/ruby/bin/ruby -c -e '1.upto 2 {|i|p i}'
-e:1: syntax error, unexpected '{', expecting end-of-input
1.upto 2 {|i|p i}
         ^
Actions #4

Updated by naruse (Yui NARUSE) over 6 years ago

  • Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN to 2.3: DONTNEED, 2.4: REQUIRED
Actions #5

Updated by shyouhei (Shyouhei Urabe) over 6 years ago

  • Is duplicate of Bug #505: 1.upto 2 {|i| p i } added

Updated by shyouhei (Shyouhei Urabe) over 6 years ago

https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/19197

Matz's intention is very clear that this kind of expression shall render syntax errors.

Actions #7

Updated by naruse (Yui NARUSE) over 6 years ago

  • Status changed from Assigned to Rejected
Actions #8

Updated by k0kubun (Takashi Kokubun) about 6 years ago

  • Has duplicate Bug #14433: Error with Trailblazer Wrap using ruby 2.5.0 added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0