mirror of https://github.com/sbt/sbt.git
[2.x] Fix macro expand for HKT type arguments (#9377)
Def.setting and Def.task macro expansion looks for internal wrapper call generated for .value. It visits all function calls in the macro. If the block contains functions call whose type parameter is HKT, macro expansion crashed. Macro expansion tries to match IO against '[a], and failed with MatchError. This commit adds wildcard pattern, and leave unmatched type arguments unchanged.
This commit is contained in:
parent
7575c5a1be
commit
10f98e6c01
|
|
@ -64,6 +64,8 @@ trait Convert[C <: Quotes & Singleton] extends ContextUtil[C]:
|
|||
report.errorAndAbort(message, position)
|
||||
case _ =>
|
||||
super.transformTerm(tree)(owner)
|
||||
case _ =>
|
||||
super.transformTerm(tree)(owner)
|
||||
case _ =>
|
||||
super.transformTerm(tree)(owner)
|
||||
end appTransformer
|
||||
|
|
|
|||
|
|
@ -29,6 +29,30 @@ object UseTask:
|
|||
}
|
||||
end UseTask
|
||||
|
||||
// https://github.com/sbt/sbt/issues/9375
|
||||
object UseHktTypeArgument:
|
||||
final class IO[A]
|
||||
|
||||
object Builder:
|
||||
def apply[F[_]](value: String): String = value
|
||||
|
||||
val settingWithHktTypeArgument: Def.Initialize[String] = Def.setting {
|
||||
Builder[IO]("setting")
|
||||
}
|
||||
|
||||
val taskWithHktTypeArgument: Def.Initialize[Task[String]] = Def.task {
|
||||
Builder[IO]("task")
|
||||
}
|
||||
|
||||
val name = Def.settingKey[String]("name")
|
||||
val key = Def.taskKey[String]("key")
|
||||
val settings = Seq(
|
||||
key := Def.uncached {
|
||||
Builder[IO](name.value)
|
||||
}
|
||||
)
|
||||
end UseHktTypeArgument
|
||||
|
||||
object Assign {
|
||||
import java.io.File
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue