Project

General

Profile

Bug #14627

class_eval "def foo(N:)\n end" regression

Added by ViugiNick (Nickolay Viuginov) 11 months ago. Updated 11 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:<unknown>]

Description

Ruby crashes with a segfault in case of class_eval defining method with a keyword starts with a capital letter. It seems like it's a regression of one of the latest versions.


Files

Screenshot from 2018-03-21 18-15-09.png (133 KB) Screenshot from 2018-03-21 18-15-09.png ViugiNick (Nickolay Viuginov), 03/23/2018 04:57 PM

Related issues

Is duplicate of Ruby trunk - Bug #14261: invalid syntax segfaults: "x, true"ClosedActions

History

#1

Updated by ViugiNick (Nickolay Viuginov) 11 months ago

  • ruby -v set to 2.5.0

Updated by nobu (Nobuyoshi Nakada) 11 months ago

I can't reproduce it.

$ ruby -v -e 'Class.new.class_eval "def foo(N:)\n end"'
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux-gnu]
Traceback (most recent call last):
    1: from -e:1:in `<main>'
-e:1:in `class_eval': (eval):1: formal argument cannot be a constant (SyntaxError)
def foo(N:)
        ^~
(eval):1: dynamic constant assignment
def foo(N:)
          ^

Could you post simple code to reproduce and full message, in text format?

#3

Updated by nobu (Nobuyoshi Nakada) 11 months ago

  • Status changed from Open to Feedback

Updated by mame (Yusuke Endoh) 11 months ago

I could repro:

$ ruby -e 'Class.new.class_eval "def f(a:, N:)\nend"'
-e:1: [BUG] Segmentation fault at 0x0000000000000028
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]

*snip*

This [BUG] does not occur on trunk, so maybe it has been already fixed.

Updated by mrkn (Kenta Murata) 11 months ago

I cannot reproduce it on the HEAD of ruby_2_5:

$ ruby -ve 'Class.new.class_eval "def foo(a:, N:)\nend"'
ruby 2.5.1p53 (2018-03-25 revision 62911) [x86_64-darwin16]
Traceback (most recent call last):
    1: from -e:1:in `<main>'
-e:1:in `class_eval': (eval):1: formal argument cannot be a constant (SyntaxError)
def foo(a:, N:)
            ^~
(eval):1: dynamic constant assignment
def foo(a:, N:)
              ^
#6

Updated by nobu (Nobuyoshi Nakada) 11 months ago

  • Is duplicate of Bug #14261: invalid syntax segfaults: "x, true" added
#7

Updated by nobu (Nobuyoshi Nakada) 11 months ago

  • Status changed from Feedback to Closed
#8

Updated by naruse (Yui NARUSE) 11 months ago

  • Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN to 2.3: DONTNEED, 2.4: DONTNEED, 2.5: DONTNEED

Also available in: Atom PDF