Skip to content

[QoI] Improve cryptic error message due to accidental semicolon #352

Closed
@JohelEGP

Description

@JohelEGP

The source locations are nowhere near the semicolon. The implementation should know when a semicolon is not needed, so the error message can be more to the point.

Minimal reproducer (https://godbolt.org/z/5Eovbx4Yb):

g: () = { }
f: () = {
  for v* | all next log() do :(e) = {
    foo();
    bar*;
  };
  g();
}

Commands:

cppfront x.cpp2

Expected result: A diagnostic indicating to remove accidental semicolon.

Actual result and error:

x.cpp2(2,9): error: ill-formed initializer (at '{')
x.cpp2(2,1): error: unexpected text at end of Cpp2 code section (at 'f')
x.cpp2(1,0): error: parse failed for section starting here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions