aboutsummaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2017-02-17 18:23:06 +0100
committerGuillaume Martres <smarter@ubuntu.com>2017-02-17 18:25:00 +0100
commit342c6278d02cf07bea16aea531fccd28ccda989f (patch)
tree303c16c40ffbb5061c1766488478b14876de2960 /compiler
parent6df672c7e7be65d7be1cd6524c610aed4f35178c (diff)
downloaddotty-342c6278d02cf07bea16aea531fccd28ccda989f.tar.gz
dotty-342c6278d02cf07bea16aea531fccd28ccda989f.tar.bz2
dotty-342c6278d02cf07bea16aea531fccd28ccda989f.zip
checkNoPrivateLeaks: Use correct position for errors
Previously we never used the `pos` argument of `checkNoPrivateLeaks` and instead used `sym.pos`, this makes a difference for calls to `avoidPrivateLeaks` coming from `TreeUnpickler` where we should use `tree.pos` instead.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Checking.scala9
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
}