-
Notifications
You must be signed in to change notification settings - Fork 248
Support IfConfigDecl clauses in UseEnumForNamespacing #113
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
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.
Thanks for tackling this!
The implementation looks good. For completeness' sake, can you add a couple more tests to make sure we've covered everything?
- A test that uses an
#else
instead of an#elseif
- A test that involves two nested
#if
blocks in some fashion to verify that we recurse through them properly.
Based on the implementation I think both of those should work, but it'll be good to have the extra test coverage for potential future changes.
d159057
to
722e36d
Compare
It looks like the commit history here has commits from the 5.1 branch included in it, which may be the case if you were doing work there. Can you clean that up? |
Anything inside a IfConfigDecl was ignored when determining if a struct could be an enum. This looks for IfConfigDeclSyntax in the MemberDeclListSyntax and only turns the struct into an enum when all of the clauses have namespace compatible members. Fixes: https://bugs.swift.org/browse/SR-11830
@allevato Yeah. I'm in the middle of adding those extra tests. I wanted to actually try and test against master so I've been trying to get the Is the only way to get it to build it from source? |
722e36d
to
54e5a51
Compare
Should be fixed now. Although I still haven't been able to test this against master 😞 |
You can still download that snapshot from Swift.org, it's just hard to find since the link has long-since been removed from the UI. You can just change the date in the download URL to match any snapshot. For example, here's the link for 2019-09-26-a snapshot for use in Xcode: |
@dylansturg is it worth updating the README with that link? |
I think we want to get away from that old snapshot and onto a newer one that supports the latest Swift-Syntax soonish™️ so it may not be relevant for too much longer. |
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.
Sorry for the delay—the new tests look great, thanks!
I just pulled the change down myself and tested it against 09-26 to verify, and everything checks out, so this is good to merge.
Anything inside a IfConfigDecl was ignored when determining if a struct
could be an enum. This looks for IfConfigDeclSyntax in the
MemberDeclListSyntax and only turns the struct into an enum when all of
the clauses have namespace compatible members.
Fixes: https://bugs.swift.org/browse/SR-11830