Skip to content

Add a missing check for AccessorDeclaration#51409

Merged
Cosifne merged 1 commit intodotnet:release/dev16.10from
Cosifne:dev/shech/checkEmptyAccessor
Feb 24, 2021
Merged

Add a missing check for AccessorDeclaration#51409
Cosifne merged 1 commit intodotnet:release/dev16.10from
Cosifne:dev/shech/checkEmptyAccessor

Conversation

@Cosifne
Copy link
Member

@Cosifne Cosifne commented Feb 23, 2021

Fix the bug found by Sam and it is caused because a missing check.
Also, add a few tests around the braces removal scenarios.

Tracking: #51404

@Cosifne Cosifne requested a review from sharwell February 23, 2021 01:29
@Cosifne Cosifne requested a review from a team as a code owner February 23, 2021 01:29
@ghost ghost added the Area-IDE label Feb 23, 2021
@Cosifne Cosifne changed the base branch from master to release/dev16.10 February 23, 2021 01:33
@Cosifne Cosifne requested review from a team as code owners February 23, 2021 01:33
@Cosifne Cosifne requested a review from a team February 23, 2021 01:33
@Cosifne Cosifne changed the base branch from release/dev16.10 to master February 23, 2021 01:34
@Cosifne Cosifne force-pushed the dev/shech/checkEmptyAccessor branch from 4e3ae9e to b7f96f2 Compare February 23, 2021 01:37
@Cosifne Cosifne changed the base branch from master to release/dev16.10 February 23, 2021 01:38
@333fred 333fred removed request for a team February 23, 2021 01:54
@Cosifne
Copy link
Member Author

Cosifne commented Feb 23, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@Cosifne Cosifne removed the request for review from a team February 23, 2021 04:06
@Youssef1313
Copy link
Member

@Cosifne Does this fix #51404?

@Cosifne
Copy link
Member Author

Cosifne commented Feb 23, 2021

@Cosifne Does this fix #51404?

@Youssef1313 Yes, I just realized I paste a wrong link here

@Cosifne
Copy link
Member Author

Cosifne commented Feb 23, 2021

I should probably also ping @CyrusNajmabadi to review this

@CyrusNajmabadi
Copy link
Contributor

L:ooking

}
}
}
}");
Copy link
Contributor

Choose a reason for hiding this comment

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

can you explain how i should read these tests? i'm not really getting what they're trying to indicate.

Copy link
Contributor

Choose a reason for hiding this comment

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

The first string passed to Test is the resulting string you get if you invoke Smart Break Line at any of the positions marked with $$ in the second string.

Copy link
Member Author

Choose a reason for hiding this comment

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

:) Sam has answered the question

Copy link
Contributor

Choose a reason for hiding this comment

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

Ick. That's super confusing :-)

=> accessorDeclarationNode.Body != null
&& accessorDeclarationNode.Body.Statements.IsEmpty()
&& accessorDeclarationNode.ExpressionBody == null
&& accessorDeclarationNode.Parent != null
Copy link
Contributor

Choose a reason for hiding this comment

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

technically, this check isn't necessary. teh only thing that ever has a null parent is structured trivia or a compilation unit.

Copy link
Member Author

Choose a reason for hiding this comment

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

:) I was just always trying to avoid use the '!' operator to suppress the null check. But indeed its parent is not null here. Given this PR is probably going to QB I feel it is better to keep the check here. I could open a PR targeting master to remove the check here

@Cosifne
Copy link
Member Author

Cosifne commented Feb 24, 2021

QB has approved the bug. And this needs an insertion. FYI @RikkiGibson

@Cosifne Cosifne merged commit 9d50e97 into dotnet:release/dev16.10 Feb 24, 2021
@Cosifne Cosifne deleted the dev/shech/checkEmptyAccessor branch February 24, 2021 00:34
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.

4 participants