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

Enable Not node handling in HqlParser.NegateNode #3390

Merged
merged 3 commits into from
Aug 1, 2023

Conversation

bahusoid
Copy link
Member

@bahusoid bahusoid commented Aug 1, 2023

No description provided.

@bahusoid bahusoid merged commit d6fd1dc into nhibernate:master Aug 1, 2023
10 checks passed
@fredericDelaporte fredericDelaporte added this to the 5.5 milestone Aug 1, 2023
Comment on lines +58 to +64
@"SELECT COUNT(ROOT.Id)
FROM Entity AS ROOT
WHERE NOT (
NOT EXISTS (FROM ChildEntity AS CHILD WHERE CHILD.Parent = ROOT)
AND NOT ROOT.Name = 'Parent'
)").List();
Assert.That(log.GetWholeLog(), Does.Not.Contains(" NOT ").IgnoreCase);
Copy link
Member

Choose a reason for hiding this comment

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

This test is about a more complex case than the comment in the parser: not (not a and not b) instead of not (not x). That is not a simple double not. Eliminating the not requires to change it to (a or b). Is it what is actually done?

Copy link
Member Author

@bahusoid bahusoid Aug 1, 2023

Choose a reason for hiding this comment

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

Eliminating the not requires to change it to (a or b). Is it what is actually done?

Yes. #3328 was actually about proper handling of and/or negation. And this test case just makes sure that we don't generate double not anymore.

Copy link
Member

Choose a reason for hiding this comment

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

I have now locally checked. It does also add required parenthesis if needed, when the condition is more complex (like not (not a and not b) and c).

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.

3 participants