Skip to content

Commit 9c77ce7

Browse files
som-snyttlrytz
authored andcommitted
Lint unnamed boolean literal args
1 parent 1b87eb6 commit 9c77ce7

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

library/src/scala/deprecatedName.scala

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,35 @@ package scala
1414

1515
import scala.annotation.meta._
1616

17-
/** An annotation that designates that the name of a parameter is deprecated.
18-
*
19-
* Using this name in a named argument generates a deprecation warning.
20-
*
21-
* Library authors should state the library's deprecation policy in their documentation to give
22-
* developers guidance on how long a deprecated name will be preserved.
23-
*
24-
* Library authors should prepend the name of their library to the version number to help
25-
* developers distinguish deprecations coming from different libraries:
26-
*
27-
* {{{
28-
* def inc(x: Int, @deprecatedName("y", "FooLib 12.0") n: Int): Int = x + n
29-
* inc(1, y = 2)
30-
* }}}
31-
* will produce the following warning:
32-
* {{{
33-
* warning: the parameter name y is deprecated (since FooLib 12.0): use n instead
34-
* inc(1, y = 2)
35-
* ^
36-
* }}}
37-
*
38-
* @see [[scala.deprecated]]
39-
* @see [[scala.deprecatedInheritance]]
40-
* @see [[scala.deprecatedOverriding]]
41-
*/
17+
/** An annotation that designates that the name of a parameter is deprecated.
18+
*
19+
* Using this name in a named argument generates a deprecation warning.
20+
*
21+
* If the `name` is omitted, then using the canonical name is deprecated.
22+
* In that case, lints such as `-Xlint:named-booleans` which encourage
23+
* the use of a name will not warn.
24+
*
25+
* Library authors should state the library's deprecation policy in their documentation to give
26+
* developers guidance on how long a deprecated name will be preserved.
27+
*
28+
* Library authors should prepend the name of their library to the version number to help
29+
* developers distinguish deprecations coming from different libraries:
30+
*
31+
* {{{
32+
* def inc(x: Int, @deprecatedName("y", "FooLib 12.0") n: Int): Int = x + n
33+
* inc(1, y = 2)
34+
* }}}
35+
* will produce the following warning:
36+
* {{{
37+
* warning: the parameter name y is deprecated (since FooLib 12.0): use n instead
38+
* inc(1, y = 2)
39+
* ^
40+
* }}}
41+
*
42+
* @see [[scala.deprecated]]
43+
* @see [[scala.deprecatedInheritance]]
44+
* @see [[scala.deprecatedOverriding]]
45+
*/
4246
@param
4347
@deprecatedInheritance("Scheduled for being final in the future", "2.13.0")
4448
class deprecatedName(name: String = "<none>", since: String = "") extends scala.annotation.StaticAnnotation {

0 commit comments

Comments
 (0)