-
Notifications
You must be signed in to change notification settings - Fork 10.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
[AST] Fix comment merging #39086
[AST] Fix comment merging #39086
Conversation
@swift-ci please test |
Note that there's some functionality change here - block comments are no longer merged. This makes sense to me, but let me know if you disagree. EDIT: Ah. I missed those tests (saw
are merged. Even more weird that the brief comment includes both of them where as it wouldn't include
|
Build failed |
Build failed |
(Could clean up SR-6605 that I, er, abandoned) |
789d7e6
to
aa89681
Compare
@swift-ci please test |
I had a look at the source compatibility suite and there's no case where we'd want to merge blocks (mixed or otherwise) or comments with a newline in-between. Not merging is marginally better since it does fix a few cases, so I've gone ahead and modified the tests to reflect that. So note that the behaviour is now:
This is a little different to the Clang side, which does keep consecutive comments (including mixed), hence only the offset/length change in There's no instance of multiple block doc comments in a row or mixed block/line, so I could be convinced to keep that if anyone thinks it's worth it. Not supporting that case makes the code slightly simpler and easier to understand though. |
Build failed |
Build failed |
I forgot to look for |
`toRawComment` takes a range of line/block ordinary/doc comments and converts them into a `RawComment` that should represent the doc comment for the attached decl. Fix a bunch of unhandled cases: - A prior comment with whitespace in between would cause the first line of the next comment to be missed - A gyb comment would attach the prior comment, regardless of whitespace inbetween Resolves rdar://82414210
aa89681
to
22f5983
Compare
@swift-ci please test |
toRawComment
takes a range of line/block ordinary/doc comments andconverts them into a
RawComment
that should represent the doc commentfor the attached decl.
Fix a bunch of unhandled cases:
line of the next comment to be missed
whitespace inbetween
Resolves rdar://82414210