mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
parse.zig: make chained comparison operators a parse error
This commit is contained in:
committed by
Andrew Kelley
parent
fb9fcf5632
commit
c98b020ce2
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user