diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-06-25 19:43:01 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-07-02 13:26:50 -0700 |
| commit | cffa22a658d23bdedbdd7e23853b80d856e43627 (patch) | |
| tree | f528655756630f403bba344d76a9ae634424d7d6 /test/compile_errors.zig | |
| parent | 527c55aa5671381a7e6652fba237279453e0bb6e (diff) | |
| download | zig-cffa22a658d23bdedbdd7e23853b80d856e43627.tar.gz zig-cffa22a658d23bdedbdd7e23853b80d856e43627.zip | |
AstGen: implement compile error for useless locals
When a local variable has an initialization expression of type
'noreturn', emit a compile error. This brings this branch closer
to parity with master branch.
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 3be754377b..0c04f70a86 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -4831,7 +4831,8 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ const a = return; \\} , &[_][]const u8{ - "tmp.zig:2:5: error: unreachable code", + "tmp.zig:2:5: error: useless local constant", + "tmp.zig:2:15: note: control flow is diverted here", }); cases.add("unreachable variable", |
