Skip to content

Fix unused param (IDE0060) false positive#58480

Merged
mavasani merged 2 commits intodotnet:mainfrom
mavasani:IDE0060_FP
Dec 24, 2021
Merged

Fix unused param (IDE0060) false positive#58480
mavasani merged 2 commits intodotnet:mainfrom
mavasani:IDE0060_FP

Conversation

@mavasani
Copy link
Copy Markdown
Contributor

Fixes #56317

#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.

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.
@mavasani mavasani added this to the 17.1 milestone Dec 24, 2021
@mavasani mavasani requested review from a team and CyrusNajmabadi December 24, 2021 06:21
/// <returns>The inner non conversion operation or the starting operation if it wasn't a conversion operation.</returns>
public static IOperation? WalkDownConversion(this IOperation? operation)
{
while (operation is IConversionOperation conversionOperation)
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.

do you only need to do this if it's implicit?

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.

Likely for the case in this bug, but probably we want to do it for all conversions for this extension method.

@mavasani mavasani merged commit 05b2c02 into dotnet:main Dec 24, 2021
@ghost ghost modified the milestones: 17.1, Next Dec 24, 2021
@mavasani mavasani deleted the IDE0060_FP branch December 24, 2021 16:21
@Cosifne Cosifne modified the milestones: Next, 17.1.P3 Jan 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IDE0060 (unused param) with NotImplementedException

3 participants