Skip to content

Commit

Permalink
Partest uses -release 8
Browse files Browse the repository at this point in the history
  • Loading branch information
som-snytt committed Jun 9, 2022
1 parent 4825ade commit bde3157
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
9 changes: 6 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,13 @@ 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) && 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 bde3157

Please sign in to comment.