Skip to content
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

Disappearing deprecation warning with unhelpful suggestion #20340

Open
kyouko-taiga opened this issue May 6, 2024 · 2 comments
Open

Disappearing deprecation warning with unhelpful suggestion #20340

kyouko-taiga opened this issue May 6, 2024 · 2 comments
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:enhancement

Comments

@kyouko-taiga
Copy link
Collaborator

Compiler version

Scala compiler version 3.3.1 -- Copyright 2002-2023, LAMP/EPFL

Minimized example

To reproduce:

Output Error/Warning message

> compile
[info] compiling 13 Scala sources to xxx/classes ...
[warn] there was 1 deprecation warning; re-run with -deprecation for details
[warn] one warning found

> compile
[success] Total time: 0 s, completed May 6, 2024, 5:44:35 AM

Why this Error/Warning was not helpful

The deprecation warning is not showed, it is not clear how to show it (how the flag must be passed?), and re-compiling the project doesn't show the warning anymore.

Suggested improvement

It could be made more helpful by showing the deprecation warning and/or give more precise information on how it can be showed (e.g., by linking to some online documentation). Further, the message should be shown on every compilation rather than just the first one.

@kyouko-taiga kyouko-taiga added area:reporting Error reporting including formatting, implicit suggestions, etc better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:enhancement stat:needs triage Every issue needs to have an "area" and "itype" label labels May 6, 2024
@som-snytt
Copy link
Contributor

som-snytt commented May 6, 2024

The "re-run" message is a classic annoyance.

The issue of disappearing warnings just came up on discord. There is a plugin to always show current warnings. I said what a great idea, but now I've forgotten the plugin name. Someone on discord may be forthcoming with that information.

I assume "current warnings" means previous warnings in sources which have not been recompiled yet.

Edit: https://github.com/rtimush/sbt-rewarn

"hey, it works!"

sbt:rays> clean
[success] Total time: 0 s, completed May 5, 2024, 11:32:45 PM
sbt:rays> compile
[info] compiling 13 Scala sources to .../scala-existentials/scala/target/scala-3.3.1/classes ...
[warn] -- Deprecation Warning: .../scala-existentials/scala/src/main/scala/scenes/Scene.scala:29:22
[warn] 29 |        relationships + (
[warn]    |        ^^^^^^^^^^^^^^^
[warn]    |method + in trait MapOps is deprecated since 2.13.0: Use ++ with an explicit collection argument instead of + with varargs
[warn] one warning found
[success] Total time: 5 s, completed May 5, 2024, 11:32:51 PM
sbt:rays> compile
[warn] .../scala-existentials/scala/src/main/scala/scenes/Scene.scala:29:23: method + in trait MapOps is deprecated since 2.13.0: Use ++ with an explicit collection argument instead of + with varargs
[warn]         relationships + (
[warn]                       ^
[warn] one warning found
[success] Total time: 0 s, completed May 5, 2024, 11:32:54 PM
sbt:rays>

One may quibble with the caret.

@odersky
Copy link
Contributor

odersky commented May 8, 2024

I believe this needs fixing on the repl side. Ideally, I add a comment

> //> using options -deprecation

after the prompt and try again.

There is the other issue that the deprecation count needs to be reset after each run.

@Gedochao Gedochao removed the stat:needs triage Every issue needs to have an "area" and "itype" label label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:enhancement
Projects
None yet
Development

No branches or pull requests

4 participants