File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -9174,15 +9174,15 @@ reduces them without incurring seq initialization"
91749174
91759175 IIndexed
91769176 (-nth [rng n]
9177- (if (< n ( -count rng))
9177+ (if (and ( <= 0 n) ( < n ( -count rng) ))
91789178 (+ start (* n step))
9179- (if (and (> start end) (zero? step))
9179+ (if (and (<= 0 n) ( > start end) (zero? step))
91809180 start
91819181 (throw (js/Error. " Index out of bounds" )))))
91829182 (-nth [rng n not-found]
9183- (if (< n ( -count rng))
9183+ (if (and ( <= 0 n) ( < n ( -count rng) ))
91849184 (+ start (* n step))
9185- (if (and (> start end) (zero? step))
9185+ (if (and (<= 0 n) ( > start end) (zero? step))
91869186 start
91879187 not-found)))
91889188
Original file line number Diff line number Diff line change 13371337 " unreachable" )
13381338 " cljs-2104" ))))
13391339
1340+ (deftest test-cljs-2113
1341+ (is (thrown? js/Error (nth (range 2 ) -2 )))
1342+ (is (thrown? js/Error (nth (range 2 1 0 ) -2 )))
1343+ (is (= ::not-found (nth (range 2 ) -2 ::not-found )))
1344+ (is (= ::not-found (nth (range 2 1 0 ) -2 ::not-found ))))
1345+
13401346(comment
13411347 ; ; ObjMap
13421348 ; ; (let [ks (map (partial str "foo") (range 500))
You can’t perform that action at this time.
0 commit comments