Skip to content

Commit 1183b57

Browse files
authored
Merge pull request #1995 from dotty-staging/fix/private-leaks-pos
checkNoPrivateLeaks: Use correct position for errors
2 parents 5b22ab7 + 342c627 commit 1183b57

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

compiler/src/dotty/tools/dotc/typer/Checking.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,7 @@ object Checking {
356356
*/
357357
def checkNoPrivateLeaks(sym: Symbol, pos: Position)(implicit ctx: Context): Type = {
358358
class NotPrivate extends TypeMap {
359-
type Errors = List[(String, Position)]
360-
var errors: Errors = Nil
359+
var errors: List[String] = Nil
361360

362361
def accessBoundary(sym: Symbol): Symbol =
363362
if (sym.is(Private) || !sym.owner.isClass) sym.owner
@@ -383,8 +382,8 @@ object Checking {
383382
val prevErrors = errors
384383
var tp1 =
385384
if (isLeaked(tp.symbol)) {
386-
errors = (em"non-private $sym refers to private ${tp.symbol}\n in its type signature ${sym.info}",
387-
sym.pos) :: errors
385+
errors =
386+
em"non-private $sym refers to private ${tp.symbol}\n in its type signature ${sym.info}" :: errors
388387
tp
389388
}
390389
else mapOver(tp)
@@ -408,7 +407,7 @@ object Checking {
408407
}
409408
val notPrivate = new NotPrivate
410409
val info = notPrivate(sym.info)
411-
notPrivate.errors.foreach { case (msg, pos) => ctx.errorOrMigrationWarning(msg, pos) }
410+
notPrivate.errors.foreach(ctx.errorOrMigrationWarning(_, pos))
412411
info
413412
}
414413

0 commit comments

Comments
 (0)