-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Handle substring in string itself in IDE0057 #48321
Conversation
if (invocation.Expression is IdentifierNameSyntax) | ||
{ | ||
// Substring(...) -> this[...] | ||
return ElementAccessExpression(ThisExpression(), argumentList); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
This one should be simple enough. Not sure what the CI failure is. |
Thanks! |
Fixes #38055