-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport "Add the -Wall option that enables all warnings (Plan B)" to…
… 3.5.2 (#21495) Backports #20577 to the 3.5.2 branch. PR submitted by the release tooling. [skip ci]
- Loading branch information
Showing
14 changed files
with
124 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- [E198] Unused Symbol Warning: tests/warn/i18559a.scala:4:28 --------------------------------------------------------- | ||
4 | import collection.mutable.Set // warn | ||
| ^^^ | ||
| unused import | ||
-- [E198] Unused Symbol Warning: tests/warn/i18559a.scala:8:8 ---------------------------------------------------------- | ||
8 | val x = 1 // warn | ||
| ^ | ||
| unused local definition | ||
-- [E198] Unused Symbol Warning: tests/warn/i18559a.scala:11:26 -------------------------------------------------------- | ||
11 | import SomeGivenImports.given // warn | ||
| ^^^^^ | ||
| unused import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//> using options -Wall | ||
// This test checks that -Wall turns on -Wunused:all if -Wunused is not set | ||
object FooImportUnused: | ||
import collection.mutable.Set // warn | ||
|
||
object FooUnusedLocal: | ||
def test(): Unit = | ||
val x = 1 // warn | ||
|
||
object FooGivenUnused: | ||
import SomeGivenImports.given // warn | ||
|
||
object SomeGivenImports: | ||
given Int = 0 | ||
given String = "foo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- Warning: tests/warn/i18559b.scala:8:6 ------------------------------------------------------------------------------- | ||
8 | val localFile: String = s"${url.##}.tmp" // warn | ||
| ^ | ||
| Access non-initialized value localFile. Calling trace: | ||
| ├── class RemoteFile(url: String) extends AbstractFile: [ i18559b.scala:7 ] | ||
| │ ^ | ||
| ├── abstract class AbstractFile: [ i18559b.scala:3 ] | ||
| │ ^ | ||
| ├── val extension: String = name.substring(4) [ i18559b.scala:5 ] | ||
| │ ^^^^ | ||
| └── def name: String = localFile [ i18559b.scala:9 ] | ||
| ^^^^^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//> using options -Wall | ||
// This test checks that -Wall turns on -Wsafe-init | ||
abstract class AbstractFile: | ||
def name: String | ||
val extension: String = name.substring(4) | ||
|
||
class RemoteFile(url: String) extends AbstractFile: | ||
val localFile: String = s"${url.##}.tmp" // warn | ||
def name: String = localFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- [E198] Unused Symbol Warning: tests/warn/i18559c.scala:4:28 --------------------------------------------------------- | ||
4 | import collection.mutable.Set // warn | ||
| ^^^ | ||
| unused import | ||
-- [E198] Unused Symbol Warning: tests/warn/i18559c.scala:8:8 ---------------------------------------------------------- | ||
8 | val x = 1 // warn | ||
| ^ | ||
| unused local definition | ||
-- [E198] Unused Symbol Warning: tests/warn/i18559c.scala:11:26 -------------------------------------------------------- | ||
11 | import SomeGivenImports.given // warn | ||
| ^^^^^ | ||
| unused import |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//> using options -Wall -Wunused:locals | ||
// This test checks that -Wall overrides -Wunused:... if it is already set | ||
object FooImportUnused: | ||
import collection.mutable.Set // warn | ||
|
||
object FooUnusedLocal: | ||
def test(): Unit = | ||
val x = 1 // warn | ||
|
||
object FooGivenUnused: | ||
import SomeGivenImports.given // warn | ||
|
||
object SomeGivenImports: | ||
given Int = 0 | ||
given String = "foo" |