(define impc:ti:numeric-check
(lambda (ast vars kts request?)
;; (println 'numeric-check 'ast: ast (integer? ast) 'request? request?)
(if *impc:ti:print-sub-checks* (println 'num:> 'ast: ast 'request? request?))
(if (and request?
(not (null? request?)))
(cond ((symbol? request?)
(let* ((t1 (impc:ti:symbol-check request? vars kts #f))
(t2 (impc:ti:numeric-check ast vars kts #f))
(t3 (cl:intersection t1 t2)))
(if (null? t1) t2 t3)))
((list? request?)
(let* ((t1 (impc:ti:numeric-check ast vars kts #f))
(t2 (cl:intersection request? t1)))
t2))
((number? request?)
(let* ((t1 (impc:ti:numeric-check ast vars kts #f))
(t2 (cl:intersection (list request?) t1)))
t2))
((string? request?)
(let* ((t1 (impc:ti:numeric-check ast vars kts #f))
(t2 (cl:intersection (list request?) t1)))
t2))
(else
(print-with-colors 'red 'default #t (print "Compiler Error:"))
(print "shouldn't reach here in numeric check il- request?: ")
(print-with-colors 'blue 'default #f (print request?))
(print "\nYou might be using a ")
(print-with-colors 'blue 'default #t (print "pref"))
(print " where you should be using a ")
(print-with-colors 'blue 'default #t (print "tref"))
(println)
(throw "")))
(if (integer? ast) ;; preference goes to start of list
(if (or (= 1 ast) (= 0 ast))
(list *impc:ir:si64* *impc:ir:si32* *impc:ir:si16* *impc:ir:ui8* *impc:ir:i1*)
(if (< ast 256)
(list *impc:ir:si64* *impc:ir:si32* *impc:ir:si16* *impc:ir:ui8*)
(list *impc:ir:si64* *impc:ir:si32* *impc:ir:si16*))) ;*impc:ir:fp64* *impc:ir:fp32*))
(list *impc:ir:fp64* *impc:ir:fp32*)))))