Skip to content

Commit

Permalink
Check for null type trees in dependency extraction
Browse files Browse the repository at this point in the history
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 sbt#1593, sbt#1655.
  • Loading branch information
Martin Duhem authored and indrajitr committed Jan 16, 2015
1 parent 271b3de commit 87e6219
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compile/interface/src/main/scala/xsbt/Dependency.scala
Expand Up @@ -139,7 +139,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
})
Expand Down

0 comments on commit 87e6219

Please sign in to comment.