File tree Expand file tree Collapse file tree 6 files changed +67
-0
lines changed Expand file tree Collapse file tree 6 files changed +67
-0
lines changed Original file line number Diff line number Diff line change 1+ -- [E198] Unused Symbol Warning: tests/warn/i18559a.scala:4:28 ---------------------------------------------------------
2+ 4 | import collection.mutable.Set // warn
3+ | ^^^
4+ | unused import
5+ -- [E198] Unused Symbol Warning: tests/warn/i18559a.scala:8:8 ----------------------------------------------------------
6+ 8 | val x = 1 // warn
7+ | ^
8+ | unused local definition
9+ -- [E198] Unused Symbol Warning: tests/warn/i18559a.scala:11:26 --------------------------------------------------------
10+ 11 | import SomeGivenImports.given // warn
11+ | ^^^^^
12+ | unused import
Original file line number Diff line number Diff line change 1+ //> using options -Wall
2+ // This test checks that -Wall turns on -Wunused:all if -Wunused is not set
3+ object FooImportUnused :
4+ import collection .mutable .Set // warn
5+
6+ object FooUnusedLocal :
7+ def test (): Unit =
8+ val x = 1 // warn
9+
10+ object FooGivenUnused :
11+ import SomeGivenImports .given // warn
12+
13+ object SomeGivenImports :
14+ given Int = 0
15+ given String = " foo"
Original file line number Diff line number Diff line change 1+ -- Warning: tests/warn/i18559b.scala:8:6 -------------------------------------------------------------------------------
2+ 8 | val localFile: String = s"${url.##}.tmp" // warn
3+ | ^
4+ | Access non-initialized value localFile. Calling trace:
5+ | ├── class RemoteFile(url: String) extends AbstractFile: [ i18559b.scala:7 ]
6+ | │ ^
7+ | ├── abstract class AbstractFile: [ i18559b.scala:3 ]
8+ | │ ^
9+ | ├── val extension: String = name.substring(4) [ i18559b.scala:5 ]
10+ | │ ^^^^
11+ | └── def name: String = localFile [ i18559b.scala:9 ]
12+ | ^^^^^^^^^
Original file line number Diff line number Diff line change 1+ //> using options -Wall
2+ // This test checks that -Wall turns on -Wsafe-init
3+ abstract class AbstractFile :
4+ def name : String
5+ val extension : String = name.substring(4 )
6+
7+ class RemoteFile (url : String ) extends AbstractFile :
8+ val localFile : String = s " ${url.## }.tmp " // warn
9+ def name : String = localFile
Original file line number Diff line number Diff line change 1+ -- [E198] Unused Symbol Warning: tests/warn/i18559c.scala:8:8 ----------------------------------------------------------
2+ 8 | val x = 1 // warn
3+ | ^
4+ | unused local definition
Original file line number Diff line number Diff line change 1+ //> using options -Wall -Wunused:locals
2+ // This test checks that -Wall leaves -Wunused:... untouched if it is already set
3+ object FooImportUnused :
4+ import collection .mutable .Set // not warn
5+
6+ object FooUnusedLocal :
7+ def test (): Unit =
8+ val x = 1 // warn
9+
10+ object FooGivenUnused :
11+ import SomeGivenImports .given // not warn
12+
13+ object SomeGivenImports :
14+ given Int = 0
15+ given String = " foo"
You can’t perform that action at this time.
0 commit comments