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

Add missing Converts when simplifying in funcletizer #35122

Merged
merged 1 commit into from
Nov 25, 2024

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
@@ -2101,6 +2106,9 @@ static Expression RemoveConvert(Expression expression)
}
}

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

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