camunda / feel-scala

FEEL parser and interpreter written in Scala
https://camunda.github.io/feel-scala/
Apache License 2.0
123 stars 50 forks source link

Comparing different types should return null #708

Closed saig0 closed 1 year ago

saig0 commented 1 year ago

Describe the bug If I compare two values of a different type, the engine returns a failure. But it should be more friendly and return null instead.

This applies to expressions with the following operators: =, !=, <, >, etc. And, this applies to unary-test expressions if the input value has a different type as the other value.

To Reproduce Steps to reproduce the behavior:

  1. Evaluate the following expression
    "foo" = 100
  2. Verify that the engine returns a failure:
    failed to evaluate expression '"foo" = 100': expected String but found 'ValNumber(100)'

Expected behavior According to the DMN spec, the comparison of different types should return null.

Screenshot from 2023-09-08 14-33-47

(DMN 1.5, chapter 10.3.2.2, page 105)

Environment