; cap.narrow.prefix to /etc under scope /data. ; expect: run ; grant: fs=fs.read:/data ; result: 2 ; phase: 2 ; spec: docs/spec/05-effects-and-capabilities.md module test.narrow_not_subset air 0 lang 0.1 features [arrays, capabilities, effects, ownership, resources] fn @main(%fs: cap) -> u8 effects [] 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 101 %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 116 %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 99 %p_e3 = borrow.index %p_m, %p_i3 store %p_e3, %p_c3 borrow.end %p_e3 borrow.end %p_m %p_r = borrow.ref %p %p_s = slice.make %p_r cap.narrow.prefix %fs, %p_s, ok -> @ok, err -> @err ok(%n: cap): borrow.end %p_s borrow.end %p_r %zero = const.u8 0 ret %zero err(%e: cap_error): borrow.end %p_s borrow.end %p_r enum.switch cap_error %e, invalid_restriction -> @inv, not_subset -> @ns, unsupported_restriction -> @uns inv: %one = const.u8 1 ret %one ns: %two = const.u8 2 ret %two uns: %three = const.u8 3 ret %three