Bug #9308

def's return value causes errors

Added by Benjamin Kammerl 4 months ago. Updated about 1 month ago.

[ruby-core:59342]
Status:Closed
Priority:Normal
Assignee:-
Category:core
Target version:next minor
ruby -v:ruby 2.1.0dev (2013-11-23 trunk 43807) [x86_64-linux] Backport:1.9.3: DONE, 2.0.0: DONE, 2.1: DONE

Description

It seems 2.1 hase some trouble with the "do" keyword in combination with the private/public/protected keywords and the def's return value:

Works: https://gist.github.com/phortx/8146341
Works Not: https://gist.github.com/phortx/8146345

$ ruby --version
ruby 2.1.0dev (2013-11-23 trunk 43807) [x86_64-linux]

$ ruby works.rb
$ ruby worksnot.rb
test.rb:5: syntax error, unexpected keyword
doblock, expecting keywordend
test.rb:12: syntax error, unexpected keyword_end, expecting end-of-input


Related issues

Duplicated by ruby-trunk - Bug #9376: Passing do/end block inside decorated method fails, while... Closed 01/07/2014
Duplicated by ruby-trunk - Bug #9416: 'private def' results in syntax errors in the method Closed 01/15/2014

Associated revisions

Revision 44449
Added by Nobuyoshi Nakada 4 months ago

parse.y: save cmdarg_stack in local scope

  • parse.y (localpushgen, localpopgen): save cmdarg_stack to isolate command argument state from outer scope. [Bug #9308]

History

#1 Updated by Nobuyoshi Nakada 4 months ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r44449.
Benjamin, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


parse.y: save cmdarg_stack in local scope

  • parse.y (localpushgen, localpopgen): save cmdarg_stack to isolate command argument state from outer scope. [Bug #9308]

#2 Updated by Nobuyoshi Nakada 3 months ago

  • Priority changed from High to Normal
  • Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN to 1.9.3: DONTNEED, 2.0.0: REQUIRED, 2.1: REQUIRED

I set backport to 2.0 to REQUIRED, because this is an old issue but noone has never been hit.
For source-level compatibility, it's better that 2.0 also accepts this syntax.

1.9? It has died almost.

#3 Updated by Usaku NAKAMURA 3 months ago

  • Backport changed from 1.9.3: DONTNEED, 2.0.0: REQUIRED, 2.1: REQUIRED to 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: REQUIRED

1.9.3 is not dead... yet.

#4 Updated by Nobuyoshi Nakada 3 months ago

  • Duplicated by Bug #9416: 'private def' results in syntax errors in the method added

#5 Updated by Usaku NAKAMURA 3 months ago

  • Backport changed from 1.9.3: REQUIRED, 2.0.0: REQUIRED, 2.1: REQUIRED to 1.9.3: DONE, 2.0.0: REQUIRED, 2.1: REQUIRED

backported to ruby19_3 at r44737.

#6 Updated by Tomoyuki Chikanaga 2 months ago

  • Backport changed from 1.9.3: DONE, 2.0.0: REQUIRED, 2.1: REQUIRED to 1.9.3: DONE, 2.0.0: DONE, 2.1: REQUIRED

r44449 was backported to ruby20_0 branch at 44898.

#7 Updated by Yui NARUSE about 1 month ago

  • Backport changed from 1.9.3: DONE, 2.0.0: DONE, 2.1: REQUIRED to 1.9.3: DONE, 2.0.0: DONE, 2.1: DONE

r45086.

Also available in: Atom PDF