(define impc:ir:get-generic-tuple-typevars
(lambda (t)
(if (impc:ti:namedtype-exists? (impc:ir:get-base-type t))
(if (string-contains? t "_poly_")
(let* ((base (impc:ir:get-base-type t))
(ptrs (impc:ir:get-ptr-depth t))
(p (regex:split base "_poly_"))
(name (substring (car p) 1 (string-length (car p))))
(l1 (cl:remove-duplicates (regex:match-all
(symbol->string (impc:ti:get-generictype-candidate-types name))
"![A-Za-z_0-9]*")))
;; (l1 (cl:remove-duplicates
;; (cl:remove-if (lambda (x)
;; (and (not (regex:match? x "^!")) ;; typevar
;; (not (and (regex:match? x "^[A-Za-z]") ;; or generic type
;; (impc:ti:generictype-exists?
;; (car (regex:type-split x ":")))))
;; (not (and (regex:match? x "^\\[")
;; (regex:match? x "!")))))
;; (impc:ir:get-pretty-tuple-arg-strings
;; (symbol->string (impc:ti:get-generictype-candidate-types name))))))
(l2 (impc:ir:get-pretty-tuple-arg-strings (cname-decode (cadr p))))
;; (llllll (println 'l1 l1 'l2 l2))
(typevars (cl:remove-duplicates (map (lambda (x y) (cons x y)) l1 l2))))
typevars)
#f)
#f)))