Skip to content

Commit 9f05d96

Browse files
committed
Add backtrace of error statements
That change gives backtrace of errors that should simplify deducing what the error is all about. The following code: ```cpp f: () = { l1 := :() -> int = { i := 42;; return i; }; } ``` Generates error: ``` bug_352_error_message_semicolon.cpp2... bug_352_error_message_semicolon.cpp2(3,13): error: empty statement is not allowed - remove extra semicolon (at ';') bug_352_error_message_semicolon.cpp2(3,13): error: bad statement! (at ';') bug_352_error_message_semicolon.cpp2(2,6): error: bad statement! (at ':') ```
1 parent d41fc77 commit 9f05d96

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
pure2-bounds-safety-pointer-arithmetic-error.cpp2...
22
pure2-bounds-safety-pointer-arithmetic-error.cpp2(15,13): error: 'delete' and owning raw pointers are not supported in Cpp2 - use unique.new<T>, shared.new<T>, or gc.new<T> instead (in that order)
3+
pure2-bounds-safety-pointer-arithmetic-error.cpp2(15,16): error: bad statement! (at 'first')
4+
pure2-bounds-safety-pointer-arithmetic-error.cpp2(9,25): error: bad statement! (at '{')
35

source/parse.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4507,6 +4507,7 @@ class parser
45074507
while (curr().type() != lexeme::RightBrace) {
45084508
auto s = statement(true);
45094509
if (!s) {
4510+
error("bad statement!");
45104511
pos = start_pos; // backtrack
45114512
return {};
45124513
}

0 commit comments

Comments
 (0)