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 report unused parameters for trivial throw-only methods #42408

Merged
9 commits merged into from
Mar 14, 2020

Conversation

CyrusNajmabadi
Copy link
Member

Fixes #41236

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner March 14, 2020 01:00
if (!(firstBlock is IBlockOperation block))
return false;

var explicitOperations = block.Operations.WhereAsArray(op => !op.IsImplicit);
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't this create a copy of almost every operation block array? Seems expensive for a filter check.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a great point. I'll tweak.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Auto-approval

@ghost ghost merged commit 65a15a5 into dotnet:master Mar 14, 2020
@CyrusNajmabadi CyrusNajmabadi deleted the unusedParamThrow branch March 14, 2020 03:57
@jinujoseph jinujoseph added this to the 16.6.P2 milestone Mar 15, 2020
mavasani added a commit to mavasani/roslyn that referenced this pull request Dec 24, 2021
Fixes dotnet#56317
dotnet#42408 handled bailing out reporting unused params for methods that only have a throw operation in its body. It missed a case where the throw might be wrapped within a conversion wrapped within a return operation, which happens when the method returns a non-void type.
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IDE0060 with NotImplementedException
4 participants