(define impc:ti:array-ref-ptr-check
(lambda (ast vars kts request?)
(if (<> (length ast) 3)
(impc:compiler:print-bad-arity-error ast))
(let ((a (impc:ti:type-check (cadr ast) vars kts '())) ;request?))
;; b should be fixed point
(b (impc:ti:type-check (caddr ast) vars kts (list *impc:ir:si64* *impc:ir:si32*))))
(if (impc:ir:type? a) (set! a (list a)))
(if (null? a)
a
(if (or (not (impc:ir:array? (car a)))
(> (impc:ir:get-ptr-depth (car a)) 1))
(impc:compiler:print-bad-type-error (impc:ir:get-type-str (car a)))
(list (impc:ir:pointer++ (caddr (car a)))))))))