Automatically ignore untyped vars?

13 views
Skip to first unread message

Chris Cornelison

unread,
Mar 18, 2017, 4:36:35 PM3/18/17
to core.typed
Hi,

Suppose I have two modules...

(ns tcapp.core
  {:lang :core.typed}
  (:require [clojure.core.typed :refer [ann Int]]
            [tcapp.module :as m]))
  
(defn foo [] (m/add 42 41))

and...

(ns tcapp.module)
  
(defn add [x y] (+ x y))
  

results in...

Type Error (tcapp/core.clj:8:4) Unannotated var tcapp.module/add
Hint: Add the annotation for tcapp.module/add via check-ns or cf
in: tcapp.module/add


Is there a way to tell the type-checker... If there is no annotation, don't check it?

Having worked with mypy in Python, you just pass --ignore-missing-imports to the checker, and it only checks things that are typed, avoiding the 'type-the-world' problem.

Thanks,
Chris

Ambrose Bonnaire-Sergeant

unread,
Mar 18, 2017, 4:46:43 PM3/18/17
to core.typed
Hi Chris,

Try the :infer-vars feature like here. Let me know if it helps.

Thanks,
Ambrose

Chris Cornelison

unread,
Mar 18, 2017, 5:23:30 PM3/18/17
to clojure-c...@googlegroups.com
Yep.  That was what I was looking for.

Thanks,
Chris
Reply all
Reply to author
Forward
0 new messages