-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Rewrite void_return rule using SwiftSyntax #4158
Conversation
6f1b76d
to
2004967
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.
Lovely
|
||
correctionPositions.append(tuple.positionAfterSkippingLeadingTrivia) | ||
|
||
var returnType = SyntaxFactory.makeTypeIdentifier("Void") |
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.
TIL about SyntaxFactory
@marcelofabri can we merge this? |
I need to think about what to do with these violations. My current thinking is that it's fine to have them fixed here and update |
Looking at the OSSCheck report, it looks like all the violations are safe because they're in closures with enough parent type context to infer the void return value. That's not the case with the current implementation of |
+1! I can't speak to the specifics of this rewrite, but it does fix a false positive that currently exists on main, and which might be good to add to the test cases: func foo() -> () async -> Int Failure on main:
|
bump - I just rediscovered this thread because I dusted off an old project and found that this was still the case |
Is there anything missing or something I could help with to get this PR merged? |
Rule has been rewritten in #5351. |
I'm not at a computer right now so I can't test it, but do you know if it now correctly handles the case I mentioned above? |
No description provided.