Skip to content

Commit ff289f0

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 865895d commit ff289f0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ abstract class Positioned(implicit @constructorOnly src: SourceFile) extends Src
6868
if (mySpan.isSynthetic) {
6969
if (!mySpan.exists && span.exists)
7070
envelope(source, span.startPos) // fill in children spans
71-
this
71+
this
72+
else
73+
cloneIn(source)
7274
}
7375
else cloneIn(source)
7476
newpd.span = span

0 commit comments

Comments
 (0)