Skip to content

Commit 7aee2b5

Browse files
committed
Only inline from current project sources under enableOptimizer
Otherwise we can inline bytecode public, but unstable, artifacts from the standard library, as was see in: scala/scala#6300 (comment)
1 parent d9e512d commit 7aee2b5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/scala/ScalaModulePlugin.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ object ScalaModulePlugin extends AutoPlugin {
5151
}
5252
scalaVersions
5353
},
54-
54+
enableOptimizerInlineFrom := "<sources>",
5555
scalaVersion := crossScalaVersions.value.head
5656
)
5757

58+
val enableOptimizerInlineFrom = settingKey[String]("The value passed to -opt-inline-from by `enableOptimizer` on 2.13 and higher")
5859
/**
5960
* Enable `-opt:l:inline`, `-opt:l:classpath` or `-optimize`, depending on the scala version.
6061
*/
@@ -63,8 +64,8 @@ object ScalaModulePlugin extends AutoPlugin {
6364
val Ver("2", maj, min) = scalaVersion.value
6465
(maj.toInt, min.toInt) match {
6566
case (m, _) if m < 12 => Seq("-optimize")
66-
case (12, n) if n < 3 => Seq("-opt:l:classpath")
67-
case _ => Seq("-opt:l:inline", "-opt-inline-from:scala/**")
67+
case (12, n) if n < 3 => Seq("-opt:l:project")
68+
case _ => Seq("-opt:l:inline", "-opt-inline-from:" + enableOptimizerInlineFrom.value)
6869
}
6970
}
7071

0 commit comments

Comments
 (0)