-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Extensions: rewrite delegate and function pointer creations #77378
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
Conversation
|
@jcouv, @dotnet/roslyn-compiler For the second review. |
| { | ||
| return updateDelegateCreation(node, VisitMethodSymbolWithExtensionRewrite(rewriter, node.MethodOpt), (BoundExpression)rewriter.Visit(node.Argument), rewriter.VisitType(node.Type)); | ||
|
|
||
| static BoundNode updateDelegateCreation(BoundDelegateCreationExpression node, MethodSymbol? methodOpt, BoundExpression argument, TypeSymbol type) |
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.
nit: consider inlining so that the Update call is at the top-level or change the local function returns isExtensionMethod value. I'm happy to do it for you in a follow-up PR if it's any inconvenience and you're okay with it #Closed
jcouv
left a comment
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.
LGTM Thanks (iteration 1)
| // NOTE: Delegate type compatibility is important, but is not part of the existence check. | ||
|
|
||
| Debug.Assert(method.ParameterCount == parameterCount + (methodGroup.IsExtensionMethodGroup ? 1 : 0)); | ||
| bool isExtensionMethod = methodGroup.IsExtensionMethodGroup && method.ContainingSymbol is not NamedTypeSymbol { IsExtension: true }; |
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.
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.
nit: consider
!method.GetIsNewExtensionMember()
I'll follow up in a different PR
Never mind. There's a merge commit. I'll fixup in next PR In reply to: 2699072400 Refers to: src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionTests.cs:2688 in 7445c6d. [](commit_id = 7445c6d, deletion_comment = False) |
I didn't make changes here. You are probably looking at a diff created by a merge with your changes In reply to: 2699072400 Refers to: src/Compilers/CSharp/Test/Emit3/Semantics/ExtensionTests.cs:2688 in de4d8bb. [](commit_id = de4d8bb, deletion_comment = False) |
jcouv
left a comment
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.
LGTM Thanks (iteration 5)
Test plan #76130