Skip to content

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

Open
@EthanEChristian

Description

@EthanEChristian

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions