diff --git a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala index 7a81a33ace66..8b807e770951 100644 --- a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -146,6 +146,7 @@ class ScalaSettings extends Settings.SettingGroup { val YshowPrintErrors: Setting[Boolean] = BooleanSetting("-Yshow-print-errors", "Don't suppress exceptions thrown during tree printing.") val YshowRawQuoteTrees: Setting[Boolean] = BooleanSetting("-Yshow-raw-tree", "Don't remove quote artifacts.") val YtestPickler: Setting[Boolean] = BooleanSetting("-Ytest-pickler", "Self-test for pickling functionality; should be used with -Ystop-after:pickler.") + val YparallelPickler: Setting[Boolean] = BooleanSetting("-Yparallel-pickler", "Run part of the pickling phase in parallel, disable because it breaks some tests.") val YcheckReentrant: Setting[Boolean] = BooleanSetting("-Ycheck-reentrant", "Check that compiled program does not contain vars that can be accessed from a global root.") val YdropComments: Setting[Boolean] = BooleanSetting("-Ydrop-comments", "Drop comments when scanning source files.") val YcookComments: Setting[Boolean] = BooleanSetting("-Ycook-comments", "Cook the comments (type check `@usecase`, etc.)") diff --git a/compiler/src/dotty/tools/dotc/transform/Pickler.scala b/compiler/src/dotty/tools/dotc/transform/Pickler.scala index 136a9eaa7060..997d8deea3f4 100644 --- a/compiler/src/dotty/tools/dotc/transform/Pickler.scala +++ b/compiler/src/dotty/tools/dotc/transform/Pickler.scala @@ -86,7 +86,17 @@ class Pickler extends Phase { pickled }(using ExecutionContext.global) def force(): Array[Byte] = Await.result(pickledF, Duration.Inf) - if ctx.settings.YtestPickler.value then force() + + // Turn off parallelism because it lead to non-deterministic CI failures: + // - https://github.com/lampepfl/dotty/runs/1029579877?check_suite_focus=true#step:10:967 + // - https://github.com/lampepfl/dotty/runs/1027582846?check_suite_focus=true#step:10:564 + // + // Turning off parallelism in -Ytest-pickler and Interactive mode seems to + // work around the problem but I would prefer to not enable this at all + // until the root cause of the issue is understood since it might manifest + // itself in other situations too. + if !ctx.settings.YparallelPickler.value then force() + unit.pickled += (cls -> force) } }