Skip to content

Commit d458cf0

Browse files
committed
Fix #11885: Always clone trees if position already set
The cause of the problem is that we use parallelism in Pickler: if !Pickler.ParallelPickling || ctx.settings.YtestPickler.value then force() Sometimes on Windows, the futures run a little slower, and the later phase `Inlining` can change the positions of the trees to be pickled, thus non-determinism. For the Dotty project, the statistics is as follows: - Before: ntrees = 5331539 - After: ntrees = 5334075 Performance-wise, this should be better than synchronizing the pickling tasks.
1 parent e2e77b5 commit d458cf0

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

compiler/src/dotty/tools/dotc/ast/Positioned.scala

+4-5
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,11 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Src
6565
if (span == mySpan) this
6666
else {
6767
val newpd: this.type =
68-
if (mySpan.isSynthetic) {
69-
if (!mySpan.exists && span.exists)
70-
envelope(source, span.startPos) // fill in children spans
68+
if !mySpan.exists then
69+
if span.exists then envelope(source, span.startPos) // fill in children spans
7170
this
72-
}
73-
else cloneIn(source)
71+
else
72+
cloneIn(source)
7473
newpd.span = span
7574
newpd
7675
}

compiler/test/dotty/tools/dotc/IdempotencyTests.scala

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ class IdempotencyTests {
1818
import IdempotencyTests._
1919
import CompilationTest.aggregateTests
2020

21-
// Flaky test on Windows
22-
// https://github.com/lampepfl/dotty/issues/11885
23-
val filter = FileFilter.exclude("i6507b.scala")
21+
// ignore flaky tests
22+
val filter = FileFilter.NoFilter
2423

2524
@Category(Array(classOf[SlowTests]))
2625
@Test def idempotency: Unit = {

0 commit comments

Comments
 (0)