Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-6648

Forall with a pattern containing parenthesized expression matches when not supposed to

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 7.59.0.Final
    • core engine
    • None
    • 2021 Week 40-42 (from Oct 4)
    • Hide

      run:

      mvn clean test
      

      on attached reproducer.

      Show
      run: mvn clean test on attached reproducer.
    • NEW
    • NEW

      This is similar to DROOLS-6469, but occurs on more complex expressions with parentheses.

      Forall clauses containing a pattern with parenthesized expression will match even when such an expression is not satisfied.

      For example, the following rule:

          rule "Rule"
          when
          forall(
          Fact( ( v2 == 42 && v1 == "FOO"  ) )  )
          then
          end
      

      will match against the following fact:

          Fact( v1=BAR, v2=42 )
      

      whereas it is not supposed to.

      When removing the extra parenthesis from the expression in the pattern, it will instead work as expected.

      For example, the following rule:

          rule "Rule"
          when
          forall(
          Fact( v2 == 42 && v1 == "FOO"  )  )
          then
          end
      

      will not match against Fact( v1=BAR, v2=42 ) as expected.

      More complex parenthesized expression will also match when not supposed to. For example the following rule:

          rule "Rule"
          when
          forall(
          Fact( ( v2 == 42 && v1 == "FOO"  ) || v3 )  )
          then
          end
      

      will match against the following fact:

          Fact( v1=BAR, v2=42, v3=false )
      

      whereas it is not supposed to.

      Notice that the issue does not occur when running with executable model.

              mfusco@redhat.com Mario Fusco
              mcasalino Matteo Casalino (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: