(module raw_buf_adt_field_qualified
  (data Box (ctor Box (con raw_buf.RawBuf (con Int))))
  (fn slot1
    (doc "Control twin of raw_buf_adt_field_bare: identical module but the Box field is typed with the fully-qualified `(con raw_buf.RawBuf (con Int))`. This checks clean today, isolating the bug to bare-name resolution in the type-constructor position.")
    (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))))))))
