Skip to content

Commit fe15294

Browse files
committed
Let -Wall override -Wunused
1 parent 81f2c8e commit fe15294

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

Diff for: compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ private sealed trait WarningSettings:
203203
def nowarn(using Context) = allOr("nowarn")
204204

205205
// Is any choice set for -Wunused?
206-
def any(using Context): Boolean = Wunused.value.nonEmpty
206+
def any(using Context): Boolean = Wall.value || Wunused.value.nonEmpty
207207

208208
// overrided by strict-no-implicit-warn
209209
def imports(using Context) =

Diff for: tests/warn/i18559c.check

+8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1+
-- [E198] Unused Symbol Warning: tests/warn/i18559c.scala:4:28 ---------------------------------------------------------
2+
4 | import collection.mutable.Set // warn
3+
| ^^^
4+
| unused import
15
-- [E198] Unused Symbol Warning: tests/warn/i18559c.scala:8:8 ----------------------------------------------------------
26
8 | val x = 1 // warn
37
| ^
48
| unused local definition
9+
-- [E198] Unused Symbol Warning: tests/warn/i18559c.scala:11:26 --------------------------------------------------------
10+
11 | import SomeGivenImports.given // warn
11+
| ^^^^^
12+
| unused import

Diff for: tests/warn/i18559c.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
//> using options -Wall -Wunused:locals
2-
// This test checks that -Wall leaves -Wunused:... untouched if it is already set
2+
// This test checks that -Wall overrides -Wunused:... if it is already set
33
object FooImportUnused:
4-
import collection.mutable.Set // not warn
4+
import collection.mutable.Set // warn
55

66
object FooUnusedLocal:
77
def test(): Unit =
88
val x = 1 // warn
99

1010
object FooGivenUnused:
11-
import SomeGivenImports.given // not warn
11+
import SomeGivenImports.given // warn
1212

1313
object SomeGivenImports:
1414
given Int = 0

0 commit comments

Comments
 (0)