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"
9174
9174
9175
9175
IIndexed
9176
9176
(-nth [rng n]
9177
- (if (< n ( -count rng))
9177
+ (if (and ( <= 0 n) ( < n ( -count rng) ))
9178
9178
(+ start (* n step))
9179
- (if (and (> start end) (zero? step))
9179
+ (if (and (<= 0 n) ( > start end) (zero? step))
9180
9180
start
9181
9181
(throw (js/Error. " Index out of bounds" )))))
9182
9182
(-nth [rng n not-found]
9183
- (if (< n ( -count rng))
9183
+ (if (and ( <= 0 n) ( < n ( -count rng) ))
9184
9184
(+ start (* n step))
9185
- (if (and (> start end) (zero? step))
9185
+ (if (and (<= 0 n) ( > start end) (zero? step))
9186
9186
start
9187
9187
not-found)))
9188
9188
Original file line number Diff line number Diff line change 1337
1337
" unreachable" )
1338
1338
" cljs-2104" ))))
1339
1339
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
+
1340
1346
(comment
1341
1347
; ; ObjMap
1342
1348
; ; (let [ks (map (partial str "foo") (range 500))
You can’t perform that action at this time.
0 commit comments