From 2d3e90e218ef5c0452494b2ce3febe010a958ceb Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Sun, 30 Apr 2017 17:50:39 +0200 Subject: [PATCH 1/2] Fix deprecation messages missing a position `pos` was accidentally passed as a fourth argument to `format` and ignored instead of as a second argument to `deprecationWarning`. --- compiler/src/dotty/tools/dotc/typer/RefChecks.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala index 4715873e5483..703224501253 100644 --- a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala @@ -641,7 +641,7 @@ object RefChecks { // in either a deprecated member or a scala bridge method, issue a warning. if (sym.isDeprecated && !ctx.owner.ownersIterator.exists(_.isDeprecated)) { ctx.deprecationWarning("%s%s is deprecated%s".format( - sym, sym.showLocated, sym.deprecationMessage map (": " + _) getOrElse "", pos)) + sym, sym.showLocated, sym.deprecationMessage map (": " + _) getOrElse ""), pos) } // Similar to deprecation: check if the symbol is marked with @migration // indicating it has changed semantics between versions. From 738a6386a36e26481be4f37db974650fd30c4d17 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Sun, 30 Apr 2017 17:54:22 +0200 Subject: [PATCH 2/2] Nicer deprecation messages No need to print both `sym` and `sym.showLocated`, the second one is enough. --- compiler/src/dotty/tools/dotc/typer/RefChecks.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala index 703224501253..7cfe204e3b02 100644 --- a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala +++ b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala @@ -640,8 +640,8 @@ object RefChecks { // If symbol is deprecated, and the point of reference is not enclosed // in either a deprecated member or a scala bridge method, issue a warning. if (sym.isDeprecated && !ctx.owner.ownersIterator.exists(_.isDeprecated)) { - ctx.deprecationWarning("%s%s is deprecated%s".format( - sym, sym.showLocated, sym.deprecationMessage map (": " + _) getOrElse ""), pos) + ctx.deprecationWarning("%s is deprecated%s".format( + sym.showLocated, sym.deprecationMessage map (": " + _) getOrElse ""), pos) } // Similar to deprecation: check if the symbol is marked with @migration // indicating it has changed semantics between versions.