Skip to content

checkNoPrivateLeaks: Use correct position for errors #1995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions compiler/src/dotty/tools/dotc/typer/Checking.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
}

Expand Down