Skip to content

Fix obsolete warning for delegate creation#47332

Merged
333fred merged 18 commits intodotnet:masterfrom
Youssef1313:patch-25
Oct 5, 2020
Merged

Fix obsolete warning for delegate creation#47332
333fred merged 18 commits intodotnet:masterfrom
Youssef1313:patch-25

Conversation

@Youssef1313
Copy link
Member

@Youssef1313 Youssef1313 commented Sep 1, 2020

Fixes #47308

@Youssef1313 Youssef1313 requested a review from a team as a code owner September 1, 2020 11:03
@Youssef1313 Youssef1313 marked this pull request as draft September 1, 2020 11:12
@Youssef1313
Copy link
Member Author

The approach I took doesn't seem to work, and also it's very bad even if it works.
But going to mark as ready for review as I'm stuck here.

@Youssef1313 Youssef1313 marked this pull request as ready for review September 1, 2020 13:40
@333fred
Copy link
Member

333fred commented Sep 1, 2020

I believe you'll want to make a similar change to what I'm doing here: https://github.com/dotnet/roslyn/pull/47311/files#diff-098c83159f29ad4768223015c6455902R1123. I'd prefer if we put this PR on hold until after the UnmanagedCallersOnly stuff is merged to prevent conflicts though, if you don't mind :).

We'll also need to update https://github.com/dotnet/roslyn/blob/master/docs/compilers/CSharp/Compiler%20Breaking%20Changes%20-%20post%20VS2019.md, and I'm going to send an email to the compat council to see if this is a break that we'd accept.

@333fred 333fred added Area-Compilers Community The pull request was submitted by a contributor who is not a Microsoft employee. Need Design Review The end user experience design needs to be reviewed and approved. labels Sep 1, 2020
@333fred
Copy link
Member

333fred commented Sep 15, 2020

Alright @YairHalberstadt, it seems like this is a change we'd accept. Feel free to continue working on it.

@333fred 333fred removed the Need Design Review The end user experience design needs to be reviewed and approved. label Sep 15, 2020
@YairHalberstadt
Copy link
Contributor

Did you mean @Youssef1313?

@333fred
Copy link
Member

333fred commented Sep 15, 2020

I did, sorry Yair 😅

Comment on lines +69 to +73
if (source is BoundDelegateCreationExpression delegateCreationExpression &&
delegateCreationExpression.MethodOpt is not null)
{
ReportDiagnosticsIfObsolete(diagnostics, delegateCreationExpression.MethodOpt, delegateCreationExpression.Argument.Syntax, hasBaseReceiver: false);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@333fred I'm unsure of this is how you'd prefer to fix that. Can you take a look?

Copy link
Member

Choose a reason for hiding this comment

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

I believe it would be better to put this check in MethodGroupConversionHasErrors, like the change to report UnmanagedCallersOnly errors.


In reply to: 490915535 [](ancestors = 490915535)

Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

LGTM (commit 8). @dotnet/roslyn-compiler for a second review of this community PR please.

Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

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

LGTM (commit 17), other than the whitespace

Co-authored-by: Fred Silberberg <fred@silberberg.xyz>
@333fred
Copy link
Member

333fred commented Sep 25, 2020

Just in case, I'm going to do a test VS insertion with this change and see if it breaks anything horribly.

@333fred
Copy link
Member

333fred commented Sep 25, 2020

Test insertion (Microsoft-internal accessible only) https://devdiv.visualstudio.com/DevDiv/_git/VS/pullrequest/277471

@333fred
Copy link
Member

333fred commented Oct 2, 2020

We've had some infrastructure fires over the past week, so I'm redoing my smoke test. Will update when it's done.

@Youssef1313
Copy link
Member Author

@333fred I'm not sure what the couple of previous comments mean

@333fred
Copy link
Member

333fred commented Oct 2, 2020

Nothing you need to do. I'm testing to make sure that this doesn't break the VS build.

@333fred
Copy link
Member

333fred commented Oct 5, 2020

Alright, just did another test build and VS continues to work correctly: https://devdiv.visualstudio.com/DevDiv/_git/VS/pullrequest/279194. @jaredpar, I'd like sign off from you on this change before I merge.

@333fred
Copy link
Member

333fred commented Oct 5, 2020

Talked with Jared offline, we're good.

@333fred 333fred merged commit f4189a2 into dotnet:master Oct 5, 2020
@ghost ghost added this to the Next milestone Oct 5, 2020
@333fred
Copy link
Member

333fred commented Oct 5, 2020

Thanks @Youssef1313!

@Youssef1313 Youssef1313 deleted the patch-25 branch October 6, 2020 00:10
@Cosifne Cosifne modified the milestones: Next, 16.9.P1 Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers Community The pull request was submitted by a contributor who is not a Microsoft employee.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Obsolete diagnostics not reported for delegate creation

5 participants