Commit 18a6107
fix: resolve type of conditional expressions in derived properties
Previously, derived properties with conditional expressions returning mixed
nullable/non-nullable types would have their type resolved to Object, causing:
"Unsupported value '0' for type 'Object'" errors when filtering.
This occurred with expressions like:
x.Date.HasValue ? (calculation).Days : (int?)null
The fix properly resolves the type of conditional expressions by:
1. Detecting when a derived property expression has Object type
2. Unwrapping any Convert/Unary expressions to find the actual conditional
3. Analyzing the true/false branches to determine the correct type
4. Reconstructing the conditional expression with the proper type
5. Converting the left expression for comparison to use the resolved type
Also improved CreateRightExpr to handle Object-typed conditional expressions
by resolving their actual underlying type before creating comparison values.
Test added to verify complex conditional expressions with nullable types
work correctly for filtering operations.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 8234adf commit 18a6107
2 files changed
Lines changed: 147 additions & 23 deletions
Lines changed: 24 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3821 | 3821 | | |
3822 | 3822 | | |
3823 | 3823 | | |
3824 | | - | |
3825 | | - | |
| 3824 | + | |
| 3825 | + | |
3826 | 3826 | | |
3827 | | - | |
3828 | | - | |
3829 | | - | |
3830 | | - | |
3831 | | - | |
3832 | | - | |
3833 | | - | |
3834 | | - | |
3835 | | - | |
3836 | | - | |
| 3827 | + | |
| 3828 | + | |
| 3829 | + | |
| 3830 | + | |
| 3831 | + | |
| 3832 | + | |
| 3833 | + | |
| 3834 | + | |
| 3835 | + | |
| 3836 | + | |
| 3837 | + | |
| 3838 | + | |
| 3839 | + | |
| 3840 | + | |
| 3841 | + | |
| 3842 | + | |
| 3843 | + | |
| 3844 | + | |
| 3845 | + | |
| 3846 | + | |
3837 | 3847 | | |
3838 | | - | |
3839 | | - | |
| 3848 | + | |
| 3849 | + | |
3840 | 3850 | | |
3841 | 3851 | | |
3842 | 3852 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
| 225 | + | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
230 | 274 | | |
231 | 275 | | |
232 | 276 | | |
| |||
616 | 660 | | |
617 | 661 | | |
618 | 662 | | |
619 | | - | |
620 | | - | |
621 | | - | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
622 | 736 | | |
623 | | - | |
| 737 | + | |
624 | 738 | | |
625 | 739 | | |
626 | 740 | | |
627 | | - | |
628 | | - | |
629 | | - | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
630 | 744 | | |
631 | 745 | | |
632 | 746 | | |
| |||
0 commit comments