Skip to content

Commit 987d986

Browse files
committed
Consider minTargetVersion as always supported
1 parent 4025951 commit 987d986

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ object ScalaSettings:
2424
val jdkVersion = JDK9Reflectors.runtimeVersionMajor(JDK9Reflectors.runtimeVersion()).intValue()
2525
val maxVersion = Math.min(jdkVersion, maxTargetVersion)
2626
(minTargetVersion to maxVersion).toList.map(_.toString)
27-
else List()
27+
else List(minTargetVersion).map(_.toString)
2828

2929
def defaultClasspath: String = sys.env.getOrElse("CLASSPATH", ".")
3030

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class CompilationTests {
6464
compileFile("tests/pos-custom-args/help.scala", defaultOptions.and("-help", "-V", "-W", "-X", "-Y")),
6565
compileFile("tests/pos-custom-args/i10383.scala", defaultOptions.and("-source", "future", "-deprecation", "-Xfatal-warnings")),
6666
compileFile("tests/pos-custom-args/i13044.scala", defaultOptions.and("-Xmax-inlines:33")),
67+
compileFile("tests/pos-custom-args/jdk-8-app.scala", defaultOptions.and("-release:8")),
6768
).checkCompile()
6869
}
6970

@@ -184,6 +185,7 @@ class CompilationTests {
184185
compileDir("tests/neg-custom-args/hidden-type-errors", defaultOptions.and("-explain")),
185186
compileFile("tests/neg-custom-args/i13026.scala", defaultOptions.and("-print-lines")),
186187
compileFile("tests/neg-custom-args/i13838.scala", defaultOptions.and("-Ximplicit-search-limit", "1000")),
188+
compileFile("tests/neg-custom-args/jdk-9-app.scala", defaultOptions.and("-release:8")),
187189
).checkExpectedErrors()
188190
}
189191

tests/neg-custom-args/jdk-9-app.check

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- [E006] Not Found Error: tests/neg-custom-args/jdk-9-app.scala:4:10 --------------------------------------------------
2+
4 | println(ProcessHandle.current().pid()) // error: not found
3+
| ^^^^^^^^^^^^^
4+
| Not found: ProcessHandle
5+
6+
longer explanation available when compiling with `-explain`

tests/neg-custom-args/jdk-9-app.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import java.lang.ProcessHandle
2+
3+
object Jdk9App extends App {
4+
println(ProcessHandle.current().pid()) // error: not found
5+
}

tests/pos-custom-args/jdk-8-app.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import java.time.LocalDate
2+
3+
object Jdk8App extends App {
4+
println(LocalDate.now())
5+
}

0 commit comments

Comments
 (0)