Make sure that macro linter doesn't fail spuriously

This commit is contained in:
jvican 2017-05-25 11:24:04 +02:00
parent 8de2bfe461
commit 41dce9e568
No known key found for this signature in database
GPG Key ID: 42DAFA0F112E8050
1 changed files with 4 additions and 2 deletions

View File

@ -40,11 +40,12 @@ object TaskLinterDSL extends LinterDSL {
case Typed(expr, tt: TypeTree) if tt.original != null =>
tt.original match {
case Annotated(annot, arg) =>
annot.tpe match {
case AnnotatedType(annotations, _) =>
Option(annot.tpe) match {
case Some(AnnotatedType(annotations, _)) =>
val symAnnotations = annotations.map(_.tree.tpe.typeSymbol)
val isUnchecked = symAnnotations.contains(unchecked)
if (isUnchecked) {
// Unwrap the expression behind the typed that sbt macro adds
val toAdd = arg match {
case Typed(`expr`, _) => `expr`
case `tree` => `tree`
@ -53,6 +54,7 @@ object TaskLinterDSL extends LinterDSL {
}
case _ =>
}
case _ =>
}
super.traverse(expr)
case tree => super.traverse(tree)