Skip to content

Do not report unused parameters for trivial throw-only methods#42408

Merged
9 commits merged intodotnet:masterfrom
CyrusNajmabadi:unusedParamThrow
Mar 14, 2020
Merged

Do not report unused parameters for trivial throw-only methods#42408
9 commits merged intodotnet:masterfrom
CyrusNajmabadi:unusedParamThrow

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

Fixes #41236

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

var explicitOperations = block.Operations.WhereAsArray(op => !op.IsImplicit);
Copy link
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown

@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