flan/test/programs/vec-new-shadow.flan

15 lines
419 B
Plaintext

;;;; A program's own vec-new is an ordinary function: a bracket passed to it
;;;; is an array value, not an element type. builtin/vec-new is still the
;;;; builtin and still reads one as a type.
(defn vec-new [xs [1 i32]] i32 (at xs 0))
(defn main [] i32
(let [x 7
v (builtin/vec-new [const u8])]
(println (vec-new [x]))
(push v (bytes-view "ab"))
(println (length (at v 0)))
(free v))
0)