(module own_return_provenance_ctor

  (data Box
    (doc "Heap cell holding one Int.")
    (ctor Box (con Int)))

  (data Wrap
    (doc "Wraps a Box.")
    (ctor Wrap (con Box)))

  (fn escape
    (doc "Already rejected today (consume-while-borrowed, regime A): a borrowed Box escapes into a returned constructor.")
    (type
      (fn-type
        (params (borrow (con Box)))
        (ret (own (con Wrap)))))
    (params b)
    (body (term-ctor Wrap Wrap b))))
