Project

General

Profile

Actions

Bug #14627

closed

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

Added by ViugiNick (Nickolay Viuginov) almost 7 years ago. Updated over 6 years ago.

Status:
Closed
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 1 (0 open1 closed)

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

Updated by ViugiNick (Nickolay Viuginov) almost 7 years ago

  • ruby -v set to 2.5.0

Updated by nobu (Nobuyoshi Nakada) over 6 years 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?

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Status changed from Open to Feedback

Updated by mame (Yusuke Endoh) over 6 years 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) over 6 years 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:)
              ^
Actions #6

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

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

Updated by nobu (Nobuyoshi Nakada) over 6 years ago

  • Status changed from Feedback to Closed
Actions #8

Updated by naruse (Yui NARUSE) over 6 years ago

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

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0