8000 Add Scala 3 aliases, limit release, adjust target · scala/scala@f84aa78 · GitHub
[go: up one dir, main page]

Skip to content

Commit f84aa78

Browse files
committed
Add Scala 3 aliases, limit release, adjust target
1 parent 9036bd4 commit f84aa78

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ trait StandardScalaSettings { _: MutableSettings =>
6969
if (releaseValue.map(_.toInt < setting.value.toInt).getOrElse(false)) errorFn("-release cannot be less than -target")
7070
}
7171
.withAbbreviation("--target")
72+
.withAbbreviation("--Xtarget")
73+
.withAbbreviation("-Xtarget")
74+
.withAbbreviation("-Xunchecked-java-output-version")
7275
.withDeprecationMessage("Use -release instead to compile against the correct platform API.")
73-
def targetValue: String = target.valueSetByUser.orElse(releaseValue).getOrElse(target.value)
76+
def targetValue: String = releaseValue.getOrElse(target.value)
7477
val unchecked = BooleanSetting ("-unchecked", "Enable additional warnings where generated code depends on assumptions. See also -Wconf.") withAbbreviation "--unchecked" withPostSetHook { s =>
7578
if (s.value) Wconf.tryToSet(List(s"cat=unchecked:w"))
7679
else Wconf.tryToSet(List(s"cat=unchecked:s"))
@@ -84,6 +87,7 @@ trait StandardScalaSettings { _: MutableSettings =>
8487
// Support passe prefixes of -target values:
8588
// - `jvm-` (from back when we also had `msil`)
8689
// - `1.` (from back when Java 2 was a possibility)
90+
// Otherwise, `-release` could be `IntSetting`.
8791
private def normalizeTarget(in: String): String = {
8892
val jvmish = raw"jvm-(\d*)".r
8993
in match {
@@ -95,9 +99,8 @@ trait StandardScalaSettings { _: MutableSettings =>
9599
}
96100

97101
object StandardScalaSettings {
98-
// not final in case some separately compiled client code wanted to depend on updated values
99102
val MinTargetVersion = 8
100-
val MaxTargetVersion = 18
103+
val MaxTargetVersion = javaSpecVersion.toInt
101104

102105
private val AllTargetVersions = (MinTargetVersion to MaxTargetVersion).map(_.toString).to(List)
103106
}

0 commit comments

Comments
 (0)
0