Skip to content

Support extension operators in Linq Expression Trees #78942

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

Merged
merged 1 commit into from
Jun 13, 2025

Conversation

AlekseyTs
Copy link
Contributor

@AlekseyTs AlekseyTs commented Jun 12, 2025

Relates to test plan #76130

@AlekseyTs AlekseyTs requested review from jjonescz and jcouv June 12, 2025 18:03
@AlekseyTs AlekseyTs requested a review from a team as a code owner June 12, 2025 18:03
@AlekseyTs AlekseyTs added Area-Compilers Feature - Extension Everything The extension everything feature labels Jun 12, 2025
@jcouv jcouv self-assigned this Jun 12, 2025
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 (commit 1)

{
// PROTOTYPE: Communicate to LDM
// An expression tree factory isn't happy in this case. It throws
// System.ArgumentException : The user-defined operator method 'op_BitwiseOr' for operator 'OrElse' must have associated boolean True and False operators.
Copy link
Member

@jjonescz jjonescz Jun 13, 2025

Choose a reason for hiding this comment

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

Would it work if there were corresponding op_True and op_False operators also defined in the extension class? #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.

Would it work if there were corresponding op_True and op_False operators also defined in the extension class?

We wouldn't get here if there were not.

}
}

// PROTOTYPE: Test unsafe and partial, IOperation/CFG , Linq expression tree, Nullable analysis
// Assert result of operator for basic consumption scenarios
// Cover ErrorCode.ERR_ExtensionDisallowsMember for conversion operators
// Ref safety analysis?
// "An extension operator may not have the same signature as a predefined operator." not yet implemented
Copy link
Member

@jjonescz jjonescz Jun 13, 2025

Choose a reason for hiding this comment

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

Why was this prototype comment removed? #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.

Why was this prototype comment removed?

LDM decided on Monday to drop this rule.

@AlekseyTs AlekseyTs merged commit 67d422c into dotnet:features/extensions Jun 13, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Feature - Extension Everything The extension everything feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants