@@ -318,13 +318,13 @@ object Build {
318318
319319 val baseOptions = overrideOptions.orElse(sharedOptions)
320320
321- val scopedSources = value(crossSources.scopedSources(baseOptions))
321+ val scopedSources : ScopedSources = value(crossSources.scopedSources(baseOptions))
322322
323- val mainSources =
323+ val mainSources : Sources =
324324 value(scopedSources.sources(Scope .Main , baseOptions, inputs.workspace, logger))
325325 val mainOptions = mainSources.buildOptions
326326
327- val testSources =
327+ val testSources : Sources =
328328 value(scopedSources.sources(Scope .Test , baseOptions, inputs.workspace, logger))
329329 val testOptions = testSources.buildOptions
330330
@@ -370,9 +370,7 @@ object Build {
370370
371371 def testBuildOpt (doc : Boolean = false ): Either [BuildException , Option [Build ]] = either {
372372 if (buildTests) {
373- val actualCompilerOpt =
374- if (doc) docCompilerOpt
375- else Some (compiler)
373+ val actualCompilerOpt = if doc then docCompilerOpt else Some (compiler)
376374 actualCompilerOpt match {
377375 case None => None
378376 case Some (actualCompiler) =>
@@ -384,7 +382,14 @@ object Build {
384382 extraClassPath = Seq (s.output)
385383 )
386384 )
387- val testOptions0 = extraTestOptions.orElse(testOptions)
385+ val testOptions0 = {
386+ val testOrExtra = extraTestOptions.orElse(testOptions)
387+ testOrExtra
388+ .copy(scalaOptions =
389+ // Scala options between scopes need to be compatible
390+ mainOptions.scalaOptions.orElse(testOrExtra.scalaOptions)
391+ )
392+ }
388393 val isScala2 =
389394 value(testOptions0.scalaParams).exists(_.scalaVersion.startsWith(" 2." ))
390395 val finalSources = if doc && isScala2 then
@@ -676,10 +681,8 @@ object Build {
676681 ): Either [BuildException , Unit ] = {
677682 val (errors, otherDiagnostics) = options.validate.partition(_.severity == Severity .Error )
678683 logger.log(otherDiagnostics)
679- if (errors.nonEmpty)
680- Left (CompositeBuildException (errors.map(new ValidationException (_))))
681- else
682- Right (())
684+ if errors.nonEmpty then Left (CompositeBuildException (errors.map(new ValidationException (_))))
685+ else Right (())
683686 }
684687
685688 def watch (
0 commit comments