Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Join binding followed by usage of binding leads to unresolvable symbol at compilation #426

Open
EthanEChristian opened this issue Apr 15, 2019 · 2 comments
Labels

Comments

@EthanEChristian
Copy link
Contributor

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.

EthanEChristian pushed a commit to EthanEChristian/clara-rules that referenced this issue Apr 16, 2019
@EthanEChristian
Copy link
Contributor Author

posted #427 as a fix

@EthanEChristian
Copy link
Contributor Author

During the implementation of the PR above, i ran across a scenario where the binding in question was not passed to the production node correctly on the CLJS side of clara. This issue will encompass that issue as well, as they are too tightly coupled to not fix both.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant