-
Notifications
You must be signed in to change notification settings - Fork 439
Replace string-based keyword references with Keyword
enum in CodeGeneration
#2056
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
Replace string-based keyword references with Keyword
enum in CodeGeneration
#2056
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.
Wohooo. More type safety 🤩
.keyword(.`private`), | ||
.keyword(.`fileprivate`), | ||
.keyword(.`internal`), |
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.
Do these even need to be backpacked here. IIRC the only case that needs to be backtracked on the call side is init
.
Same in a couple more places
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.
Great point thank you for it! ❤️ Just pushed the corrected version.
1f99046
to
57d105d
Compare
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.
Thanks for your continued work to clean up CodeGeneration @Matejkob.
@swift-ci Please test |
Thanks for this and other code reviews @ahoppen. Sending much love! ❤️ |
@Matejkob Looks like there’s a merge conflict now. Could you rebase the PR? |
…ration The CodeGeneration module was previously referring to keywords using string-based references like switch, which is not idiomatic Swift. To make the code more concise and in line with Swift's best practices, this commit introduces a Keyword enum in the KeywordSpec.swift file. Now, instead of string-based references, the new Keyword enum contains all the possible keyword kinds. It also includes a computed property that returns the corresponding KeywordSpec for a given keyword, allowing for more concise and idiomatic references. The code has been refactored to replace all string-based keyword references with members of the newly introduced Keyword enum. Associated tests have also been updated to reflect these changes.
Head branch was pushed to by a user without write access
57d105d
to
9c270a7
Compare
@ahoppen I've just resolved the merge conflict. |
@swift-ci Please test |
@swift-ci Please test Windows |
1 similar comment
@swift-ci Please test Windows |
Follow-up PR to #2006
Resolves #2008