Project

General

Profile

Actions

Bug #20918

open

Prism error indicates line number of `-e` that does not exist

Added by mame (Yusuke Endoh) 6 days ago. Updated 1 day ago.

Status:
Assigned
Assignee:
Target version:
-
[ruby-core:120035]

Description

$ ruby -e 'foo('
-e: -e:2: syntax error found (SyntaxError)
  1 | foo(
> 2 |
    | ^ unexpected end-of-input; expected a `)` to close the arguments

It says -e:2, but there is no line 2 in -e 'foo('.

eval("foo(") reports line 1, so I guess this issue is only for -e.

Updated by ydah (Yudai Takada) 3 days ago · Edited

It seems that the foo { has the same problem.

❯ ruby -e 'foo {'
-e: -e:2: syntax errors found (SyntaxError)
> 1 | foo {
    | ^ expected a block beginning with `{` to end with `}`
> 2 |
    | ^ unexpected end-of-input, assuming it is closing the parent top level context

Since the error is not confirmed until EOL, it looks like you are outputting the position where the error is confirmed.

❯ ruby -e "foo(

"
-e: -e:4: syntax error found (SyntaxError)
  2 |
  3 |
> 4 |
    | ^ unexpected end-of-input; expected a `)` to close the arguments
Actions #2

Updated by hsbt (Hiroshi SHIBATA) 1 day ago

  • Status changed from Open to Assigned
Actions

Also available in: Atom PDF

Like0
Like0Like0