diff --git a/compiler/src/dotty/tools/dotc/ast/Trees.scala b/compiler/src/dotty/tools/dotc/ast/Trees.scala index 669e5429cf7e..21cc6a6a3e39 100644 --- a/compiler/src/dotty/tools/dotc/ast/Trees.scala +++ b/compiler/src/dotty/tools/dotc/ast/Trees.scala @@ -788,7 +788,7 @@ object Trees { def complete(implicit ctx: Context): T } - // ----- Generic Tree Instances, inherited from `tpt` and `untpd`. + // ----- Generic Tree Instances, inherited from `tpt` and `untpd`. abstract class Instance[T >: Untyped <: Type] extends DotClass { inst => diff --git a/compiler/src/dotty/tools/dotc/core/Types.scala b/compiler/src/dotty/tools/dotc/core/Types.scala index c80107f93858..3f40f8a06215 100644 --- a/compiler/src/dotty/tools/dotc/core/Types.scala +++ b/compiler/src/dotty/tools/dotc/core/Types.scala @@ -1793,7 +1793,7 @@ object Types { override def newLikeThis(prefix: Type)(implicit ctx: Context): TermRef = fixDenot(TermRef.withSig(prefix, name, sig), prefix) - override def shadowed(implicit ctx: Context): NamedType = + override def shadowed(implicit ctx: Context): NamedType = fixDenot(TermRef.withSig(prefix, name.shadowedName, sig), prefix) override def equals(that: Any) = that match { diff --git a/compiler/test/dotty/tools/dotc/ParallelTesting.scala b/compiler/test/dotty/tools/dotc/ParallelTesting.scala index 2b20887e361d..45de03b4809b 100644 --- a/compiler/test/dotty/tools/dotc/ParallelTesting.scala +++ b/compiler/test/dotty/tools/dotc/ParallelTesting.scala @@ -15,6 +15,7 @@ import scala.util.control.NonFatal import scala.util.Try import scala.collection.mutable import scala.util.matching.Regex +import scala.util.Random import core.Contexts._ import reporting.{ Reporter, TestReporter } @@ -1010,8 +1011,11 @@ trait ParallelTesting { self => /** Compiles a directory `f` using the supplied `flags`. This method does * deep compilation, that is - it compiles all files and subdirectories * contained within the directory `f`. + * + * By default, files are compiled in alphabetical order. An optional seed + * can be used for randomization. */ - def compileDir(f: String, flags: Array[String])(implicit outDirectory: String): CompilationTest = { + def compileDir(f: String, flags: Array[String], randomOrder: Option[Int] = None)(implicit outDirectory: String): CompilationTest = { val callingMethod = getCallingMethod val outDir = outDirectory + callingMethod + "/" val sourceDir = new JFile(f) @@ -1021,11 +1025,18 @@ trait ParallelTesting { self => if (f.isDirectory) f.listFiles.flatMap(flatten) else Array(f) + // Sort files either alphabetically or randomly using the provided seed: + val sortedFiles = flatten(sourceDir).sorted + val randomized = randomOrder match { + case None => sortedFiles + case Some(seed) => new Random(seed).shuffle(sortedFiles.toList).toArray + } + // Directories in which to compile all containing files with `flags`: val targetDir = new JFile(outDir + "/" + sourceDir.getName + "/") targetDir.mkdirs() - val target = JointCompilationSource(callingMethod, flatten(sourceDir), flags, targetDir) + val target = JointCompilationSource(callingMethod, randomized, flags, targetDir) new CompilationTest(target) }