Skip to content

Commit bbc997c

Browse files
committed
Address reviewers comments
1 parent 9705ec7 commit bbc997c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

compiler/src/dotty/tools/dotc/interactive/Interactive.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,10 @@ object Interactive {
341341
}
342342

343343
def pathTo(tree: Tree, pos: Position)(implicit ctx: Context): List[Tree] =
344-
if (tree.pos.contains(pos)) {
345-
// FIXME: We shouldn't need a cast. Change NavigateAST.pathTo to return a List of Tree?
346-
val path = NavigateAST.pathTo(pos, tree, skipZeroExtent = true).asInstanceOf[List[untpd.Tree]]
347-
path.dropWhile(!_.hasType).asInstanceOf[List[tpd.Tree]]
348-
}
344+
if (tree.pos.contains(pos))
345+
NavigateAST.pathTo(pos, tree, skipZeroExtent = true)
346+
.collect { case t: untpd.Tree => t }
347+
.dropWhile(!_.hasType).asInstanceOf[List[tpd.Tree]]
349348
else Nil
350349

351350
def contextOfStat(stats: List[Tree], stat: Tree, exprOwner: Symbol, ctx: Context): Context = stats match {

0 commit comments

Comments
 (0)