-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add feature to convert classic extension methods to the new 'extension' form in C# 14. #77660
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 feature to convert classic extension methods to the new 'extension' form in C# 14. #77660
Conversation
|
This PR modifies public API files. Please follow the instructions at https://github.com/dotnet/roslyn/blob/main/docs/contributing/API%20Review%20Process.md for ensuring all public APIs are reviewed before merging. |
| /// </summary> | ||
| public abstract SyntaxNode WithModifiers(SyntaxNode declaration, DeclarationModifiers modifiers); | ||
| public SyntaxNode WithModifiers(SyntaxNode declaration, DeclarationModifiers modifiers) | ||
| => WithModifiers<SyntaxNode>(declaration, modifiers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a safe change. it is ok to replace an abstract method with a non-abstract one in a type that isn't publicly derivable. in other words, we own all the derivations and can fix them up. and all callers who are calling this method virtually will continue to work even witha non-virtual method in the same slot as before.
| => WithModifiers<SyntaxNode>(declaration, modifiers); | ||
|
|
||
| internal abstract TSyntaxNode WithModifiers<TSyntaxNode>(TSyntaxNode declaration, DeclarationModifiers modifiers) | ||
| where TSyntaxNode : SyntaxNode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by having this method, we allow internal callers to be strongly typed, allowing them to have to avoid casting the return type back to the type of hte node they passed in.
b798cfc
into
dotnet:features/extensions
Looks like this:
And:
Relates to test plan #76130