Description
Given the following rule:
(defrecord A [a])
(defrecord B [b])
(defrule a-rule
[A (= ?a a)]
[B (= ?r (conj b ?a))
(not-empty? ?r)]
=>
(println "doesn't matter"))
This rule will fail at compilation:
Caused by: java.lang.RuntimeException: Unable to resolve symbol: ?r in this context
The reason this occurs is because the way that the graph gets built. Currently (= ?r (conj b ?a))
is identified as a join-filter-expression
therefore it makes it into the ExpressionJoinNode. (not-empty? ?r)
is not identified as a dependent on the binding above, so it is added as a constraint to the AlphaNode for B
. Since the AlphaNode has no binding for ?r
it will fail to compile when trying to resolve the binding.
The issue seems to stem from how we determine the join-expression-filter.
non-equality-unifications classifies the variable usage at the beginning, however I think that it will also need to reclassify bound-variables if it encounters a binding that is a non-equality-unification.