Details
-
Type:
Defect
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: None
-
Fix Version/s: 0.2.0
-
Component/s: None
-
Labels:None
Description
Classes imported into a namespace are visible to clojure.core.type/ann without qualification, but require full qualification with 'clojure.core.type/ann-form.
For example:
(ns ring.typed.util.data "Miscellaneous functions for manipulating data structures." (:require [clojure.core.typed :refer [ann ann-form]]) (:import (clojure.lang IPersistentVector IPersistentMap))) (ann assoc-conj (All [x] (Fn [(IPersistentMap Any (U x (IPersistentVector (U Any x)))) Any x -> (IPersistentMap Any (U x (IPersistentVector x)))] [(IPersistentVector (U x (IPersistentVector x))) Integer x -> (IPersistentVector (U x (IPersistentVector x)))]))) (defn assoc-conj "Associate a key with a value in a map. If the key already exists in the map, a vector of values is associated with the key." [map key val] (assoc map key (if-let [cur (get map key)] (if (vector? cur) (ann-form (conj cur val) (IPersistentVector x)) [cur val]) val)))
This results in a "Cannot parse list: (IPersistentVector x)" Exception
When
(ann-form (conj cur val)
(IPersistentVector x))
is changed to
(ann-form (conj cur val)
(clojure.lang.IPersistentVector x))
checking works.
I have been running check-ns from the 'user namespace
Confirmed. This is due to running the type checker in a namespace other than the namespace being checked.