Skip to content

Commit e0f291c

Browse files
Revert "better error message when passing non-seqs to (seq)"
This reverts commit 96f5b5b.
1 parent 8385e7b commit e0f291c

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

src/jvm/clojure/lang/RT.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,7 @@ else if(coll instanceof Map)
502502
else {
503503
Class c = coll.getClass();
504504
Class sc = c.getSuperclass();
505-
throw new ExceptionInfo("Don't know how to create ISeq from: " + c.getName(),
506-
map(Keyword.intern("instance"), coll));
505+
throw new IllegalArgumentException("Don't know how to create ISeq from: " + c.getName());
507506
}
508507
}
509508

test/clojure/test_clojure/data_structures.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@
602602

603603
(deftest test-get
604604
(let [m {:a 1, :b 2, :c {:d 3, :e 4}, :f nil, :g false, nil {:h 5}}]
605-
(is (thrown? Throwable (get-in {:a 1} 5)))
605+
(is (thrown? IllegalArgumentException (get-in {:a 1} 5)))
606606
(are [x y] (= x y)
607607
(get m :a) 1
608608
(get m :e) nil

test/clojure/test_clojure/sequences.clj

+21-21
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139

140140

141141
(deftest test-cons
142-
(is (thrown? Throwable (cons 1 2)))
142+
(is (thrown? IllegalArgumentException (cons 1 2)))
143143
(are [x y] (= x y)
144144
(cons 1 nil) '(1)
145145
(cons nil nil) '(nil)
@@ -244,13 +244,13 @@
244244

245245
(deftest test-first
246246
;(is (thrown? Exception (first)))
247-
(is (thrown? Throwable (first true)))
248-
(is (thrown? Throwable (first false)))
249-
(is (thrown? Throwable (first 1)))
250-
;(is (thrown? Throwable (first 1 2)))
251-
(is (thrown? Throwable (first \a)))
252-
(is (thrown? Throwable (first 's)))
253-
(is (thrown? Throwable (first :k)))
247+
(is (thrown? IllegalArgumentException (first true)))
248+
(is (thrown? IllegalArgumentException (first false)))
249+
(is (thrown? IllegalArgumentException (first 1)))
250+
;(is (thrown? IllegalArgumentException (first 1 2)))
251+
(is (thrown? IllegalArgumentException (first \a)))
252+
(is (thrown? IllegalArgumentException (first 's)))
253+
(is (thrown? IllegalArgumentException (first :k)))
254254
(are [x y] (= x y)
255255
(first nil) nil
256256

@@ -310,14 +310,14 @@
310310

311311

312312
(deftest test-next
313-
; (is (thrown? Throwable (next)))
314-
(is (thrown? Throwable (next true)))
315-
(is (thrown? Throwable (next false)))
316-
(is (thrown? Throwable (next 1)))
317-
;(is (thrown? Throwable (next 1 2)))
318-
(is (thrown? Throwable (next \a)))
319-
(is (thrown? Throwable (next 's)))
320-
(is (thrown? Throwable (next :k)))
313+
; (is (thrown? IllegalArgumentException (next)))
314+
(is (thrown? IllegalArgumentException (next true)))
315+
(is (thrown? IllegalArgumentException (next false)))
316+
(is (thrown? IllegalArgumentException (next 1)))
317+
;(is (thrown? IllegalArgumentException (next 1 2)))
318+
(is (thrown? IllegalArgumentException (next \a)))
319+
(is (thrown? IllegalArgumentException (next 's)))
320+
(is (thrown? IllegalArgumentException (next :k)))
321321
(are [x y] (= x y)
322322
(next nil) nil
323323

@@ -445,7 +445,7 @@
445445
;; (ffirst coll) = (first (first coll))
446446
;;
447447
(deftest test-ffirst
448-
; (is (thrown? Throwable (ffirst)))
448+
; (is (thrown? IllegalArgumentException (ffirst)))
449449
(are [x y] (= x y)
450450
(ffirst nil) nil
451451

@@ -465,7 +465,7 @@
465465
;; (fnext coll) = (first (next coll)) = (second coll)
466466
;;
467467
(deftest test-fnext
468-
; (is (thrown? Throwable (fnext)))
468+
; (is (thrown? IllegalArgumentException (fnext)))
469469
(are [x y] (= x y)
470470
(fnext nil) nil
471471

@@ -489,7 +489,7 @@
489489
;; (nfirst coll) = (next (first coll))
490490
;;
491491
(deftest test-nfirst
492-
; (is (thrown? Throwable (nfirst)))
492+
; (is (thrown? IllegalArgumentException (nfirst)))
493493
(are [x y] (= x y)
494494
(nfirst nil) nil
495495

@@ -509,7 +509,7 @@
509509
;; (nnext coll) = (next (next coll))
510510
;;
511511
(deftest test-nnext
512-
; (is (thrown? Throwable (nnext)))
512+
; (is (thrown? IllegalArgumentException (nnext)))
513513
(are [x y] (= x y)
514514
(nnext nil) nil
515515

@@ -881,7 +881,7 @@
881881

882882

883883
(deftest test-repeat
884-
;(is (thrown? Throwable (repeat)))
884+
;(is (thrown? IllegalArgumentException (repeat)))
885885

886886
; infinite sequence => use take
887887
(are [x y] (= x y)

0 commit comments

Comments
 (0)