-
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.
Add origin filter to WConf, DeprecationWarning (#21404)
The `origin` parameter to `deprecationWarning` is optional; the parameter to `DeprecationWarning` is not. The `origin` of a deprecation is simply the deprecated symbol. The full name is matched by the regex specified by `-Wconf`. The other important use case is the `origin` of an unused element, in particular, the selector which causes an "unused import" warning. That use case will be supported in a follow-up PR, and should work as in Scala 2. Fixes #17538
- Loading branch information
Showing
12 changed files
with
93 additions
and
30 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
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,14 @@ | ||
-- Deprecation Warning: tests/warn/deprecated-origin-verbose.scala:12:18 ----------------------------------------------- | ||
12 | class D extends C // warn | ||
| ^ | ||
| class C in package p is deprecated since 1.0: Old style | ||
Matching filters for @nowarn or -Wconf: | ||
- cat=deprecation | ||
- origin=p.C | ||
-- Deprecation Warning: tests/warn/deprecated-origin-verbose.scala:13:20 ----------------------------------------------- | ||
13 | class Oil extends Crude // warn | ||
| ^^^^^ | ||
| class Crude in package p is deprecated since 1.0: Bad style | ||
Matching filters for @nowarn or -Wconf: | ||
- cat=deprecation | ||
- origin=p.Crude |
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 -deprecation -Wconf:any:verbose | ||
|
||
package p: | ||
@deprecated("Old style", since="1.0") | ||
class C | ||
@deprecated("Bad style", since="1.0") | ||
class Crude | ||
|
||
package q: | ||
import annotation.* | ||
import p.* | ||
class D extends C // warn | ||
class Oil extends Crude // warn | ||
@nowarn("""origin=p\.Crude""") | ||
class Language extends Crude // nowarn obvs |
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 -deprecation -Wconf:origin=p\.C$:s | ||
|
||
package p: | ||
@deprecated("Old style", since="1.0") | ||
class C | ||
@deprecated("Bad style", since="1.0") | ||
class Crude | ||
|
||
package q: | ||
import annotation.* | ||
import p.* | ||
class D extends C // nowarn - C$ pattern avoids matching Crude | ||
class Oil extends Crude // warn | ||
@nowarn("""origin=p\.Crude""") | ||
class Language extends Crude // nowarn obvs |