Skip to content

Commit

Permalink
Merge pull request scala#10056 from som-snytt/topic/partest-release-8
Browse files Browse the repository at this point in the history
Partest uses -release 8
  • Loading branch information
som-snytt authored Jun 17, 2022
2 parents 73d11c0 + 5a38c5e commit 69bf66c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/partest/scala/tools/partest/nest/Runner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,15 @@ class Runner(val testInfo: TestInfo, val suiteRunner: AbstractRunner) {
}

// all sources in a round may contribute flags via // scalac: -flags
// if a javaVersion isn't specified, require the minimum viable using -release 8 to avoid gotcha in CI.
def flagsForCompilation(sources: List[File]): List[String] = {
val perFile = toolArgsFor(sources)("scalac")
if (parentFile.getParentFile.getName == "macro-annot") "-Ymacro-annotations" :: perFile
else perFile
import scala.util.Properties.isJavaAtLeast
var perFile = toolArgsFor(sources)("scalac")
if (parentFile.getParentFile.getName == "macro-annot")
perFile ::= "-Ymacro-annotations"
if (isJavaAtLeast(9) && !perFile.exists(_.startsWith("-release")) && toolArgsFor(sources)("javaVersion", split = false).isEmpty)
perFile :::= List("-release", "8")
perFile
}

// inspect sources for tool args
Expand Down
7 changes: 7 additions & 0 deletions test/files/neg/choices.check
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#partest java9+
error: Usage: -Yresolve-term-conflict:<strategy> where <strategy> choices are package, object, error (default: error).
error: bad option: '-Yresolve-term-conflict'
error: bad options: -release 8 -Yresolve-term-conflict
error: flags file may only contain compiler options, found: -Yresolve-term-conflict
4 errors
#partest java8
error: Usage: -Yresolve-term-conflict:<strategy> where <strategy> choices are package, object, error (default: error).
error: bad option: '-Yresolve-term-conflict'
error: bad options: -Yresolve-term-conflict
Expand Down
6 changes: 6 additions & 0 deletions test/files/neg/partestInvalidFlag.check
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#partest java9+
error: bad option: '-badCompilerFlag'
error: bad options: -release 8 -badCompilerFlag notAFlag -opt:badChoice
error: flags file may only contain compiler options, found: -badCompilerFlag notAFlag -opt:badChoice
3 errors
#partest java8
error: bad option: '-badCompilerFlag'
error: bad options: -badCompilerFlag notAFlag -opt:badChoice
error: flags file may only contain compiler options, found: -badCompilerFlag notAFlag -opt:badChoice
Expand Down

0 comments on commit 69bf66c

Please sign in to comment.