File tree Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 22
33## master (unreleased)
44
5+ - [ #359 ] ( https://github.com/clojure-emacs/orchard/pull/359 ) : Print: protect printing from broken eductions.
6+
57## 0.37.0 (2025-09-19)
68
79- [ #353 ] ( https://github.com/clojure-emacs/orchard/pull/353 ) : Stacktrace: flag Clojure functions as duplicate.
Original file line number Diff line number Diff line change 1313 (clojure.core Eduction)
1414 (clojure.lang AFunction Compiler IDeref IPending IPersistentMap MultiFn
1515 IPersistentSet IPersistentVector IRecord Keyword Namespace
16- Symbol TaggedLiteral Var)
16+ RT Symbol TaggedLiteral Var)
1717 (java.io Writer)
18- (java.util List Map Map$Entry)
18+ (java.util Iterator List Map Map$Entry)
1919 (mx.cider.orchard TruncatingStringWriter
2020 TruncatingStringWriter$TotalLimitExceeded)))
2121
7878 (when-not (nil? level)
7979 (set! *print-level* (dec level)))
8080 (try
81- (let [^Iterable iterable (if (instance? Iterable x) x (seq x))
82- it (.iterator iterable)]
81+ (let [^Iterator it (try (RT/iter (if (instance? Iterable x) x (seq x)))
82+ ; ; In some cases, calling .iterator may throw
83+ ; ; (e.g. incomplete CollReduce implementations).
84+ (catch Exception ex
85+ (RT/iter [(format " <<%s>>" ex)])))]
8386 (if (.hasNext it)
8487 (do (.write w prefix)
8588 (if (or (nil? level) (pos? level))
Original file line number Diff line number Diff line change 11(ns orchard.print-test
22 (:require
33 [clojure.test :as t :refer [is are deftest testing]]
4- [orchard.print :as sut])
4+ [orchard.print :as sut]
5+ [orchard.test.util :refer [is+]])
56 (:import
67 (mx.cider.orchard TruncatingStringWriter
78 TruncatingStringWriter$TotalLimitExceeded)))
182183 (are [kw repr] (= repr (sut/print-str kw))
183184 ::foo " :orchard.print-test/foo"
184185 ::t/foo " :clojure.test/foo" ))))
186+
187+ (deftest broken-eduction-test
188+ (testing " shouldn't throw if printing an eduction that lacks Seq impl"
189+ (is+ #"\(\" <<java.lang.IllegalArgumentException: Don't know how to create ISeq from:"
190+ (sut/print-str (eduction (map identity)
191+ (reify clojure.core.protocols.CollReduce
192+ (coll-reduce [_ f]
193+ (reduce f (range 10 )))
194+ (coll-reduce [_ f init]
195+ (reduce f init (range 10 )))))))))
You can’t perform that action at this time.
0 commit comments