-
Notifications
You must be signed in to change notification settings - Fork 414
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
FixItApplier crash when generating diagnostics for whole tree but applying them to a subtree #2749
Comments
Synced to Apple’s issue tracker as rdar://132355564 |
If you could share an implementation of the |
The current main branch with the test that I mentioned in the issue should work out to reproduce the issue. I'll try to take another look at this in the next few days if you're not in a rush to get this fixed, though. |
This repository btw 😅 |
The issue is that There are multiple ways to fix this at its root cause:
I’d like to keep the issue open for that but you should be able to fix your crash by detaching the statement before generating diagnostics ParseDiagnosticsGenerator.diagnostics(for: statement.detached) Also unrelated, I saw that you’re checking |
One reason that I'm to passing all diagnostics to I think this will be a nice feature, generally. Even the current Xcode behavior is that when you apply one FixIt which moves lines around, the second possible FixIt won't notice that lines have moved and it'll modify the wrong lines (if you don't build again to get fresh diagnostics). |
Soooo.... I'm also aware of existence of |
With the And the reason that |
the canImport was actually true. Even though SwiftPM pulled 510, not 6xx. |
Oh, that was probably because of a stale build directory then that still contained the module for SwiftSyntax600. Cleaning should make it evaluate to |
Tested it now, and you're right, just an inconsistency. |
Description
The crash:
Steps to Reproduce
Note that
@Enumerator()
does not modify the code at all in this case.I'm just sharing the exact code otherwise I think this should be reproducible not that hard.
Late night here, if I were to wait till tomorrow I'm pretty sure I would have ended up not reporting this bug, let me know if reproducing this doesn't end up being easy.
The exact code:
How FixIts are applied in the pipeline of the macro:
Edit: Added
PlaceholderDetector
for the sake of being complete, although it doesn't matter.The text was updated successfully, but these errors were encountered: