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

Handle substring in string itself in IDE0057 #48321

Merged
merged 4 commits into from
Nov 3, 2020

Conversation

huoyaoyuan
Copy link
Member

Fixes #38055

if (invocation.Expression is IdentifierNameSyntax)
{
// Substring(...) -> this[...]
return ElementAccessExpression(ThisExpression(), argumentList);
Copy link
Member

Choose a reason for hiding this comment

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

i'd prefer we also validate that we're inside the string class. Or, if htis is handling more than just being inside System.String and is handling things like .Slice inside other types, then we can have a simpler test that just shows that.

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'd prefer the latter, adding a test for slicing on self.

@jinujoseph jinujoseph added Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee. labels Oct 8, 2020
@jinujoseph jinujoseph added this to InQueue in IDE: CommunityPR via automation Oct 8, 2020
@jinujoseph jinujoseph moved this from InQueue to BuddyAssigned in IDE: CommunityPR Oct 8, 2020
@huoyaoyuan
Copy link
Member Author

This one should be simple enough. Not sure what the CI failure is.

IDE: CommunityPR automation moved this from BuddyAssigned to LGTM Nov 2, 2020
@CyrusNajmabadi CyrusNajmabadi merged commit 8fd2af1 into dotnet:master Nov 3, 2020
IDE: CommunityPR automation moved this from LGTM to Completed Nov 3, 2020
@ghost ghost added this to the Next milestone Nov 3, 2020
@CyrusNajmabadi
Copy link
Member

Thanks!

@huoyaoyuan huoyaoyuan deleted the ide0057-string-member branch November 3, 2020 03:06
@allisonchou allisonchou modified the milestones: Next, 16.9.P2 Nov 24, 2020
@jinujoseph jinujoseph moved this from Completed-Sprint179 to Completed 2020 in IDE: CommunityPR Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee.
Projects
IDE: CommunityPR
  
Completed 2020
Development

Successfully merging this pull request may close these issues.

IDE0057 incorrectly handles substrings on String itself
4 participants