summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker
diff options
context:
space:
mode:
authorSimon Ochsenreither <simon@ochsenreither.de>2016-04-02 13:38:15 +0200
committerSimon Ochsenreither <simon@ochsenreither.de>2016-05-28 21:42:40 +0200
commit673350e08af72454fe9df87ae7f3292893e44d3c (patch)
tree7bff97a5ba4dafd0836f529589e8572175a442e7 /src/compiler/scala/tools/nsc/typechecker
parent981e3c51d5040ea808b5f699718db55241ee42cf (diff)
downloadscala-673350e08af72454fe9df87ae7f3292893e44d3c.tar.gz
scala-673350e08af72454fe9df87ae7f3292893e44d3c.tar.bz2
scala-673350e08af72454fe9df87ae7f3292893e44d3c.zip
SI-9084 Add `since` (if available) to deprecation warnings
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Adaptations.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala5
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala7
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala7
4 files changed, 12 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Adaptations.scala b/src/compiler/scala/tools/nsc/typechecker/Adaptations.scala
index 2f4d228347..46561de78f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Adaptations.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Adaptations.scala
@@ -74,7 +74,7 @@ trait Adaptations {
if (settings.future)
context.error(t.pos, adaptWarningMessage("Adaptation of argument list by inserting () has been removed.", showAdaptation = false))
else {
- val msg = "Adaptation of argument list by inserting () has been deprecated: " + (
+ val msg = "Adaptation of argument list by inserting () is deprecated: " + (
if (isLeakyTarget) "leaky (Object-receiving) target makes this especially dangerous."
else "this is unlikely to be what you want.")
context.deprecationWarning(t.pos, t.symbol, adaptWarningMessage(msg))
diff --git a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
index 5062289ed1..063cfd3805 100644
--- a/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
@@ -565,14 +565,15 @@ trait NamesDefaults { self: Analyzer =>
case Some(`name`) => true
case Some(nme.NO_NAME) => anonOK
}
+ def since = param.deprecatedParamVersion.map(ver => s" (since $ver)").getOrElse("")
def checkName = {
val res = param.name == name
- if (res && checkDeprecation(true)) warn(s"naming parameter $name has been deprecated.")
+ if (res && checkDeprecation(true)) warn(s"naming parameter $name is deprecated$since.")
res
}
def checkAltName = {
val res = checkDeprecation(false)
- if (res) warn(s"the parameter name $name has been deprecated. Use ${param.name} instead.")
+ if (res) warn(s"the parameter name $name is deprecated$since: Use ${param.name} instead")
res
}
!param.isSynthetic && (checkName || checkAltName)
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index da269168ec..3aea64a1f2 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -548,9 +548,10 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans
def checkOverrideDeprecated() {
if (other.hasDeprecatedOverridingAnnotation && !member.ownerChain.exists(x => x.isDeprecated || x.hasBridgeAnnotation)) {
- val suffix = other.deprecatedOverridingMessage map (": " + _) getOrElse ""
- val msg = s"overriding ${other.fullLocationString} is deprecated$suffix"
- currentRun.reporting.deprecationWarning(member.pos, other, msg)
+ val version = other.deprecatedOverridingVersion map (ver => s" (since $ver)") getOrElse ""
+ val message = other.deprecatedOverridingMessage map (msg => s": $msg") getOrElse ""
+ val report = s"overriding ${other.fullLocationString} is deprecated$version$message"
+ currentRun.reporting.deprecationWarning(member.pos, other, report)
}
}
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 1aed9c3a64..d44a0eaf59 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1704,9 +1704,10 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
if (!isPastTyper && psym.hasDeprecatedInheritanceAnnotation &&
!sameSourceFile && !context.owner.ownerChain.exists(x => x.isDeprecated || x.hasBridgeAnnotation)) {
- val suffix = psym.deprecatedInheritanceMessage map (": " + _) getOrElse ""
- val msg = s"inheritance from ${psym.fullLocationString} is deprecated$suffix"
- context.deprecationWarning(parent.pos, psym, msg)
+ val version = psym.deprecatedInheritanceVersion map (ver => s" (since $ver)") getOrElse ""
+ val message = psym.deprecatedInheritanceMessage map (msg => s": $msg") getOrElse ""
+ val report = s"inheritance from ${psym.fullLocationString} is deprecated$version$message"
+ context.deprecationWarning(parent.pos, psym, report)
}
if (psym.isSealed && !phase.erasedTypes)