Originally confirmed on Scala Contributors.
Compiler version
v3.7.4, v3.7.nightly, v3.8.nightly.
Minimized code
//> using scala 3.7.nightly
//> using options -Wall
class A:
protected val x: String = ""
class B extends A:
private val x: Int = 0
Output
-- [E198] Unused Symbol Warning: .../wall-wshadow-wunused.scala:8:14
8 | private val x: Int = 0
| ^
| unused private member
1 warning found
Expectation
According to scala-cli -S 3.7.nightly -O -W:
-Wall Enable all warning settings.
-Wshadow Enable or disable specific shadow warnings
-Wunused Enable or disable specific unused warnings
It may seem that -Wall should imply both -Wshadow:all and -Wunused:all.
However for now it imlplies -Wunused only but not -Wshadow.
Therefore, when -Wshadow:all and -Wunused:all are used instead of -Wall:
//> using scala 3.7.nightly
//> using options -Wshadow:all -Wunused:all
class A:
protected val x: String = ""
class B extends A:
private val x: Int = 0
then the output is:
-- Warning: .../wall-wshadow-wunused.scala:8:2
8 | private val x: Int = 0
| ^
| value x in class B shadows field x inherited from class A
-- [E198] Unused Symbol Warning: .../wall-wshadow-wunused.scala:8:14
8 | private val x: Int = 0
| ^
| unused private member
2 warnings found
Originally confirmed on Scala Contributors.
Compiler version
v3.7.4, v3.7.nightly, v3.8.nightly.
Minimized code
Output
Expectation
According to scala-cli -S 3.7.nightly -O -W:
-WallEnable all warning settings.-WshadowEnable or disable specific shadow warnings-WunusedEnable or disable specific unused warningsIt may seem that
-Wallshould imply both-Wshadow:alland-Wunused:all.However for now it imlplies
-Wunusedonly but not-Wshadow.Therefore, when
-Wshadow:alland-Wunused:allare used instead of-Wall:then the output is: