(define impc:ti:pointer-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 (and (not (null? a))
(< (impc:ir:get-ptr-depth (car a)) 1))
(impc:compiler:print-bad-type-error (impc:ir:pretty-print-type (car a))
"Cannot de-reference non-pointer type"))
(if (null? a)
a
(list (car a))))))