diff options
author | odersky <odersky@gmail.com> | 2017-02-18 12:58:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-18 12:58:05 +0100 |
commit | 1183b57a014fdb730124037708e2de9ab7c2b128 (patch) | |
tree | 6f255e979180fa2901a9820e2d1cdf7ce1a93963 /compiler/src | |
parent | 5b22ab75f682bd25380d006c4789567e848adfcd (diff) | |
parent | 342c6278d02cf07bea16aea531fccd28ccda989f (diff) | |
download | dotty-1183b57a014fdb730124037708e2de9ab7c2b128.tar.gz dotty-1183b57a014fdb730124037708e2de9ab7c2b128.tar.bz2 dotty-1183b57a014fdb730124037708e2de9ab7c2b128.zip |
Merge pull request #1995 from dotty-staging/fix/private-leaks-pos
checkNoPrivateLeaks: Use correct position for errors
Diffstat (limited to 'compiler/src')
-rw-r--r-- | compiler/src/dotty/tools/dotc/typer/Checking.scala | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala index 27b0f28ca..fb0497c2b 100644 --- a/compiler/src/dotty/tools/dotc/typer/Checking.scala +++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala @@ -356,8 +356,7 @@ object Checking { */ def checkNoPrivateLeaks(sym: Symbol, pos: Position)(implicit ctx: Context): Type = { class NotPrivate extends TypeMap { - type Errors = List[(String, Position)] - var errors: Errors = Nil + var errors: List[String] = Nil def accessBoundary(sym: Symbol): Symbol = if (sym.is(Private) || !sym.owner.isClass) sym.owner @@ -383,8 +382,8 @@ object Checking { val prevErrors = errors var tp1 = if (isLeaked(tp.symbol)) { - errors = (em"non-private $sym refers to private ${tp.symbol}\n in its type signature ${sym.info}", - sym.pos) :: errors + errors = + em"non-private $sym refers to private ${tp.symbol}\n in its type signature ${sym.info}" :: errors tp } else mapOver(tp) @@ -408,7 +407,7 @@ object Checking { } val notPrivate = new NotPrivate val info = notPrivate(sym.info) - notPrivate.errors.foreach { case (msg, pos) => ctx.errorOrMigrationWarning(msg, pos) } + notPrivate.errors.foreach(ctx.errorOrMigrationWarning(_, pos)) info } |