Project

General

Profile

Actions

Bug #11380

closed

Parser regression in 2.3?

Added by matsuda (Akira Matsuda) over 9 years ago. Updated about 9 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-07-21 trunk 51319) [x86_64-darwin14]
[ruby-core:70067]

Description

This code works with 2.2 but causes SyntaxError with 2.3.

def foo(pr, options, &blk)
  p pr.call
end

foo -> { :hello }, a: 1 do end

#=> t.rb:5: syntax error, unexpected keyword_do, expecting end-of-input


Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #11107: Syntax error is raised by "p ->() do a(1) do end end", but not by "p ->() do a 1 do end end"ClosedActions
Has duplicate Ruby master - Bug #11389: Regression in method parameter parsingClosedActions

Updated by yui-knk (Kaneko Yuichiro) over 9 years ago

I found out that this regression is caused by 50402 (https://github.com/ruby/ruby/commit/fd0e9d2580bf757071683581d34354064c6ceb6a)

# prase.rb
def foo(pr, options, &blk)
  p pr.call
end

foo -> { :hello }, a: 1 do end
$  /usr/local/bin/ruby  -v
ruby 2.3.0dev (2015-04-29 trunk 50401) [x86_64-darwin13]

$  /usr/local/bin/ruby  parse.rb
:hello
$  /usr/local/bin/ruby  -v
ruby 2.3.0dev (2015-04-29 trunk 50402) [x86_64-darwin13]

$  /usr/local/bin/ruby  parse.rb
../parse.rb:5: syntax error, unexpected keyword_do, expecting end-of-input
foo -> { :hello }, a: 1 do end
Actions #2

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Related to Bug #11107: Syntax error is raised by "p ->() do a(1) do end end", but not by "p ->() do a 1 do end end" added
Actions #3

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Has duplicate Bug #11389: Regression in method parameter parsing added

Updated by felixbuenemann (Felix Bünemann) over 9 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: UNKNOWN, 2.1: REQUIRED, 2.2: REQUIRED
Actions #5

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Status changed from Open to Closed

Applied in changeset r51350.


parse.y: pop cmdarg

Updated by felixbuenemann (Felix Bünemann) over 9 years ago

This still needs to be backported.

Updated by nagachika (Tomoyuki Chikanaga) about 9 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: UNKNOWN, 2.1: REQUIRED, 2.2: DONE

Backported into ruby_2_2 branch at r51519.

Actions #8

Updated by felixbuenemann (Felix Bünemann) about 9 years ago

Thank you!

Please don't forget to also backport to ruby_2_1, because #11107 which caused this regression was backported to ruby_2_1 aswell.

Actions #9

Updated by usa (Usaku NAKAMURA) about 9 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: REQUIRED, 2.2: DONE to 2.0.0: UNKNOWN, 2.1: DONE, 2.2: DONE

ruby_2_1 r51605 merged revision(s) 51350.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0