From 5dc46e3cf2e08b3d95d1e94581f7fe26ce18b9e4 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 26 May 2017 01:01:26 -0400 Subject: [PATCH] fix restligeist macro Fixes sbt/sbt#3157 Before: PgpSettings.scala:99: exception during macro expansion: [error] java.lang.RuntimeException: Unexpected macro application tree (class scala.reflect.internal.Trees$Apply): PgpKeys.pgpStaticContext.<<=(sbt.this.Scoped.t2ToApp2[sbt.File, sbt.File](scala.Tuple2.apply[sbt.SettingKey[sbt.File], sbt.SettingKey[sbt.File]](PgpKeys.pgpPublicRing, PgpKeys.pgpSecretRing)).apply[com.jsuereth.pgp.cli.PgpStaticContext]({ [error] ((publicKeyRingFile: sbt.File, secretKeyRingFile: sbt.File) => SbtPgpStaticContext.apply(publicKeyRingFile, secretKeyRingFile)) After: build.sbt:18: error: `<<=` operator is removed. Use `key := { x.value }` or `key ~= (old => { newValue })`. See http://www.scala-sbt.org/1.0/docs/Migrating-from-sbt-012x.html publishLocal <<= foo // publishLocal.dependsOn(foo) ^ [error] sbt.compiler.EvalException: Type error in expression --- .../scala/sbt/internal/util/appmacro/ContextUtil.scala | 1 + main-settings/src/main/scala/sbt/std/TaskMacro.scala | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core-macros/src/main/scala/sbt/internal/util/appmacro/ContextUtil.scala b/core-macros/src/main/scala/sbt/internal/util/appmacro/ContextUtil.scala index 6bdbb2250..7b3c0e625 100644 --- a/core-macros/src/main/scala/sbt/internal/util/appmacro/ContextUtil.scala +++ b/core-macros/src/main/scala/sbt/internal/util/appmacro/ContextUtil.scala @@ -27,6 +27,7 @@ object ContextUtil { import c.universe._ c.macroApplication match { case s @ Select(Apply(_, t :: Nil), tp) => f(c.Expr[Any](t), s.pos) + case a @ Apply(_, t :: Nil) => f(c.Expr[Any](t), a.pos) case x => unexpectedTree(x) } } diff --git a/main-settings/src/main/scala/sbt/std/TaskMacro.scala b/main-settings/src/main/scala/sbt/std/TaskMacro.scala index 690e7bfd7..a8a925c53 100644 --- a/main-settings/src/main/scala/sbt/std/TaskMacro.scala +++ b/main-settings/src/main/scala/sbt/std/TaskMacro.scala @@ -82,12 +82,12 @@ object TaskMacro { final val InputTaskCreateDynName = "createDyn" final val InputTaskCreateFreeName = "createFree" final val append1Migration = - "`<+=` operator is deprecated. Try `lhs += { x.value }`\n or see http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html." + "`<+=` operator is removed. Try `lhs += { x.value }`\n or see http://www.scala-sbt.org/1.0/docs/Migrating-from-sbt-012x.html." final val appendNMigration = - "`<++=` operator is deprecated. Try `lhs ++= { x.value }`\n or see http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html." + "`<++=` operator is removed. Try `lhs ++= { x.value }`\n or see http://www.scala-sbt.org/1.0/docs/Migrating-from-sbt-012x.html." final val assignMigration = - """`<<=` operator is deprecated. Use `key := { x.value }` or `key ~= (old => { newValue })`. - |See http://www.scala-sbt.org/0.13/docs/Migrating-from-sbt-012x.html""".stripMargin + """`<<=` operator is removed. Use `key := { x.value }` or `key ~= (old => { newValue })`. + |See http://www.scala-sbt.org/1.0/docs/Migrating-from-sbt-012x.html""".stripMargin import LinterDSL.{ Empty => EmptyLinter }