File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -5476,12 +5476,15 @@ reduces them without incurring seq initialization"
54765476(defn- build-subvec [meta v start end __hash]
54775477 (if (instance? Subvec v)
54785478 (recur meta (.-v v) (+ (.-start v) start) (+ (.-start v) end) __hash)
5479- (let [c (count v)]
5480- (when (or (neg? start)
5481- (neg? end)
5482- (> start c)
5483- (> end c))
5484- (throw (js/Error. " Index out of bounds" )))
5479+ (do
5480+ (when-not (vector? v)
5481+ (throw (js/Error. " v must satisfy IVector" )))
5482+ (let [c (count v)]
5483+ (when (or (neg? start)
5484+ (neg? end)
5485+ (> start c)
5486+ (> end c))
5487+ (throw (js/Error. " Index out of bounds" ))))
54855488 (Subvec. meta v start end __hash))))
54865489
54875490(defn subvec
Original file line number Diff line number Diff line change 12621262 (case (swap! x m) :a 0 :default )
12631263 (is (= :b @x)))))
12641264
1265+ (deftest test-cljs-2021
1266+ (let [check-if-throws #(try (% ) (catch js/Error e :fail ))]
1267+ (is (= :fail (check-if-throws #(subvec nil 0 0 ))))
1268+ (is (= :fail (check-if-throws #(subvec {:foo :bar } 0 1 ))))
1269+ (is (= :fail (check-if-throws #(subvec '(:foo ) 0 1 ))))
1270+ (is (= :fail (check-if-throws #(subvec #{:foo } 0 1 ))))))
1271+
12651272(comment
12661273 ; ; ObjMap
12671274 ; ; (let [ks (map (partial str "foo") (range 500))
You can’t perform that action at this time.
0 commit comments