File tree Expand file tree Collapse file tree
Clojure.Tests/clojure/test_clojure Expand file tree Collapse file tree Original file line number Diff line number Diff line change 687687 [opts sigs]))
688688 sigs (when sigs
689689 (reduce1 (fn [m s]
690- (let [tag-to-class (fn [tag]
691- (if-let [c (and (instance? clojure.lang.Symbol tag)
692- (= (.IndexOf (.Name ^clojure.lang.Symbol tag) " ." ) -1 ) ; ;; .indexOf .getName
693- (not (contains? '#{int long float double char short byte boolean void uint ulong ushort sbyte ; ;; add unsigned types
694- ints longs floats doubles chars shorts bytes booleans objects uints ulongs ushorts sbytes} tag))
695- (resolve tag))]
696- (symbol (.FullName c)) ; ;; .getName
697- tag))
698- name-meta (update-in (meta (first s)) [:tag ] tag-to-class)
690+ (let [disallowed? '#{int long float double char short byte boolean void uint ulong ushort sbyte} ; ;; Added unsigned types
691+ array-tag? '#{ints longs floats doubles chars shorts bytes booleans objects uints ulongs ushorts sbytes} ; ;; Added unsigned types
692+ resolve-class-symbol (fn [tag]
693+ (when-not (disallowed? tag)
694+ (if-let [c (and (instance? clojure.lang.Symbol tag)
695+ (= (.IndexOf (.Name ^clojure.lang.Symbol tag) " ." ) -1 ) ; ;; .indexOf .getName
696+ (not (array-tag? tag))
697+ (resolve tag))]
698+ (symbol (.FullName c)) ; ;; .getName
699+ tag)))
700+ name-meta (update-in (meta (first s)) [:tag ] resolve-class-symbol)
699701 mname (with-meta (first s) nil )
700702 [arglists doc]
701703 (loop [as [] rs (rest s)]
Original file line number Diff line number Diff line change 705705(extend-protocol clojure.test-clojure.protocols/P String
706706 (f [s] (seq s)))
707707(deftest test-resolve-type-hints-in-protocol-methods
708- (is (= 4 (clojure.test-clojure.protocols/f " test" ))))
708+ (is (= 4 (clojure.test-clojure.protocols/f " test" ))))
709+
710+
711+ ; ; CLJ-2698 - Ignore primitive hints in defprotocol return
712+
713+ (defprotocol PrimHinted
714+ (^double f1 [p a])
715+ (^void f2 [p]))
716+
717+ (deftest test-prim-ret-hints-ignored
718+ (is (thrown-with-msg?
719+ Exception
720+ #"Receiver class"
721+ (eval '(f1 (reify PrimHinted) :foo ))))
722+ (is (= :foo (f1 (reify PrimHinted (f1 [_ x] x)) :foo )))
723+ (is (= " foo" (f2 (reify PrimHinted (f2 [_] " foo" ))))))
You can’t perform that action at this time.
0 commit comments