; Opening a missing file delivers io_error.not_found to the err target. ; expect: run ; grant: src=fs.read ; result: 1 ; phase: 2 ; spec: docs/reference/intrinsics.md module test.open_missing air 0 lang 0.1 features [arrays, capabilities, effects, ownership, resources] fn @main(%src: cap) -> u8 effects [fs.read] entry: %p = local.alloc array local.zero %p %p_m = borrow.mut %p %p_i0 = const.usize 0 %p_c0 = const.u8 47 %p_e0 = borrow.index %p_m, %p_i0 store %p_e0, %p_c0 borrow.end %p_e0 %p_i1 = const.usize 1 %p_c1 = const.u8 110 %p_e1 = borrow.index %p_m, %p_i1 store %p_e1, %p_c1 borrow.end %p_e1 %p_i2 = const.usize 2 %p_c2 = const.u8 111 %p_e2 = borrow.index %p_m, %p_i2 store %p_e2, %p_c2 borrow.end %p_e2 %p_i3 = const.usize 3 %p_c3 = const.u8 112 %p_e3 = borrow.index %p_m, %p_i3 store %p_e3, %p_c3 borrow.end %p_e3 %p_i4 = const.usize 4 %p_c4 = const.u8 101 %p_e4 = borrow.index %p_m, %p_i4 store %p_e4, %p_c4 borrow.end %p_e4 borrow.end %p_m %p_r = borrow.ref %p %p_s = slice.make %p_r intrinsic fs.open_read(%src, %p_s), ok -> @opened, err -> @failed opened(%f: file): trap failed(%e: io_error): borrow.end %p_s borrow.end %p_r enum.switch io_error %e, not_found -> @nf, default -> @other() nf: %one = const.u8 1 ret %one other: %two = const.u8 2 ret %two