Backport #7942

keyword arguments must use with paren?

Added by jy j about 1 year ago. Updated about 1 year ago.

[ruby-core:52820]
Status:Closed
Priority:Normal
Assignee:Tomoyuki Chikanaga

Description

def hello name: "ruby2"
puts "hello #{name}"
end

syntax error, unexpected ':', expecting ';' or '\n'

def hello(name: "ruby2")
puts "hello #{name}"
end

work well

Associated revisions

Revision 39708
Added by Tomoyuki Chikanaga about 1 year ago

merge revision(s) 39504: [Backport #7942]

* parse.y (IS_LABEL_POSSIBLE): allow labels for keyword arguments just
  after method definition without a parenthesis.  
  [Bug #7942]

History

#1 Updated by Koichi Sasada about 1 year ago

  • Tracker changed from Backport to Feature
  • Project changed from Backport200 to ruby-trunk
  • Assignee set to Nobuyoshi Nakada

Backport from where?

Order is:
(1) Modify trunk
(2) Backport to 2.0.0

BTW, I +1 for this proposal.

#2 Updated by Marc-Andre Lafortune about 1 year ago

  • Tracker changed from Feature to Bug

Moving to bug.

def foo x, opt:42; end # => ok
def foo    opt:42; end # => syntax error, should be ok
def foo(   opt:42); end # => ok

#3 Updated by Koichi Sasada about 1 year ago

  • Category set to core
  • Target version set to 2.1.0
  • ruby -v set to -v

#4 Updated by Nobuyoshi Nakada about 1 year ago

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

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


parse.y: keyword argument without paren

  • parse.y (ISLABELPOSSIBLE): allow labels for keyword arguments just after method definition without a parenthesis. [Bug #7942]

#5 Updated by Nobuyoshi Nakada about 1 year ago

  • Tracker changed from Bug to Backport
  • Project changed from ruby-trunk to Backport200
  • Category deleted (core)
  • Status changed from Closed to Assigned
  • Assignee changed from Nobuyoshi Nakada to Tomoyuki Chikanaga
  • Target version deleted (2.1.0)

#6 Updated by Nobuyoshi Nakada about 1 year ago

  • Subject changed from keyword arguments must use with quot? to keyword arguments must use with paren?

#7 Updated by Tomoyuki Chikanaga about 1 year ago

  • Status changed from Assigned to Closed

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


merge revision(s) 39504: [Backport #7942]

* parse.y (IS_LABEL_POSSIBLE): allow labels for keyword arguments just
  after method definition without a parenthesis.  
  [Bug #7942]

Also available in: Atom PDF