Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Emitted Warnings from the compiler should have assigned error identifier. #19698

rochala started this conversation in Feature Requests
Discussion options

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

You must be logged in to vote

Replies: 3 comments

Comment options

rochala
Feb 15, 2024
Collaborator Author

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.

You must be logged in to vote
0 replies
Comment options

Here is what I have so far if anyone would like to take a look: #19780

You must be logged in to vote
0 replies
Comment options

For the first concern, there is a PR to improve performance of the check.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /