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

Fix unused param (IDE0060) false positive #58480

Merged
merged 2 commits into from
Dec 24, 2021
Merged

Conversation

mavasani
Copy link
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 CyrusNajmabadi and a team 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
Member

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