Permalink
Browse files

CLJS 600 & CLJS 604: LazySeq regressions

Cannot call optimized path since LazySeq obviously won't have called seq
on it's tail. Fix regression why using fns instead of calling protocol
fns directly.
  • Loading branch information...
1 parent b567bc5 commit 73aa7ef0dd75e960538d53e1423d7023dd568efb @swannodette swannodette committed Oct 5, 2013
Showing with 15 additions and 6 deletions.
  1. +6 −6 src/cljs/cljs/core.cljs
  2. +9 −0 test/cljs/cljs/core_test.cljs
View
@@ -1969,7 +1969,8 @@ reduces them without incurring seq initialization"
(-rest [coll] (if (nil? rest) () rest))
INext
- (-next [coll] (if (nil? rest) nil (-seq rest)))
+ (-next [coll]
+ (if (nil? rest) nil (seq rest)))
ICollection
(-conj [coll o] (Cons. nil o coll __hash))
@@ -2085,18 +2086,18 @@ reduces them without incurring seq initialization"
(-first [coll]
(-seq coll)
(when-not (nil? s)
- (-first ^not-native s)))
+ (first s)))
(-rest [coll]
(-seq coll)
(if-not (nil? s)
- (-rest ^not-native s)
+ (rest s)
()))
INext
(-next [coll]
(-seq coll)
(when-not (nil? s)
- (-next ^not-native s)))
+ (next s)))
ICollection
(-conj [coll o] (cons o coll))
@@ -2119,8 +2120,7 @@ reduces them without incurring seq initialization"
(if (instance? LazySeq ls)
(recur (.sval ls))
(do (set! s ls)
- (when-not (nil? s)
- (-seq ^not-native s)))))))
+ (seq s))))))
IReduce
(-reduce [coll f] (seq-reduce f coll))
@@ -1951,5 +1951,14 @@
;; CLJS-587
(assert (== (first (filter #(== % 9999) (range))) 9999))
+ ;; LazySeq regressions
+
+ ;; CLJS-604
+ (assert (= () (concat nil [])))
+ (assert (= () (concat [] [])))
+
+ ;; CLJS-600
+ (assert (= "foobar" (apply str (concat "foo" "bar"))))
+
:ok
)

0 comments on commit 73aa7ef

Please sign in to comment.