nikku / feelin

A DMN FEEL parser and interpreter written in JavaScript
MIT License
38 stars 8 forks source link

String comparison does not appear to work for multi-character strings #73

Open sergei-maertens opened 4 months ago

sergei-maertens commented 4 months ago

I tried tracking down in DMN-TCK if there's a test case for this, but couldn't easily find one. I also couldn't find an explicit case in the DMN 1.3 FEEL standard PDF for this, so this may be a wrong expectation of me... However, the Camunda playground (https://camunda.github.io/feel-scala/docs/playground/) does support it.

Describe the Bug

A range expression on strings doesn't work. Tested examples:

The reported error is "Failed to evaluate FEEL expression: illegal range start: 1015CJ".

Single character ranges (like x in ["A".."C"]) do work though!

The syntax tree on the playground looks correct however.

Steps to Reproduce

  1. Define a string range expression: ["AA".."ZZ"]
  2. Try to parse or evaluate the expression
  3. The expression fails to evaluate.

Playground: https://nikku.github.io/feel-playground/?e=%5B%22AA%22..%22ZZ%22%5D&c=%7B%0A++%22%3F%22%3A+%22CC%22%0A%7D&t=expression&st=true

Expected Behavior

Multi-character strings can be used in ranges.

Environment

nikku commented 4 months ago

This is a bug that we should fix.

falko commented 1 month ago

I would have needed this for a prospect. In my case it was lexicographic order was just for cosmetics though. I worked around it with sting length()