summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2017-04-06 18:13:22 -0700
committerSom Snytt <som.snytt@gmail.com>2017-04-06 18:13:22 -0700
commitbad61ce0ff9f460c2f8873c134a7f6bee0a53824 (patch)
treea8f4cba306966ce23a0ec6629f6e355f76a584cf /src/compiler/scala/tools
parent1290fff26ea626f5d1f9f3c65bd5bd0a97939332 (diff)
downloadscala-bad61ce0ff9f460c2f8873c134a7f6bee0a53824.tar.gz
scala-bad61ce0ff9f460c2f8873c134a7f6bee0a53824.tar.bz2
scala-bad61ce0ff9f460c2f8873c134a7f6bee0a53824.zip
SD-363 Xlint no warn deprecated params, defaults
Deprecation is an escape hatch for unused params. Since default arg getters receive values of previous args, don't warn when they are unused.
Diffstat (limited to 'src/compiler/scala/tools')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
index 7013c7da93..a0139937f1 100644
--- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala
@@ -567,10 +567,16 @@ trait TypeDiagnostics {
&& !treeTypes.exists(_ contains m) // e.g. val a = new Foo ; new a.Bar
//&& !(m.isVal && m.info.resultType =:= typeOf[Unit]) // Unit val is uninteresting
)
- def isUnusedParam(m: Symbol): Boolean = isUnusedTerm(m) && !(m.isParamAccessor && (
- m.owner.isImplicit ||
- targets.exists(s => s.isParameter && s.name == m.name && s.owner.isConstructor && s.owner.owner == m.owner) // exclude ctor params
- ))
+ def isUnusedParam(m: Symbol): Boolean = (
+ isUnusedTerm(m)
+ && !m.isDeprecated
+ && !m.owner.isDefaultGetter
+ && !(m.isParamAccessor && (
+ m.owner.isImplicit ||
+ targets.exists(s => s.isParameter
+ && s.name == m.name && s.owner.isConstructor && s.owner.owner == m.owner) // exclude ctor params
+ ))
+ )
def sympos(s: Symbol): Int =
if (s.pos.isDefined) s.pos.point else if (s.isTerm) s.asTerm.referenced.pos.point else -1
def treepos(t: Tree): Int =