(define impc:ir:str-list-check
(lambda (type)
;; (println 'ir:str-list-check type)
(cond ((string? type)
(if (impc:ti:namedtype-exists? (impc:ir:get-base-type type))
type
(impc:ir:str-list-check (impc:ir:get-type-from-str type))))
((symbol? type)
(set! type (symbol->string type))
(if (impc:ti:namedtype-exists? (impc:ir:get-base-type type))
type
(if (and (char=? (string-ref type 0) #\!))
type
;; (impc:ir:str-list-check (impc:ir:get-type-from-str type)))
(if (assoc-strcmp type *impc:ti:generic-type-mappings*)
(cdr (assoc-strcmp type *impc:ti:generic-type-mappings*))
type))))
((list? type) ; complex type
(cond ((impc:ir:closure? (car type)) (car type))
((impc:ir:tuple? (car type)) (car type))
((impc:ir:array? (car type)) (car type))
((impc:ir:vector? (car type)) (car type))
(else *impc:ir:badtype*)))
(else type))))