Skip to content

Trailing bare identifier not flagged as a parse error in SUP #7120

Description

@philrz

When given these bad inputs without a trailing newline, it's expected super would treat each as a parse error, but it doesn't.

$ echo -n 'xyz' | super -i sup -
[no output]

$ echo -n '1xyz' | super -i sup -
1

$ echo -n '{a:1} garbage' | super -i sup -
{a:1}

$ echo -n '1 2 xyz' | super -i sup -
1
2

Details

Repro is with super commit f97e198.

If I drop the -n so echo will include a trailing newline, now I get the expected parse errors for each.

$ super -version
Version: v0.3.0-255-gf97e1982a

$ echo 'xyz' | super -i sup -
stdio:stdin: line 1: syntax error

$ echo '1xyz' | super -i sup -
stdio:stdin: line 1: syntax error

$ echo '{a:1} garbage' | super -i sup -
stdio:stdin: line 1: syntax error

$ echo '1 2 xyz' | super -i sup -
stdio:stdin: line 1: syntax error

It's likely we've not noticed this problem until now because trailing newlines can often be taken for granted on text inputs, and I assume that's satisfying the parser somehow so it notices the end of the input is bad. However, I originally spotted this problem via #6367 where I mistakenly thought it was a Playground-specific problem. But then Claude narrowed down that it was SUP-related as shown above, but Playground is more prone to bumping into it because the contents of its INPUT panel apparently have no trailing newline when presented to the query engine. As a result, if you have garbage in the middle of a set of multiple lines of input, the parse error shows up in the RESULT panel just fine:

Image

But if you use one of the bad inputs shown above, you can get bad/empty output in the RESULT panel.

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions