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 ForClause PositionalVar empty sequence handling #5589

Conversation

Robin6939
Copy link
Contributor

Description:

Resolved an issue where ForClause's PositionalVar incorrectly returned values when faced with an empty sequence while allowing emptiness. This adjustment ensures accurate handling of edge cases in sequence evaluations, aligning behavior with expected standards.

Reference:

#5235

Tests:

Added tests which verifies the same

@Robin6939 Robin6939 requested a review from a team as a code owner December 25, 2024 09:20
Copy link
Member

@line-o line-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really great, thank you for your contribution! What a 🎁
Would it be OK for me to fix the formatting and commit message format or do you want to do it?

@Robin6939 Robin6939 force-pushed the hotfix/forclause-positionalvar-empty-sequence-when-allowempty branch from bca2b7a to a582546 Compare December 25, 2024 09:48
@Robin6939
Copy link
Contributor Author

Hi @line-o,
Thank you for your review 😄
I tried to fix the commit message. Can you help me fix the formatting. Since this is my first PR here, I am not familiar with it.

@adamretter
Copy link
Contributor

@Robin6939 Wonderful to see that you made some progress after our call yesterday... Quick work!

Regards formatting, IntelliJ has a Java code formatter on the Code menu item, there is Reformat Code, but if the existing file is not correctly formatted, then this will cause more noise than you need. So I will comment directly on the formatting of your code separately...

Copy link
Contributor

@adamretter adamretter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small formatting issue.

@Robin6939 Robin6939 force-pushed the hotfix/forclause-positionalvar-empty-sequence-when-allowempty branch from a582546 to def5a78 Compare December 25, 2024 10:13
exist-core/src/main/java/org/exist/xquery/ForExpr.java Outdated Show resolved Hide resolved
@@ -156,3 +156,17 @@ function flwor:allowing-empty($n as xs:integer) {
return concat("[", $x, "]")
};

declare
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a test that shows the correct behaviour if allowing empty is not set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't any right now
Should I add them?

Copy link
Member

@line-o line-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a few suggestions and questions.

exist-core/src/main/java/org/exist/xquery/ForExpr.java Outdated Show resolved Hide resolved
@line-o line-o requested review from a team and removed request for adamretter December 26, 2024 20:27
@Robin6939 Robin6939 force-pushed the hotfix/forclause-positionalvar-empty-sequence-when-allowempty branch from def5a78 to f7c3016 Compare December 28, 2024 18:43
@Robin6939 Robin6939 requested a review from line-o December 28, 2024 18:44
@line-o line-o merged commit c9d18fb into eXist-db:develop Dec 30, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants