Check for null type trees in dependency extraction

In some cases the dependency extraction may encounter a null `TypeTree`
(eg. arguments of macro annotations that are untyped). In such cases,
we simply ignore the node.

Fixes #1593, #1655.
This commit is contained in:
Martin Duhem 2014-11-29 12:07:40 +01:00
parent d47d0b1463
commit 18c521dd4b
1 changed files with 3 additions and 1 deletions

View File

@ -137,7 +137,9 @@ final class Dependency(val global: CallbackGlobal) extends LocateClassFile {
*/
case ident: Ident =>
addDependency(ident.symbol)
case typeTree: TypeTree =>
// In some cases (eg. macro annotations), `typeTree.tpe` may be null.
// See sbt/sbt#1593 and sbt/sbt#1655.
case typeTree: TypeTree if typeTree.tpe != null =>
val typeSymbolCollector = new CollectTypeTraverser({
case tpe if !tpe.typeSymbol.isPackage => tpe.typeSymbol
})