Skip to content

Commit b6d5a7e

Browse files
committed
fix: iterator on empty trace
1 parent 4534e1c commit b6d5a7e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/gen/dynamic/trace.cljc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
(:require-macros [gen.dynamic.trace]))
1111
#?(:clj
1212
(:import
13-
(clojure.lang Associative IFn IObj IMapIterable Seqable))))
13+
(clojure.lang Associative IFn IObj IMapIterable))))
1414

1515
(defn no-op
1616
([gf args]
@@ -156,11 +156,9 @@
156156
(valIterator [this]
157157
(.iterator ^Iterable (vals (trace/choices this))))
158158

159-
java.lang.Iterable
159+
Iterable
160160
(iterator [this]
161-
(.iterator
162-
(let [^Seqable choice-map (trace/choices this)]
163-
^Iterable (.seq choice-map))))]))
161+
(.iterator ^Iterable (trace/choices this)))]))
164162

165163
(defn ^:no-doc = [^Trace this that]
166164
(and (instance? Trace that)

test/gen/dynamic/trace_test.cljc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
(is (= :x (trace :addr)))))
4545

4646
(deftest keys
47+
(is (= {} (into {} (dynamic.trace/trace (gen []) [])))
48+
"iterator works on an empty trace")
49+
4750
(is (= #{:addr}
4851
(-> (dynamic.trace/trace (gen []) [])
4952
(dynamic.trace/assoc-subtrace :addr (choice-trace :x))

0 commit comments

Comments
 (0)