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
#56350 - Give Identifier a hasUnderscoredNaming() helper #72048
Conversation
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.
Thank you, @Jamezzzb. Looks good to me. One tiny suggestion to clean things up a little further.
include/swift/Sema/CSFix.h
Outdated
auto name = PropertyWrapper->getName(); | ||
return !name.hasUnderscoredNaming(); |
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.
We could shorten this even further now
auto name = PropertyWrapper->getName(); | |
return !name.hasUnderscoredNaming(); | |
return !PropertyWrapper->getName().hasUnderscoredNaming(); |
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.
@ahoppen Thanks! I like this better but hadn't thought of it. With suggestions is there a preference whether I do it locally so I can squash or is it okay to apply it here? In terms of keeping the commit history clean.
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.
Squashing would be appreciated.
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.
Alright done. Thank you.
…aces currently using str().startsWith, change it to use the new helper.
@swift-ci Please smoke test |
#56350
I gave Identifier a hasUnderscoredNaming() helper. Which is just:
I put it right under
hasDollarPrefix
figuring that made the most sense. I also replaced parts of the code usingstr().startsWith("_")
to use the new helper. I think the helper makes intention more clear and it is definitely more convenient (especially with code completion).I then reran swift/test:
There are 6 failures but these same tests always fail for me. I haven't looked too much into the failures (one is a module not being found, another is I am missing some python stuff) but I don't think they are related to the changes.