Project

General

Profile

Bug #13012

irb fails to define a method with a reserved-word-ish keyword argument

Added by matsuda (Akira Matsuda) 9 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.0dev (2016-12-07 trunk 57012) [x86_64-darwin14]
[ruby-core:78526]

Description

For example

def a(if:) end

is a valid ruby code but this doesn't work on irb.

This seems to be happening for all keywords that are listed in RubyLex::ENINDENT_CLAUSE


Related issues

Related to Ruby trunk - Bug #9975: irb で Hash を 1.9 記法で記述したときに、キーがキーワードだと syntax errorClosed
Is duplicate of Ruby trunk - Bug #12177: Using `if:` as symbol in hash with new hash syntax in irb console is not workingClosed

Associated revisions

Revision 57027
Added by nobu (Nobuyoshi Nakada) 9 months ago

ruby-lex.rb: fix for label

  • lib/irb/ruby-lex.rb (identify_identifier): treat identifier just followed by a colon as a lable. this is not a precise solution but enough for the time being. [Bug #13012]

Revision 57027
Added by nobu (Nobuyoshi Nakada) 9 months ago

ruby-lex.rb: fix for label

  • lib/irb/ruby-lex.rb (identify_identifier): treat identifier just followed by a colon as a lable. this is not a precise solution but enough for the time being. [Bug #13012]

Revision 58086
Added by usa (Usaku NAKAMURA) 5 months ago

merge revision(s) 57027: [Backport #13012]

ruby-lex.rb: fix for label

* lib/irb/ruby-lex.rb (identify_identifier): treat identifier just
  followed by a colon as a lable.  this is not a precise solution
  but enough for the time being.   [Bug #13012]

Revision 58170
Added by nagachika (Tomoyuki Chikanaga) 5 months ago

merge revision(s) 57027: [Backport #13012]

ruby-lex.rb: fix for label

* lib/irb/ruby-lex.rb (identify_identifier): treat identifier just
  followed by a colon as a lable.  this is not a precise solution
  but enough for the time being.   [Bug #13012]

History

#1 Updated by nobu (Nobuyoshi Nakada) 9 months ago

  • Status changed from Open to Closed

Applied in changeset r57027.


ruby-lex.rb: fix for label

  • lib/irb/ruby-lex.rb (identify_identifier): treat identifier just followed by a colon as a lable. this is not a precise solution but enough for the time being. [Bug #13012]

#2 Updated by nobu (Nobuyoshi Nakada) 7 months ago

  • Is duplicate of Bug #12177: Using `if:` as symbol in hash with new hash syntax in irb console is not working added

#3 [ruby-core:79805] Updated by hsbt (Hiroshi SHIBATA) 6 months ago

  • Backport changed from 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.2: REQUIRED, 2.3: REQUIRED, 2.4: DONTNEED

#4 Updated by hsbt (Hiroshi SHIBATA) 6 months ago

  • Related to Bug #9975: irb で Hash を 1.9 記法で記述したときに、キーがキーワードだと syntax error added

#5 [ruby-core:80321] Updated by usa (Usaku NAKAMURA) 5 months ago

  • Backport changed from 2.2: REQUIRED, 2.3: REQUIRED, 2.4: DONTNEED to 2.2: DONE, 2.3: REQUIRED, 2.4: DONTNEED

ruby_2_2 r58086 merged revision(s) 57027.

#6 [ruby-core:80397] Updated by nagachika (Tomoyuki Chikanaga) 5 months ago

  • Backport changed from 2.2: DONE, 2.3: REQUIRED, 2.4: DONTNEED to 2.2: DONE, 2.3: DONE, 2.4: DONTNEED

ruby_2_3 r58170 merged revision(s) 57027.

Also available in: Atom PDF