parse.zig: make chained comparison operators a parse error

This commit is contained in:
Matthew Borkowski
2021-12-02 03:50:23 -05:00
committed by Andrew Kelley
parent fb9fcf5632
commit c98b020ce2
4 changed files with 20 additions and 9 deletions
+9 -6
View File
@@ -5033,18 +5033,21 @@ pub fn addCases(ctx: *TestContext) !void {
"tmp.zig:2:5: note: control flow is diverted here",
});
ctx.objErrStage1("unreachable code - multiple things",
ctx.objErrStage1("unreachable code - nested returns",
\\export fn a() i32 {
\\ return return 1;
\\}
\\export fn b(value: u32) bool {
\\ return 1 < value < 1000;
\\}
, &[_][]const u8{
"tmp.zig:2:5: error: unreachable code",
"tmp.zig:2:12: note: control flow is diverted here",
"tmp.zig:5:22: error: unreachable code",
"tmp.zig:5:5: note: control flow is diverted here",
});
ctx.objErrStage1("chained comparison operators",
\\export fn a(value: u32) bool {
\\ return 1 < value < 1000;
\\}
, &[_][]const u8{
"tmp.zig:2:22: error: comparison operators cannot be chained",
});
ctx.objErrStage1("bad import",