Skip to content

Fix bug with NullComparisonRewriter - #499

Merged
SergeiPavlov merged 6 commits into
master-servicetitanfrom
NullableEnum2
Aug 5, 2026
Merged

Fix bug with NullComparisonRewriter#499
SergeiPavlov merged 6 commits into
master-servicetitanfrom
NullableEnum2

Conversation

@SergeiPavlov

@SergeiPavlov SergeiPavlov commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

NullComparisonRewriter incorrectly processes nullable enum

For example following line in a materializer:
JobStatus = r.Job != null ? r.Job.Status : null
sometime assigns default(JobStatus) instead of null (when r.Job == null)

This depends on State.IsTailMethod flag which activates NullComparisonRewriter.

Adding .Tag() can change the behavior.
or
query.ToList().First() and query.First() have different behavior.

This PR improves NullComparisonRewriter to add explicit conversion from null to (ValueType?)null

@SergeiPavlov
SergeiPavlov merged commit cb7e402 into master-servicetitan Aug 5, 2026
5 checks passed
@SergeiPavlov
SergeiPavlov deleted the NullableEnum2 branch August 5, 2026 23:32
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.

2 participants