From 7bc4e0f502389ca1bc7b7e698f0ad9c2ae62802f Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Wed, 25 Nov 2020 11:32:50 +0100 Subject: [PATCH] Fix source-dependencies/macro-expansion-dependencies-2 In 80ed86aa1bc8a4643cee80855afe32dc88aed964 we removed some explicit parameter names which made incremental compilation behave diferently than what the original test expected. At some point, the macro implementation failed to compile which regiseted as a success for `-> compile`. Now we test that the macros compile before testing the error that they emit. --- .../changes/MacroRuntimeCompileError.scala | 2 +- .../changes/MacroRuntimeRuntimeError.scala | 2 +- .../{ => changes}/Main.scala | 0 .../macro-expansion-dependencies-2/test | 12 ++++++++++-- 4 files changed, 12 insertions(+), 4 deletions(-) rename sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/{ => changes}/Main.scala (100%) diff --git a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeCompileError.scala b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeCompileError.scala index 71d12b8d6d7f..2d2e2b52d00d 100644 --- a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeCompileError.scala +++ b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeCompileError.scala @@ -2,7 +2,7 @@ import scala.quoted._ object MacroRuntime { - def impl()(using Quotes): Expr[Unit] = { + def impl()(using q: Quotes): Expr[Unit] = { import quotes.reflect._ Reporting.error("some error", Position.ofMacroExpansion) '{ println("Implementation in MacroCompileError") } diff --git a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeRuntimeError.scala b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeRuntimeError.scala index caa79c3d24b5..e917a255af64 100644 --- a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeRuntimeError.scala +++ b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/MacroRuntimeRuntimeError.scala @@ -2,7 +2,7 @@ import scala.quoted._ object MacroRuntime { - def impl()(using Quotes): Expr[Unit] = { + def impl()(using q: Quotes): Expr[Unit] = { '{ ??? } } diff --git a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/Main.scala b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/Main.scala similarity index 100% rename from sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/Main.scala rename to sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/changes/Main.scala diff --git a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/test b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/test index 3799f31d477a..10cfbcb78b6c 100644 --- a/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/test +++ b/sbt-dotty/sbt-test/source-dependencies/macro-expansion-dependencies-2/test @@ -1,9 +1,18 @@ +$ copy-file changes/MacroRuntimeCompileError.scala MacroRuntime.scala +> clean +> compile + +$ copy-file changes/MacroRuntimeRuntimeError.scala MacroRuntime.scala +> clean +> compile + +$ copy-file changes/Main.scala Main.scala $ copy-file changes/MacroRuntime.scala MacroRuntime.scala +> clean > run # use an implemntation of the macro that emits a compile time error $ copy-file changes/MacroRuntimeCompileError.scala MacroRuntime.scala -> clean -> compile $ copy-file changes/MacroRuntime.scala MacroRuntime.scala @@ -11,5 +20,4 @@ $ copy-file changes/MacroRuntime.scala MacroRuntime.scala > compile $ copy-file changes/MacroRuntimeRuntimeError.scala MacroRuntime.scala -> clean -> run