Skip to content

Commit

Permalink
Fix scalacOptions mill overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
WojciechMazur committed Jan 10, 2024
1 parent dae6f7f commit c06199f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object MillScalacOptionsOverride {
}
}
import MillCommunityBuild._
def scalacOptions = List.empty[String].mapScalacOptions()
def scalacOptions = { List.empty[String] }.mapScalacOptions()
object mill{
import scala.language.implicitConversions
trait T[U]
Expand All @@ -21,29 +21,29 @@ object MillScalacOptionsOverride {
import mill._

object module {
val scalacOptions = Nil.mapScalacOptions()
val scalacOptions = { Nil }.mapScalacOptions()
}
object module2 {
def scalacOptions: Seq[String] = Seq("-Xprint:typer").mapScalacOptions()
def scalacOptions: Seq[String] = { Seq("-Xprint:typer") }.mapScalacOptions()
}

object module3 {
def scalacOptions = mill.T(module2.scalacOptions).mapScalacOptions()
def scalacOptions = { mill.T(module2.scalacOptions) }.mapScalacOptions()
}

class moduleDef {
def scalacOptions: T[Seq[String]] = {
def scalacOptions: T[Seq[String]] = { {
val opt1 = "-release:11"
Seq(opt1)
}.mapScalacOptions()
} }.mapScalacOptions()
}
class moduleDef2 extends moduleDef {
override val scalacOptions: T[Seq[String]] = MillScalacOptionsOverride.scalacOptions.mapScalacOptions()
override val scalacOptions: T[Seq[String]] = { MillScalacOptionsOverride.scalacOptions }.mapScalacOptions()
}
object moduleDef3 extends moduleDef {
override def scalacOptions = T {
override def scalacOptions = { T {
super.scalacOptions ++ Nil
}.mapScalacOptions()
} }.mapScalacOptions()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class Scala3CommunityBuildMillAdapter(
}

case tree @ ValOrDefDef(Term.Name("scalacOptions"), _, body) =>
Patch.addRight(body, ".mapScalacOptions()")
Patch.addAround(body,"{ ", " }.mapScalacOptions()")

case ValOrDefDef(Term.Name(id), tpe, body) if scala3Identifiers.contains(id) =>
body.toString().trim() match {
Expand Down

0 comments on commit c06199f

Please sign in to comment.