Fix += interference with sbt-buildinfo

The macro pattern match was too general. This makes it tighter.

Fixes #3132
This commit is contained in:
Eugene Yokota 2017-04-22 22:59:33 -04:00
parent 76fe21eb0c
commit 90bda04695
4 changed files with 11 additions and 1 deletions

View File

@ -174,7 +174,8 @@ object TaskMacro {
val typeArgs = util.typeArgs(ttpe)
v.tree.tpe match {
// To allow Initialize[Task[A]] in the position of += RHS, we're going to call "taskValue" automatically.
case tpe if typeArgs.nonEmpty && (tpe weak_<:< c.weakTypeOf[Initialize[_]]) =>
case tpe if typeArgs.nonEmpty && (typeArgs.head weak_<:< c.weakTypeOf[Task[_]])
&& (tpe weak_<:< c.weakTypeOf[Initialize[_]]) =>
c.macroApplication match {
case Apply(Apply(TypeApply(Select(preT, nmeT), targs), _), _) =>
val tree = Apply(TypeApply(Select(preT, newTermName("+=").encodedName), TypeTree(typeArgs.head) :: Nil), Select(v.tree, newTermName("taskValue").encodedName) :: Nil)

View File

@ -0,0 +1,7 @@
// https://github.com/sbt/sbt/issues/3132
lazy val root = (project in file(".")).
enablePlugins(BuildInfoPlugin).
settings(
buildInfoKeys += name,
buildInfoPackage := "hello"
)

View File

@ -0,0 +1 @@
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0")

View File

@ -0,0 +1 @@
> compile