From 8c1344d599079f142675eb1cd627847b1edf87c8 Mon Sep 17 00:00:00 2001 From: Liu Fengyun Date: Sat, 4 May 2019 21:59:41 +0200 Subject: [PATCH] Fix #6452: capture plugin ordering conflict with a pos projct --- .../appOK/src/main/scala/hello/Hello.scala | 8 ++++++++ sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/build.sbt | 6 ++++++ .../sbt-test/sbt-dotty/compiler-plugin/changes/build.sbt | 7 +++++++ .../sbt-dotty/compiler-plugin/plugin/DivideZero.scala | 4 ++-- sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/test | 4 ++++ 5 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/appOK/src/main/scala/hello/Hello.scala diff --git a/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/appOK/src/main/scala/hello/Hello.scala b/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/appOK/src/main/scala/hello/Hello.scala new file mode 100644 index 000000000000..c6773576244a --- /dev/null +++ b/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/appOK/src/main/scala/hello/Hello.scala @@ -0,0 +1,8 @@ +package hello + +object Hello { + def main(args: Array[String]): Unit = { + val dotty: Int | String = "dotty" + println(s"Hello $dotty!") + } +} diff --git a/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/build.sbt b/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/build.sbt index 507bd86a4fda..9cb90384cffe 100644 --- a/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/build.sbt +++ b/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/build.sbt @@ -22,3 +22,9 @@ lazy val app = project .settings( scalaVersion := dottyVersion ) + +lazy val appOk = project + .in(file("appOk")) + .settings( + scalaVersion := dottyVersion + ) \ No newline at end of file diff --git a/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/changes/build.sbt b/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/changes/build.sbt index 7b0ee8ccf6f8..1c44853ecce4 100644 --- a/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/changes/build.sbt +++ b/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/changes/build.sbt @@ -19,3 +19,10 @@ lazy val app = project scalaVersion := dottyVersion, addCompilerPlugin("ch.epfl.lamp" %% "dividezero" % "0.0.1") ) + +lazy val appOk = project + .in(file("appOk")) + .settings( + scalaVersion := dottyVersion, + addCompilerPlugin("ch.epfl.lamp" %% "dividezero" % "0.0.1") + ) \ No newline at end of file diff --git a/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/plugin/DivideZero.scala b/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/plugin/DivideZero.scala index b570e4ae6d11..feadac22115f 100644 --- a/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/plugin/DivideZero.scala +++ b/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/plugin/DivideZero.scala @@ -19,8 +19,8 @@ class DivideZero extends PluginPhase with StandardPlugin { val phaseName = name - override val runsAfter = Set(Pickler.name) - override val runsBefore = Set(Staging.name) + override val runsAfter = Set(Staging.name) + override val runsBefore = Set(Pickler.name) def init(options: List[String]): List[PluginPhase] = this :: Nil diff --git a/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/test b/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/test index fa26524a6f68..35d9f1be8fe2 100644 --- a/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/test +++ b/sbt-dotty/sbt-test/sbt-dotty/compiler-plugin/test @@ -8,6 +8,10 @@ $ copy-file changes/build.sbt build.sbt > reload +# Should compile with the plugin +> clean +> appOk/compile + # Should NOT compile with the plugin > clean -> app/compile