Skip to content

Commit 4a57142

Browse files
authored
Merge pull request #155 from mdedetrich/dont-make-optimizer-fail-on-scala3
Don't make ScalaModulePlugin.enableOptimizer fail on Scala3
2 parents e7b7416 + 9f7d169 commit 4a57142

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/scala/ScalaModulePlugin.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,12 @@ object ScalaModulePlugin extends AutoPlugin {
5050
*/
5151
lazy val enableOptimizer: Setting[_] = Compile / compile / scalacOptions ++= {
5252
val Ver = """(\d+)\.(\d+)\.(\d+).*""".r
53-
val Ver("2", maj, min) = scalaVersion.value
54-
(maj.toInt, min.toInt) match {
55-
case (m, _) if m < 12 => Seq("-optimize")
56-
case (12, n) if n < 3 => Seq("-opt:l:project")
57-
case _ => Seq("-opt:l:inline", "-opt-inline-from:" + scalaModuleEnableOptimizerInlineFrom.value)
53+
val Ver(epic, maj, min) = scalaVersion.value
54+
(epic, maj.toInt, min.toInt) match {
55+
case ("2", m, _) if m < 12 => Seq("-optimize")
56+
case ("2", 12, n) if n < 3 => Seq("-opt:l:project")
57+
case ("2", _, _) => Seq("-opt:l:inline", "-opt-inline-from:" + scalaModuleEnableOptimizerInlineFrom.value)
58+
case ("3", _, _) => Nil // Optimizer not yet available for Scala3, see https://docs.scala-lang.org/overviews/compiler-options/optimizer.html
5859
}
5960
}
6061

0 commit comments

Comments
 (0)