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
This commit is contained in:
Eugene Yokota 2017-05-26 01:01:26 -04:00
parent 06c5ef4208
commit 5dc46e3cf2
2 changed files with 5 additions and 4 deletions

View File

@ -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)
}
}

View File

@ -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 }