-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't crash for invalid toplevel parseStmt/Expr calls (#23089)
This code will crash `check`/`nimsuggest` since the `ra` register is uninitialised ```nim import macros static: discard parseExpr("'") ``` Now it assigns an empty node so that it has something Testament changes were so I could properly write a test. It would pass even with a segfault since it could find the error (cherry picked from commit db9d800)
- Loading branch information
1 parent
49cc3c5
commit 8efdc31
Showing
3 changed files
with
27 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
discard """ | ||
action: "reject" | ||
cmd: "nim check $file" | ||
errormsg: "expected expression, but got multiple statements [ValueError]" | ||
file: "macros.nim" | ||
""" | ||
|
||
import macros | ||
static: | ||
discard parseStmt("'") | ||
discard parseExpr("'") | ||
discard parseExpr(""" | ||
proc foo() | ||
proc foo() = discard | ||
""") |