94 lines
2.8 KiB
Plaintext
94 lines
2.8 KiB
Plaintext
program main
|
|
fn i32_ok() -> (result i32 i32)
|
|
ok : (result i32 i32)
|
|
int 42 : i32
|
|
fn i32_err() -> (result i32 i32)
|
|
err : (result i32 i32)
|
|
int 7 : i32
|
|
fn text_ok() -> (result string i32)
|
|
ok : (result string i32)
|
|
string "value" : string
|
|
fn text_err() -> (result string i32)
|
|
err : (result string i32)
|
|
int 9 : i32
|
|
fn observe_i32_ok() -> bool
|
|
std.result.is_ok : bool
|
|
call i32_ok : (result i32 i32)
|
|
fn observe_i32_err() -> bool
|
|
std.result.is_err : bool
|
|
call i32_err : (result i32 i32)
|
|
fn unwrap_i32_ok() -> i32
|
|
std.result.unwrap_ok : i32
|
|
call i32_ok : (result i32 i32)
|
|
fn unwrap_i32_err() -> i32
|
|
std.result.unwrap_err : i32
|
|
call i32_err : (result i32 i32)
|
|
fn observe_text_ok() -> bool
|
|
std.result.is_ok : bool
|
|
call text_ok : (result string i32)
|
|
fn observe_text_err() -> bool
|
|
std.result.is_err : bool
|
|
call text_err : (result string i32)
|
|
fn unwrap_text_ok() -> string
|
|
std.result.unwrap_ok : string
|
|
call text_ok : (result string i32)
|
|
fn unwrap_text_err() -> i32
|
|
std.result.unwrap_err : i32
|
|
call text_err : (result string i32)
|
|
fn legacy_i32_ok() -> bool
|
|
is_ok : bool
|
|
call i32_ok : (result i32 i32)
|
|
fn legacy_text_err() -> i32
|
|
unwrap_err : i32
|
|
call text_err : (result string i32)
|
|
fn main() -> i32
|
|
if : i32
|
|
std.result.is_ok : bool
|
|
call i32_ok : (result i32 i32)
|
|
std.result.unwrap_ok : i32
|
|
call i32_ok : (result i32 i32)
|
|
std.result.unwrap_err : i32
|
|
call i32_err : (result i32 i32)
|
|
test "std result i32 observers"
|
|
if : bool
|
|
std.result.is_ok : bool
|
|
call i32_ok : (result i32 i32)
|
|
std.result.is_err : bool
|
|
call i32_err : (result i32 i32)
|
|
bool false : bool
|
|
test "std result i32 unwraps"
|
|
binary = : bool
|
|
binary + : i32
|
|
std.result.unwrap_ok : i32
|
|
call i32_ok : (result i32 i32)
|
|
std.result.unwrap_err : i32
|
|
call i32_err : (result i32 i32)
|
|
int 49 : i32
|
|
test "std result string observers"
|
|
if : bool
|
|
std.result.is_ok : bool
|
|
call text_ok : (result string i32)
|
|
std.result.is_err : bool
|
|
call text_err : (result string i32)
|
|
bool false : bool
|
|
test "std result string unwraps"
|
|
if : bool
|
|
binary = : bool
|
|
std.result.unwrap_ok : string
|
|
call text_ok : (result string i32)
|
|
string "value" : string
|
|
binary = : bool
|
|
std.result.unwrap_err : i32
|
|
call text_err : (result string i32)
|
|
int 9 : i32
|
|
bool false : bool
|
|
test "legacy result helpers still work"
|
|
if : bool
|
|
is_ok : bool
|
|
call i32_ok : (result i32 i32)
|
|
binary = : bool
|
|
unwrap_err : i32
|
|
call text_err : (result string i32)
|
|
int 9 : i32
|
|
bool false : bool
|