<< Back to previous view

[CTYP-19] ann-form requires fully qualified classnames Created: 10/Mar/13  Updated: 15/Sep/13  Resolved: 29/Mar/13

Status: Closed
Project: core.typed
Component/s: None
Affects Version/s: None
Fix Version/s: 0.2.0

Type: Defect Priority: Major
Reporter: Andrew Brehaut Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
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



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 10/Mar/13 9:25 PM ]

Confirmed. This is due to running the type checker in a namespace other than the namespace being checked.

Comment by Ambrose Bonnaire-Sergeant [ 29/Mar/13 7:50 AM ]

Fixed: https://github.com/clojure/core.typed/commit/0d195fbc879f5e62051ec922ffbd2c8ada4a194a

Generated at Wed Aug 27 12:06:37 CDT 2014 using JIRA 4.4#649-r158309.