(module raw_buf_adt_field_bare (data Box (ctor Box (con RawBuf (con Int)))) (fn slot1 (doc "Reads a RawBuf stored in a user ADT field through a borrow. The Box field is typed with the bare kernel name `(con RawBuf (con Int))`; the kernel-tier auto-import must resolve it to raw_buf.RawBuf exactly as it does in op/value positions.") (type (fn-type (params (borrow (con Box))) (ret (own (con Int))))) (params bx) (body (match bx (case (pat-ctor Box buf) (app RawBuf.get buf 1))))) (fn main (type (fn-type (params) (ret (own (con Unit))) (effects IO))) (params) (body (let buf (new RawBuf (con Int) 3) (let buf (app RawBuf.set buf 1 42) (let bx (term-ctor Box Box buf) (app print (app slot1 bx))))))))