-
Notifications
You must be signed in to change notification settings - Fork 51
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
[Backport 1.16] fix: Unary-test behavior with special input variable ?
#906
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add test cases to explicitly verify that a unary-test expression returns the correct output (true/false/null). Restructure existing tests cases and group them into the different behaviors. (cherry picked from commit 866ce00)
Introduce a new type for not recoverable errors. Compared to the existing error, this new error should stop the evaluation instead of continue the evaluation with null. (cherry picked from commit 04abac9)
Correct the behavior of unary-test expression to return only true if an expression with the special variable `?` evaluates to true. Identify the usage by returning a fatal error if `?` is used outside of an unary-test. (cherry picked from commit 61cb169)
Adjust all operations to return a fatal error instead of returning null. This is required to limit the access to the special input symbol `?` outside an unary-tests. Restructure some helper methods to restrict the handling of fatal errors to a few places. This should help to reduce possible problems with fatal errors. Move some methods to group different aspects together. (cherry picked from commit c967208)
(cherry picked from commit 1ba21ca)
(cherry picked from commit f171ebf)
Add a test case to verify that the input variable is not available outside of an unary-test expression. (cherry picked from commit 8354d1b)
(cherry picked from commit ac4737b)
Add a string representation for Val types to produce better failure messages.
The failure messages changed because of the new string representation of Val types.
The unary-test behaves differently compared to newer versions. Instead of returning null, it returns false or fail the evaluation. The reason is the improved null-friendly error handling since version 1.17. Adjust the expected result based on the current behavior.
remcowesterhoud
approved these changes
Aug 27, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Backport of #887 for
1.16
.Most changes are the same as in the original. However, I had to adjust the code to align with the error behavior in version
1.16.
. Instead of returningnull
(e.g. if a variable doesn't exist), the evaluation fails or returnsfalse
. The last commit highlights the different behavior for unary-tests compared to version1.17+
.Related issues
closes #864