From 8997bf17e2994a5b5e2edd06835f4cdc543e57ed Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Mon, 13 Mar 2017 18:32:09 +0100 Subject: [PATCH] Fix compilation of ParSetLike by itself Before this commit, ParSetLike compiled fine as part of compileStdLib but crashed when compiled by itself because we tried to force a LazyRef while forcing the same LazyRef. This commit fixes this by being slightly more lazy where it matters. --- compiler/src/dotty/tools/dotc/typer/Checking.scala | 6 +++--- compiler/test/dotc/tests.scala | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/typer/Checking.scala b/compiler/src/dotty/tools/dotc/typer/Checking.scala index 1ca7eb107c61..f822f889377f 100644 --- a/compiler/src/dotty/tools/dotc/typer/Checking.scala +++ b/compiler/src/dotty/tools/dotc/typer/Checking.scala @@ -357,7 +357,7 @@ object Checking { */ def checkNoPrivateLeaks(sym: Symbol, pos: Position)(implicit ctx: Context): Type = { class NotPrivate extends TypeMap { - var errors: List[String] = Nil + var errors: List[() => String] = Nil def accessBoundary(sym: Symbol): Symbol = if (sym.is(Private) || !sym.owner.isClass) sym.owner @@ -384,7 +384,7 @@ object Checking { var tp1 = if (isLeaked(tp.symbol)) { errors = - em"non-private $sym refers to private ${tp.symbol}\n in its type signature ${sym.info}" :: errors + (() => em"non-private $sym refers to private ${tp.symbol}\n in its type signature ${sym.info}") :: errors tp } else mapOver(tp) @@ -408,7 +408,7 @@ object Checking { } val notPrivate = new NotPrivate val info = notPrivate(sym.info) - notPrivate.errors.foreach(ctx.errorOrMigrationWarning(_, pos)) + notPrivate.errors.foreach(error => ctx.errorOrMigrationWarning(error(), pos)) info } diff --git a/compiler/test/dotc/tests.scala b/compiler/test/dotc/tests.scala index 0c4668a89d81..78a8aefd532b 100644 --- a/compiler/test/dotc/tests.scala +++ b/compiler/test/dotc/tests.scala @@ -224,6 +224,7 @@ class tests extends CompilerTest { |../scala-scala/src/library/scala/collection/SeqLike.scala |../scala-scala/src/library/scala/collection/generic/GenSeqFactory.scala""".stripMargin) @Test def compileIndexedSeq = compileLine("../scala-scala/src/library/scala/collection/immutable/IndexedSeq.scala") + @Test def compileParSetLike = compileLine("../scala-scala/src/library/scala/collection/parallel/mutable/ParSetLike.scala") @Test def dotty = { dottyBootedLib