flan/test/programs/dyn-slot-trap.flan

22 lines
802 B
Plaintext

;;;; The refusals of a typed class slot, one per run because each ends the
;;;; process. The argument chooses which. The line numbers are asserted by
;;;; the test, so an edit above them moves them.
(defclass state [pause bool step i32 tag])
(defclass node [owner state])
(defn as-dyn [d dyn] dyn d)
(defn main [args [string]] i32
(let [which (if (> (length args) 1) (i32 (bytes->i64 (bytes-view (at args 1)))) 0)
s (state false 3 nil)]
(println "before")
(cond
(= which 0) (println (state 1 2 3))
(= which 1) (put s :pause 1)
(= which 2) (set (get s :step) 5000000000)
(= which 3) (set (get s :paws) true)
(= which 4) (set (get (as-dyn {:pause 1}) :pause) true)
(= which 5) (println (node (node s)))
:else (println (state nil 1 2))))
0)