-
Notifications
You must be signed in to change notification settings - Fork 124
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
Duplicated diagnostic causing crash on DefaultDiagnosticConsoleFormatter #729
Comments
I think that I have looked into this in the past, before it resulted in a crash. We are also tracking this issue as rdar://79991171. I'll associate that radar with this issue so that people who find the radar can find this issue instead. I may have some old notes that may still be relevant. Let me see if I can find them. |
I couldn't find my old notes but I vaguely remember that I got this far... It looks like the links is resolved for the full content but for both "chunks" (the in-source doc comment and the extensions code). We need to process both chunks so that we can get diagnostics to the right places but I think that the I remember trying to change this and that it wasn't as easy as I thought but I don't remember what issues I encountered. |
Can we filter such duplicated diagnostic by checking the source url matching? Here is my draft PR #733 Before the PR:Emit 2 duplicated diagnostic: the Extension Markdown file and the source Swift file And then crash on DefaultDiagnosticConsoleFormatter After the PR:Only emit one diagnostic for the actual location - the Extension file. And the DefaultDiagnosticConsoleFormatter will not crash
If you agree on this general idea of the PR, I'll continue to work on it to add the test case. @d-ronnqvist |
That's sounds like a good idea. |
The test case is added and the PR is ready for a review. @d-ronnqvist |
This issue is not fully resolved. Encounter same crash recently.
I can reproduce the issue on both release/5.10 and main using the large repo code. But when I try to prepare a minimal reproducible package. It only crash for Xcode 15.3 or release/5.10 branch of swift-docc not on main branch. I guess we have fixed part of the issue again on some commits on main branch.
I'll work on preparing a crash example case which will also crash on main branch of swift-docc later this week. |
A reproducible package
It is still due to duplicated diagnostic problem (Emit the same issue in Demo.swift and Demo.md file) |
A quick fix for this issue is add similar logic to the following position or But it feels like this does not seem to be the right direction, we just enumerate the holes. Similar crashes are still possible in the future. cc @d-ronnqvist |
I agree that fixing individual places that create out-of-bounds diagnostic ranges doesn't address the root cause. As a first step to a long term fix we should make sure that the diagnostic formatter handles all out-of-bounds diagnostic ranges instead of assuming that they're valid. I opened #947 to do this. After that, @patshaughnessy and I talked about possible changes to design away the need to do two MarkupReferenceResolver passes. If those ideas pan out it will remove these duplicate diagnostics. |
Description
See detail on #678 (comment)
Checklist
main
branch of this package.Expected Behavior
Only emit one diagnostic for the actual location - the Extension file.
Actual behavior
Emit 2 duplicated diagnostic: the Extension Markdown file and the source Swift file
Steps To Reproduce
Change
eat(_:quantity:)
toeat(_:quantity:extraLog:)
and build documentation for SlothCreator.Swift-DocC Version Information
5.9.0
Swift Compiler Version Information
The text was updated successfully, but these errors were encountered: