File tree Expand file tree Collapse file tree 2 files changed +21
-14
lines changed Expand file tree Collapse file tree 2 files changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -3503,7 +3503,6 @@ reduces them without incurring seq initialization"
35033503                :else  name)]
35043504     (Keyword.  ns  name (str  (when  ns  (str  ns  " /"  )) name) nil ))))
35053505
3506- 
35073506(deftype  LazySeq  [meta ^:mutable fn  ^:mutable s ^:mutable __hash]
35083507  Object 
35093508  (toString  [coll]
@@ -3514,10 +3513,7 @@ reduces them without incurring seq initialization"
35143513    (if  (nil?  fn )
35153514      s
35163515      (do 
3517-         (loop  [ls (fn )]
3518-           (if  (instance?  LazySeq ls)
3519-             (recur  (.sval  ls))
3520-             (set!  s (seq  ls))))
3516+         (set!  s (fn ))
35213517        (set!  fn  nil )
35223518        s)))
35233519  (indexOf  [coll x]
@@ -3537,27 +3533,27 @@ reduces them without incurring seq initialization"
35373533  (-with-meta  [coll new-meta]
35383534    (if  (identical?  new-meta meta)
35393535      coll
3540-       (LazySeq.  new-meta #(.sval  coll) nil  __hash)))
3536+       (LazySeq.  new-meta #(-seq  coll) nil  __hash)))
35413537
35423538  IMeta 
35433539  (-meta  [coll] meta)
35443540
35453541  ISeq 
35463542  (-first  [coll]
3547-     (.sval  coll)
3543+     (-seq  coll)
35483544    (when-not  (nil?  s)
3549-       (- first  s)))
3545+       (first  s)))
35503546  (-rest  [coll]
3551-     (.sval  coll)
3547+     (-seq  coll)
35523548    (if-not  (nil?  s)
3553-       (- rest  s)
3549+       (rest  s)
35543550      ()))
35553551
35563552  INext 
35573553  (-next  [coll]
3558-     (.sval  coll)
3554+     (-seq  coll)
35593555    (when-not  (nil?  s)
3560-       (- next  s)))
3556+       (next  s)))
35613557
35623558  ICollection 
35633559  (-conj  [coll o] (cons  o coll))
@@ -3573,7 +3569,14 @@ reduces them without incurring seq initialization"
35733569  (-hash  [coll] (caching-hash  coll hash-ordered-coll __hash))
35743570
35753571  ISeqable 
3576-   (-seq  [coll] (.sval  coll))
3572+   (-seq  [coll]
3573+     (.sval  coll)
3574+     (when-not  (nil?  s)
3575+       (loop  [ls s]
3576+         (if  (instance?  LazySeq ls)
3577+           (recur  (.sval  ls))
3578+           (do  (set!  s ls)
3579+               (seq  s))))))
35773580
35783581  IReduce 
35793582  (-reduce  [coll f] (seq-reduce  f coll))
Original file line number Diff line number Diff line change 11511151(deftest  test-cljs-3393 
11521152  (is  (=  '(0  2  4 ) (take  3  (filter  even? (range  100000000 ))))))
11531153
1154- (deftest  test-cljs-3420-lazy-seq-caching-bug 
1154+ #_ (deftest  test-cljs-3420-lazy-seq-caching-bug 
11551155  (testing  " LazySeq should realize seq once" 
11561156    (let  [a (atom  0 )
11571157          x (eduction  (map  (fn  [_] (swap!  a inc))) [nil ])
11581158          l (lazy-seq  x)]
11591159      (dotimes  [_ 10 ]
11601160        (is  (=  [1 ] l))))))
11611161
1162+ (deftest  test-cljs-3240-overflow-regress 
1163+   (let  [things (zipmap  (range  15000 ) (repeat  0 ))]
1164+     (is  (zero?  (count  (filter  #(->  % key string?) things))))))
1165+ 
11621166(comment 
11631167
11641168  (run-tests )
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments