Skip to content

Commit 8997bf1

Browse files
committed
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.
1 parent b319440 commit 8997bf1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ object Checking {
357357
*/
358358
def checkNoPrivateLeaks(sym: Symbol, pos: Position)(implicit ctx: Context): Type = {
359359
class NotPrivate extends TypeMap {
360-
var errors: List[String] = Nil
360+
var errors: List[() => String] = Nil
361361

362362
def accessBoundary(sym: Symbol): Symbol =
363363
if (sym.is(Private) || !sym.owner.isClass) sym.owner
@@ -384,7 +384,7 @@ object Checking {
384384
var tp1 =
385385
if (isLeaked(tp.symbol)) {
386386
errors =
387-
em"non-private $sym refers to private ${tp.symbol}\n in its type signature ${sym.info}" :: errors
387+
(() => em"non-private $sym refers to private ${tp.symbol}\n in its type signature ${sym.info}") :: errors
388388
tp
389389
}
390390
else mapOver(tp)
@@ -408,7 +408,7 @@ object Checking {
408408
}
409409
val notPrivate = new NotPrivate
410410
val info = notPrivate(sym.info)
411-
notPrivate.errors.foreach(ctx.errorOrMigrationWarning(_, pos))
411+
notPrivate.errors.foreach(error => ctx.errorOrMigrationWarning(error(), pos))
412412
info
413413
}
414414

compiler/test/dotc/tests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ class tests extends CompilerTest {
224224
|../scala-scala/src/library/scala/collection/SeqLike.scala
225225
|../scala-scala/src/library/scala/collection/generic/GenSeqFactory.scala""".stripMargin)
226226
@Test def compileIndexedSeq = compileLine("../scala-scala/src/library/scala/collection/immutable/IndexedSeq.scala")
227+
@Test def compileParSetLike = compileLine("../scala-scala/src/library/scala/collection/parallel/mutable/ParSetLike.scala")
227228

228229
@Test def dotty = {
229230
dottyBootedLib

0 commit comments

Comments
 (0)