(module raw_buf_new_poly_elem
  (data Box (vars a) (param-in (a Int Float)) (ctor B (con RawBuf a)))
  (fn mk
    (doc "RED-pin fixture for the series-step-1 enabling fix (#61 base-tier). `mk` allocates a `(new RawBuf n)` with NO explicit element type-arg: the buffer's element var is solved at check-time PURELY from the expected ctor-field type `(con RawBuf a)`, never from a value argument (mk takes only the size). Under monomorphisation the buffer must specialise to the CALLER's concrete element type. Today `ail check` passes (the element var `a` unifies cleanly via the ctor-field context) but `ail build --alloc=rc` aborts: mono drops the check-time solution for `a`, defaults it to Unit, and mints `RawBuf_new__Unit`, which has no registered intercept (crates/ailang-codegen/src/intercepts.rs registers only Int/Float/Bool). Diagnosis pointer (NOT the test's concern): the check phase solves `a`; mono must propagate that solution to Term::New lowering (crates/ailang-check/src/lower_to_mir.rs:501, `elem: None`) instead of defaulting to Unit. Precedent is the #51 explicit-`(con Int)`-type-arg fix; the variable-via-expected-type case is the untouched gap. Expected post-fix: the buffer specialises to the caller's element type (Float here), build succeeds, the program prints the stored Float `1.0`.")
    (type (forall (vars a) (fn-type (params (own (con Int))) (ret (own (con Box a))))))
    (params n)
    (body (let buf (new RawBuf n) (term-ctor Box B buf))))
  (fn store
    (type (forall (vars a) (fn-type (params (own (con Box a)) (own a)) (ret (own (con Box a))))))
    (params b v)
    (body (match b (case (pat-ctor B buf) (term-ctor Box B (app RawBuf.set buf 0 v))))))
  (fn first
    (type (forall (vars a) (fn-type (params (borrow (con Box a))) (ret (own a)))))
    (params b)
    (body (match b (case (pat-ctor B buf) (app RawBuf.get buf 0)))))
  (fn main
    (type (fn-type (params) (ret (own (con Unit))) (effects IO)))
    (params)
    (body (let b (app store (app mk 1) 1.0) (app print (app first b))))))
