Skip to content

Conversation

roji
Copy link
Member

@roji roji commented Nov 16, 2024

Fixes #35095

@roji roji requested a review from a team November 16, 2024 07:45
}

private static Expression ConvertIfNeeded(Expression expression, Type type)
=> expression.Type == type ? expression : Convert(expression, type);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is exact type match correct here? Should derived types be allowed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, AFAIK there are scenarios where a Convert node is indeed needed when inserting a node of type Subclass into an expected context of Superclass... In any case, the worse case here from the exact type match is an extra unneeded Convert node where it shouldn't be needed - this still needs to be handled (since the user may always insert it explicitly via a cast)... So I think it's OK..

@roji roji merged commit 3cae7a8 into dotnet:main Nov 25, 2024
7 checks passed
@roji roji deleted the FuncletizerConvert branch November 25, 2024 09:50
roji added a commit to roji/efcore that referenced this pull request Nov 25, 2024
roji added a commit that referenced this pull request Nov 26, 2024
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.

[Regression] Exception on query comparing nullable int with ?? fallback on EF Core 9

2 participants