mirror of https://github.com/sbt/sbt.git
Make sure that macro linter doesn't fail spuriously
This commit is contained in:
parent
8de2bfe461
commit
41dce9e568
|
|
@ -40,11 +40,12 @@ object TaskLinterDSL extends LinterDSL {
|
||||||
case Typed(expr, tt: TypeTree) if tt.original != null =>
|
case Typed(expr, tt: TypeTree) if tt.original != null =>
|
||||||
tt.original match {
|
tt.original match {
|
||||||
case Annotated(annot, arg) =>
|
case Annotated(annot, arg) =>
|
||||||
annot.tpe match {
|
Option(annot.tpe) match {
|
||||||
case AnnotatedType(annotations, _) =>
|
case Some(AnnotatedType(annotations, _)) =>
|
||||||
val symAnnotations = annotations.map(_.tree.tpe.typeSymbol)
|
val symAnnotations = annotations.map(_.tree.tpe.typeSymbol)
|
||||||
val isUnchecked = symAnnotations.contains(unchecked)
|
val isUnchecked = symAnnotations.contains(unchecked)
|
||||||
if (isUnchecked) {
|
if (isUnchecked) {
|
||||||
|
// Unwrap the expression behind the typed that sbt macro adds
|
||||||
val toAdd = arg match {
|
val toAdd = arg match {
|
||||||
case Typed(`expr`, _) => `expr`
|
case Typed(`expr`, _) => `expr`
|
||||||
case `tree` => `tree`
|
case `tree` => `tree`
|
||||||
|
|
@ -53,6 +54,7 @@ object TaskLinterDSL extends LinterDSL {
|
||||||
}
|
}
|
||||||
case _ =>
|
case _ =>
|
||||||
}
|
}
|
||||||
|
case _ =>
|
||||||
}
|
}
|
||||||
super.traverse(expr)
|
super.traverse(expr)
|
||||||
case tree => super.traverse(tree)
|
case tree => super.traverse(tree)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue