impc:ti:nativef-poly-exact-check   scheme

Defined in:


(define impc:ti:nativef-poly-exact-check
  (lambda (ast vars kts request?)
    ;; (println 'nateivef-poly-exact: ast 'req: request?)
    (if (or (null? request?)
            (regex:match? (sexpr->string request?) "(!|(##))"))  ;; must be generic - exit!
        (let* ((polyf (string->symbol (car (regex:split (symbol->string (car ast)) "##")))) ;"\\$\\$\\$"))))
               (ftypes (impc:ti:get-polyfunc-candidate-types (symbol->string polyf)))
               (asttype (cons 213 (cons request? (map (lambda (a)
                                                        (impc:ti:type-unify (impc:ti:type-check a vars kts #f) vars))
                                                      (cdr ast))))))
          (if (not ftypes)
                ;; if no return type is ever required
                ;; then we can ignore it for our checks
                (if (and (list? request?)
                         (equal? *impc:ir:notype* (car request?)))
                    (for-each (lambda (ft)
                                (if (equal? (cddr asttype) (cddr ft))
                                    (set! asttype ft)))
                (if (and (list? ftypes)
                         (member asttype ftypes))
                      ;; (println 'force-poly (car ast) 'to (list asttype))
                      ;; if exact poly should we force var??
                      (impc:ti:force-var (car ast) vars kts (list asttype))

Back to Index