Skip to content

Commit 78aa483

Browse files
Kordyjanprolativ
authored andcommitted
Change -scala-release flag into proper VersionSetting
1 parent 8006da3 commit 78aa483

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ trait CommonScalaSettings:
101101
val silentWarnings: Setting[Boolean] = BooleanSetting("-nowarn", "Silence all warnings.", aliases = List("--no-warnings"))
102102

103103
val release: Setting[String] = ChoiceSetting("-release", "release", "Compile code with classes specific to the given version of the Java platform available on the classpath and emit bytecode for this version.", ScalaSettings.supportedReleaseVersions, "", aliases = List("--release"))
104-
val scalaRelease: Setting[String] = ChoiceSetting("-scala-release", "release", "Emit TASTy files that can be consumed by specified version of the compiler.", List("3.0", "3.1"), "3.1", aliases = List("--scala-release"))
104+
val scalaRelease: Setting[ScalaVersion] = VersionSetting("-scala-release", "Emit TASTy files that can be consumed by specified version of the compiler.")
105105
val deprecation: Setting[Boolean] = BooleanSetting("-deprecation", "Emit warning and location for usages of deprecated APIs.", aliases = List("--deprecation"))
106106
val feature: Setting[Boolean] = BooleanSetting("-feature", "Emit warning and location for usages of features that should be imported explicitly.", aliases = List("--feature"))
107107
val explain: Setting[Boolean] = BooleanSetting("-explain", "Explain errors in more detail.", aliases = List("--explain"))

compiler/src/dotty/tools/dotc/core/Contexts.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import plugins._
3939
import java.util.concurrent.atomic.AtomicInteger
4040
import java.nio.file.InvalidPathException
4141
import dotty.tools.tasty.TastyFormat
42+
import dotty.tools.dotc.config.{ NoScalaVersion, SpecificScalaVersion, AnyScalaVersion }
4243

4344
object Contexts {
4445

@@ -485,10 +486,11 @@ object Contexts {
485486

486487
def tastyVersion: (Int, Int, Int) =
487488
base.settings.scalaRelease.value match
488-
case "" =>
489+
case NoScalaVersion =>
489490
import TastyFormat.*
490491
(MajorVersion, MinorVersion, ExperimentalVersion)
491-
case s"$maj.$min" => (maj.toInt + 25, min.toInt, 0)
492+
case SpecificScalaVersion(maj, min, _, _) => (maj.toInt + 25, min.toInt, 0)
493+
case AnyScalaVersion => (28, 0, 0) // 3.0
492494

493495
/** Is the debug option set? */
494496
def debug: Boolean = base.settings.Ydebug.value

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
215215

216216
case testSource @ SeparateCompilationSource(_, dir, flags, outDir) =>
217217
testSource.compilationGroups.map { (group, files) =>
218-
val flags1 = if group.target.isEmpty then flags else flags.and("-scala-release", group.target)
218+
val flags1 = if group.target.isEmpty then flags else flags.and(s"-scala-release:${group.target}")
219219
if group.compiler.isEmpty then
220220
compile(files, flags1, suppressErrors, outDir)
221221
else

0 commit comments

Comments
 (0)