//ww:run-exit 10 // Migrated from 700_e2e row 97. package main; import os; fn main() i32 = { let buf: [3]u8; buf[0] = 88: u8; let ok: (i64 | os.oserror) = os.trywrite(1, buf.ptr, 1u64); let bad: (i64 | os.oserror) = os.trywrite(999: i32, buf.ptr, 1u64); let acc: i32 = 0; match (ok) { case let n: i64 => acc += n: i32; case let e: os.oserror => acc += -100; }; match (bad) { case let n: i64 => acc += -100; case let e: os.oserror => acc += (- (e: i64)): i32; }; return acc; };