Skip to content

Commit 6d6eb15

Browse files
committed
fix issue with merging disjunctions
1 parent 3fd56f7 commit 6d6eb15

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/clojure/dyna/prefix_trie.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@
307307

308308
(trie-reorder-keys [this new-order]
309309
;; the arity between the keys could include adding in new keys. In which case this is going to have to identify new values for this
310-
(assert (>= (count new-order) arity))
310+
(dyna-assert (>= (count new-order) arity))
311311
(if (= new-order (vec (range arity)))
312312
this ;; there is no change so just return this without making any changes
313313
(let [new-contains-wildcard (reduce bit-or 0 (map (fn [i] (if (or (nil? (nth new-order i))

src/clojure/dyna/rexpr_disjunction.clj

+2-1
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,9 @@
212212
(if (is-disjunct-op? new-child-rexpr)
213213
(let [child-trie ^PrefixTrie (:rexprs new-child-rexpr)
214214
child-vars (:disjunction-variables new-child-rexpr)
215+
known-values (vec (map #(get-value-in-context % child-context) child-vars))
215216
new-order (vec (map (zipmap child-vars (range)) dj-vars))
216-
t-reordered (trie-reorder-keys child-trie new-order)]
217+
t-reordered (trie-reorder-keys-subselect child-trie new-order known-values)]
217218
(vswap! ret-children trie-merge t-reordered)
218219
(vswap! num-children #(+ 2 %)) ;; there should be at least 2 children getting added, so we will still return a trie in the end
219220
)

0 commit comments

Comments
 (0)