Fix Query operators to reflect nullable parameters#8836
Merged
Conversation
The &, |, !, and + operators on Query all handle null arguments, but their signatures did not reflect this. Using a nullable Query? variable with these operators caused CS8604 warnings under nullable reference types. Mark all operator parameters and return types appropriately with ?. Fixes #8807 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
❌ Author of the following commits did not sign a Contributor Agreement: Please, read and sign the above mentioned agreement if you want to contribute to this project |
github-actions bot
pushed a commit
that referenced
this pull request
Mar 5, 2026
Co-authored-by: Amit Kanfer <amitkanfer@Amits-MacBook-Pro.local> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> (cherry picked from commit 6fafe1a)
github-actions bot
pushed a commit
that referenced
this pull request
Mar 5, 2026
Co-authored-by: Amit Kanfer <amitkanfer@Amits-MacBook-Pro.local> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> (cherry picked from commit 6fafe1a)
Contributor
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
flobernd
pushed a commit
that referenced
this pull request
Mar 5, 2026
This was referenced Mar 14, 2026
This file contains hidden or 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
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.
Summary
Fixes #8807
The
&,|,!, and+operators onQuerysilently handlenullarguments in their implementations, but the method signatures declared non-nullable parameters. This caused spuriousCS8604(possible null reference argument) warnings when combiningQuery?variables with these operators under nullable reference types.Changes:
operator &andoperator |: parameters changed fromQuerytoQuery?And()andOr()internal helpers: parameters changed toQuery?, non-null assertions added where the logic guarantees non-null after null checksoperator !andoperator +: return types changed toQuery?to reflect they returnnullwhen the input isnullTest plan
CS8604warnings when usingQuery?variables with&and|null & queryandquery & nullreturn the non-null operand (existing behavior preserved)!((Query?)null)returnsnull(existing behavior preserved)🤖 Generated with Claude Code