-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Exit function Introduce the `exit` function as a means of terminating the program early. This also requires the introduction of the `@noreturn` decorator to indicate that code following the invocation of such a function is not reachable. * Emit 'hlt' instruction when invoking a Never function * Ensure match expression blocks that contain noreturn function calls don't do a 'store'
- Loading branch information
Showing
5 changed files
with
44 additions
and
32 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,2 @@ | ||
func ok(): Result<Int, String> = Ok(123) | ||
func err(): Result<Int, String> = Err("foo") | ||
|
||
func f1(): Result<Int, Int> { | ||
var acc = 0 | ||
while acc < 10 { | ||
val x = try err() else break | ||
println(x) | ||
acc += x | ||
} | ||
|
||
Ok(acc) | ||
} | ||
|
||
/// Expect: Result.Ok(value: 124) | ||
println(f1()) | ||
val x = if true 123 else Process.exit() | ||
println("x =", x) |
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
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