scala3
scala3 copied to clipboard
Disappearing deprecation warning with unhelpful suggestion
Compiler version
Scala compiler version 3.3.1 -- Copyright 2002-2023, LAMP/EPFL
Minimized example
To reproduce:
- Clone https://github.com/kyouko-taiga/scala-existentials
- Navigate to the tag
scala-vanishing-deprecation-warning(or this commit) - Compile the project with sbt
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.
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.
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.