diff --git a/sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/build.sbt b/sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/build.sbt index 8da13c7ec..d0ea98a81 100644 --- a/sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/build.sbt +++ b/sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/build.sbt @@ -1,4 +1,4 @@ -ThisBuild / scalaVersion := "3.1.3" +ThisBuild / scalaVersion := "3.3.7" lazy val plugin = project .in(file("plugin")) @@ -18,12 +18,6 @@ lazy val plugin = project lazy val app = project .in(file("app")) - .settings( - scalaVersion := dottyVersion - ) lazy val appOk = project .in(file("appOk")) - .settings( - scalaVersion := dottyVersion - ) diff --git a/sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/changes/build.sbt b/sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/changes/build.sbt index 3c716e1bb..3c6d9a9dd 100644 --- a/sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/changes/build.sbt +++ b/sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/changes/build.sbt @@ -1,4 +1,4 @@ -lazy val dottyVersion = "3.1.3" +lazy val dottyVersion = "3.3.7" lazy val plugin = project .in(file("plugin")) diff --git a/sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/plugin/DivideZero.scala b/sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/plugin/DivideZero.scala index feadac221..1efa373ac 100644 --- a/sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/plugin/DivideZero.scala +++ b/sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/plugin/DivideZero.scala @@ -10,7 +10,7 @@ import transform.MegaPhase.MiniPhase import Decorators._ import Symbols.Symbol import Constants.Constant -import transform.{Pickler, Staging} +import typer.TyperPhase /** Compiler plugin that emits an error when compiling a division by zero */ class DivideZero extends PluginPhase with StandardPlugin { @@ -19,21 +19,20 @@ class DivideZero extends PluginPhase with StandardPlugin { val phaseName = name - override val runsAfter = Set(Staging.name) - override val runsBefore = Set(Pickler.name) + override val runsAfter = Set(TyperPhase.name) def init(options: List[String]): List[PluginPhase] = this :: Nil - private def isNumericDivide(sym: Symbol)(implicit ctx: Context): Boolean = { + private def isNumericDivide(sym: Symbol)(using Context): Boolean = { def test(tpe: String): Boolean = - (sym.owner eq ctx.requiredClass(tpe)) && sym.name.show == "/" + (sym.owner eq Symbols.requiredClass(tpe)) && sym.name.show == "/" test("scala.Int") || test("scala.Long") || test("scala.Short") || test("scala.Float") || test("scala.Double") } - override def transformApply(tree: tpd.Apply)(implicit ctx: Context): tpd.Tree = tree match { + override def transformApply(tree: tpd.Apply)(using Context): tpd.Tree = tree match { case tpd.Apply(fun, tpd.Literal(Constants.Constant(v)) :: Nil) if isNumericDivide(fun.symbol) && v == 0 => - ctx.error("divide by zero", tree.sourcePos) + report.error("divide by zero", tree.sourcePos) tpd.Literal(Constant(0)) case _ => tree diff --git a/sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/disabled b/sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/test similarity index 100% rename from sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/disabled rename to sbt-app/src/sbt-test/plugins/dotty-compiler-plugin/test