-
Notifications
You must be signed in to change notification settings - Fork 1.1k
SemanticDB diagnostics missing #17535
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
Comments
I created very quick try, but it seems we are missing the warnings. Not sure how to extract the diagnostics from context. Tried blindly to use https://github.com/lampepfl/dotty/compare/main...tgodzik:dotty:diags-semanticdb?expand=1 Anyone can help out here? |
Now this seems to work if a StoreReporter is used, but any reporter that just prints the information right away will lose the info. What is the least hacky way to get all warnings even if they were already reported? |
@tanishiking Can you look at that in your spare time? I think you had some experience with SemanticDB in the past |
I think we might need to some additional output from someone closer to the core compiler. If we have a ConsoleReporter there is no way to get the warnings from pending messages, so would be great to know if we can work around it. @szymon-rd had worked recently with unused warnings, maybe he knows something? |
I can take a look on SemanticDB generation side, but it would be great if someone knows how can we retrieve the diagnostics via |
We can change how we aggregate diagnostics in the CheckUnused and linting; that change could be introduced in a patch (3.3.1?). What I find interesting is that, if I understand correctly, the semanticdb file is extracted after the typer. We don't have the lining diagnostic information at that point yet. Maybe that's even the cause of it missing? |
Och, when is the linter run then? In which phase? |
Most of the linting is run after the typer, but some linting requires information from inlining. Look where the |
Thanks @szymon-rd ! We may want to add an extra phase that extract the diagnostics and write the SemanticDB file. |
fix #17535 ## What this PR does This PR splits `ExtractSemanticDB` to `PostTyper` and `PostInlining` (as `ChechUnused` does). - The `PostTyper` phase - It extracts SemanticDB information such as symbol definitions, symbol occurrences, type information, and synthetics. - ~**This phase does not write the information to a `.semanticdb` file**; instead, it attaches the SemanticDB information to the top-level tree.~ - And write `.semanticdb` file. - The `PostInlining` phase - It extracts diagnostics from `ctx.reporter` and attaches them to the SemanticDB information extracted in the `PostTyper` phase. - Afterwards, it updates the SemanticDB to a `.semanticdb` file (if there's warning in the file). - **We need to run this phase after the `CheckUnused.PostInlining` phase so that we can extract the warnings generated by "-Wunused".** Also, - Reporter now stores `warnings` in addition to `errors` - Tweaked SemanticDBTest to show the generated diagnostics to `metac.expect` ### Concerns - Since we attach the SemanticDB information to the top-level tree, it lives in-memory during the compilation which may leads to more memory usage for compilation - Now, Reporter stores all warnings in addition to errors (to convey the warnings across phases), which also may cause some more memory consumption.
Compiler version
3.3.0-RC6 (but I believe this is not a regression, and is reproducible for any 3.x)
Minimized code
Output
Expected
The text was updated successfully, but these errors were encountered: