From 41dce9e56818d6e21f55aaf108d5a75bf8f2cb33 Mon Sep 17 00:00:00 2001 From: jvican Date: Thu, 25 May 2017 11:24:04 +0200 Subject: [PATCH] Make sure that macro linter doesn't fail spuriously --- main-settings/src/main/scala/sbt/std/TaskLinterDSL.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main-settings/src/main/scala/sbt/std/TaskLinterDSL.scala b/main-settings/src/main/scala/sbt/std/TaskLinterDSL.scala index a4873793b..0f861d363 100644 --- a/main-settings/src/main/scala/sbt/std/TaskLinterDSL.scala +++ b/main-settings/src/main/scala/sbt/std/TaskLinterDSL.scala @@ -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)