Skip to content
This repository has been archived by the owner on Jan 2, 2018. It is now read-only.

Commit

Permalink
Update some old Map* to HMap
Browse files Browse the repository at this point in the history
  • Loading branch information
frenchy64 committed Jul 16, 2012
1 parent cabf2c4 commit 7fa5c7f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/typed/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1522,6 +1522,7 @@
(defonce RESTRICTED-CLASS (atom {}))

(defn poly-RClass-from [class]
{:pre [(class? class)]}
(let [rclass (@RESTRICTED-CLASS class)]
(assert rclass (str class " not declared as polymorphic"))
rclass))
Expand Down Expand Up @@ -1675,6 +1676,7 @@

(defn parse-rinstance-type [[cls-sym & params-syn]]
(let [cls (resolve cls-sym)
_ (assert (class? cls) (str cls-sym " cannot be resolved"))
tparams (doall (map parse-type params-syn))]
(RInstance-of cls tparams)))

Expand Down
12 changes: 6 additions & 6 deletions test/typed/test/conduit.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@

(def-alias ConduitMeta
(U
(Map {:created-by (Value :disperse)
(HMap {:created-by (Value :disperse)
:args Args
:parts Parts})
(Map {:created-by (Value :a-arr)
(HMap {:created-by (Value :a-arr)
:args Args})
(Map {:created-by (Value :a-comp)
(HMap {:created-by (Value :a-comp)
:args Args
:parts Parts})
(Map {:created-by (Value :a-nth)
(HMap {:created-by (Value :a-nth)
:args Args
:parts Parts})))


(ann merge-parts [(IMeta (U (Map* :mandatory {:parts Any}) nil))
(ann merge-parts [(IMeta (U (HMap {:parts Any}) nil))
-> (IPersistentMap Any Any)])
(defn merge-parts [ps]
(apply merge-with merge
(map (fn> [[a :- (IMeta (U (Map* :mandatory {:parts Any}) nil))]]
(map (fn> [[a :- (IMeta (U (HMap {:parts Any}) nil))]]
(-> a meta :parts))
ps)))
4 changes: 1 addition & 3 deletions test/typed/test/example.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
(defn test2 [a]
((inst map (U true false) Any) number? a))

(ann use-map [(Map* :mandatory
{:a Number})
-> Number])
(ann use-map [(HMap {:a Number}) -> Number])
(defn use-map [a]
(get a :a))

Expand Down
3 changes: 2 additions & 1 deletion test/typed/test/mm.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns typed.test.mm
(:require [typed.core :as [ann]]))
(:import (clojure.lang IPersistentMap))
(:require [typed.core :refer [ann]]))

(ann MapToString [(IPersistentMap Any Any) -> String])

Expand Down

0 comments on commit 7fa5c7f

Please sign in to comment.