-
Couldn't load subscription status.
- Fork 1.1k
Emitted Warnings from the compiler should have assigned error identifier. #19698
-
As of last year, each dotty Error comes with an assigned identifier. It was added as part of the actionable diagnostics #14904.
This allows us to identify errors in other tools, by comparing the codes. Previously we did this with regex. This discussion is a place where we will discuss adding such identifiers to all warnings we emit.
The motivation behind it is almost the same as with error codes:
- we can identify warnings in other tools such as metals, and provide additional operations and utilities based on that information, e.g. language server protocol specifies DiagnosticTag. This tag is used by the LSP client to fade unused code, or cross deprecated one.
- we can provide actionable diagnostics that will remove unused code (this will allow us to easily remove all unused in a specific file without a need of scalafix)
If you have any opinions, comments, tips or anything related to this initiative, feel free to join the discussion.
This feature is going to be implemented by @ghostbuster91
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 3 comments
-
I also have this idea, which I'd like to hear your opinion about:
What if we add CheckUnused phase to presentation compiler ?
It would emit warnings (which we would map to hints, or just change the logic directly in phase to report hints instead of warnings when Mode.is(Interactive)) on each interactive driver compilation.
The first concern is how expensive this is, but if the performance lose is insignificant, we could then use those warnings and report them as hints in your client. This will effectively work only on the file that is currently opened, and would work even if you don't have -Wunused turned on.
This will properly mark unused and deprecated methods in your IDE, thus enhance developer experience, and while not cluttering their build.
We would obviously add an option to disable this feature.
Beta Was this translation helpful? Give feedback.
All reactions
-
Here is what I have so far if anyone would like to take a look: #19780
Beta Was this translation helpful? Give feedback.
All reactions
-
For the first concern, there is a PR to improve performance of the check.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1