Show nowarn / Wconf filters for a warning with @nowarn("verbose")#10985
Conversation
|
That is so cool! TIL! and I just made a tweak on dotty about nowarn and didn't notice. Not that I didn't believe you, but I had to try it out on my test file. |
som-snytt
left a comment
There was a problem hiding this comment.
I didn't realize innovations were propagating in this direction.
It's very nice when similarity of code makes porting and reviews easier or possible.
|
Every code base should have That doesn't work yet. |
|
Changing compiler flags is much more tedious than adding an annotation to the source and rebuilding. Scala 3 For Scala 2, I looked through the settings. Scoped So maybe |
As already implemented in Scala 3 ``` scala> @nowarn("v") def f = try 1 ^ warning: A try without a catch or finally is equivalent to putting its body in a block; no exceptions are handled. Applicable -Wconf / @nowarn filters for this warning: msg=<part of the message>, cat=other, site=f def f: Int ```
|
flags vs annotations is sad but true. Also counter-intuitive from an old school perspective. Modifying source is heavyweight, but because of the "build tool", flipping an option is heavier. I don't use an IDE, although previously I used Eclipse for Java projects, but I can see the "local" use case: there is some weirdness in my code, it shows a red squiggle or perhaps amber, I want to click an icon to show what I can do to silence the squiggle. That workflow is entirely local. The missing piece is still an audit to tell me what warnings were modified (locally suppressed) in my code. |
Show nowarn / Wconf filters for a warning with @nowarn("verbose")
Show nowarn / Wconf filters for a warning with @nowarn("verbose")
@nowarn("verbose")
This is a practical method to find out what filter can be applied to silence a warning, no need to modify the compiler flags in the build configuration.
Same as already implemented in Scala 3.
(https://hachyderm.io/@spills/112831541923471812)