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

Do not use overload resolution for expression tree conversion #75427

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

AlekseyTs
Copy link
Contributor

Related to #74275.

@AlekseyTs AlekseyTs requested a review from a team as a code owner October 8, 2024 01:47
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Oct 8, 2024

private BoundExpression ExprFactory(string name, ImmutableArray<TypeSymbol> typeArgs, params BoundExpression[] arguments)
{
return _bound.StaticCall(_ignoreAccessibility ? BinderFlags.IgnoreAccessibility : BinderFlags.None, ExpressionType, name, disallowExpandedNonArrayParams: true, typeArgs, arguments);
Copy link
Member

@jjonescz jjonescz Oct 8, 2024

Choose a reason for hiding this comment

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

It looks like we no longer use _ignoreAccessibility. Is that an unintended behavior change? Also consider removing the unused field. #Resolved

Copy link
Contributor Author

@AlekseyTs AlekseyTs Oct 8, 2024

Choose a reason for hiding this comment

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

It looks like we no longer use _ignoreAccessibility. Is that an unintended behavior change?

Definitions of well known types and members must be accessible. I am not sure why this field was used. I assume that, if there were specific scenarios in mind, there would be tests that would fail. BTW, the ExpressionType in which the factory methods are, was aways a well known type.

Also consider removing the unused field.

Will do.

{
if (_binder is null || _binder.Flags != flags)
{
_binder = new SyntheticBinderImpl(this).WithFlags(flags);
Copy link
Member

@jjonescz jjonescz Oct 8, 2024

Choose a reason for hiding this comment

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

Can we remove SyntheticBinderImpl class now? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we remove SyntheticBinderImpl class now?

Yes

@@ -337,6 +337,23 @@ internal enum WellKnownType

System_Runtime_CompilerServices_ParamCollectionAttribute,

System_Linq_Expressions_BinaryExpression,
Copy link
Member

@jjonescz jjonescz Oct 8, 2024

Choose a reason for hiding this comment

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

Because we use well-known types now, there might be some behavior changes, right? For example, having ambiguous BinaryExpressions (so we won't resolve the well-known type for it), we now won't be able to bind Expression.Binary whereas previously we could. I'm not sure it matters though. #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because we use well-known types now, there might be some behavior changes, right? For example, having ambiguous BinaryExpressions (so we won't resolve the well-known type for it), we now won't be able to bind Expression.Binary whereas previously we could.

That is correct.

Copy link
Member

Choose a reason for hiding this comment

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

This only happens when customers define a their own types in the System namespace though. That is indeed a break but it's generally one that we are okay with. Defining types in the System namespace, particularly when they clash with the ones in corelib is not recommended for this very reason

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM Thanks (iteration 2)

@AlekseyTs AlekseyTs requested a review from jjonescz October 8, 2024 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants