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

fix: A unary-test expression with ? returns true/false #959

Merged
merged 3 commits into from
Jan 3, 2025

Conversation

saig0
Copy link
Member

@saig0 saig0 commented Dec 18, 2024

Description

The engine restricts the usage of ? to an unary-test expression. It is implemented by returning a ValFatalError when accessing ?. If the expression is a unary-test, it evaluates the expression again and assigns the input value to ?.

Previously, the engine invoked a function without checking the arguments before. As a result, a function with an Any parameter (e.g. list contains(list, any)) accepted a ValError/ValFatalError as a regular value and didn't forward the error.

Fix the issue by adding the validation of the arguments before invoking the function.

Related issues

closes camunda/camunda#26054

Add a test case to verify an unary-tests expression with the special variable `?` for a parameter with ANY type.
Check if a function argument is an error before invoking the function. Otherwise, the function may handle the argument not as an error but a regular value.
Move the function validation in the interpreter before invoking the function.
@saig0 saig0 added this pull request to the merge queue Jan 3, 2025
Merged via the queue into main with commit 41f8956 Jan 3, 2025
5 checks passed
@saig0 saig0 deleted the 26054-unary-tests branch January 3, 2025 08:00
@saig0
Copy link
Member Author

saig0 commented Jan 3, 2025

Successfully created backport PR for 1.17:

@saig0
Copy link
Member Author

saig0 commented Jan 3, 2025

Successfully created backport PR for 1.18:

@saig0
Copy link
Member Author

saig0 commented Jan 3, 2025

Successfully created backport PR for 1.19:

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

Successfully merging this pull request may close these issues.

[FEEL/DMN] A unary-test expression with ? returns null instead of true/false
2 participants