forked from ziglang/zig
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sema: fail if analyzing return in
noreturn
-declared function before…
… coercing `undefined` Just switches logic around in coerceExtra to check for returning in a noreturn function before coercing undefined to anything
- Loading branch information
1 parent
9fd61f7
commit 7b8fc18
Showing
2 changed files
with
15 additions
and
5 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
10 changes: 10 additions & 0 deletions
10
test/cases/compile_errors/return_undefined_from_noreturn.zig
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,10 @@ | ||
export fn entry() noreturn { | ||
return undefined; | ||
} | ||
|
||
// error | ||
// backend=stage2 | ||
// target=native | ||
// | ||
// :2:12: error: function declared 'noreturn' returns | ||
// :1:19: note: 'noreturn' declared here |