-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:lintingLinting warnings enabled with -W or -XlintLinting warnings enabled with -W or -Xlintitype:bug
Description
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 = 0Output
-- [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:
-WallEnable all warning settings.-WshadowEnable or disable specific shadow warnings-WunusedEnable 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 = 0then 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
Metadata
Metadata
Assignees
Labels
area:lintingLinting warnings enabled with -W or -XlintLinting warnings enabled with -W or -Xlintitype:bug