File tree Expand file tree Collapse file tree 2 files changed +21
-14
lines changed
compiler/src/dotty/tools/dotc/interactive Expand file tree Collapse file tree 2 files changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -344,7 +344,7 @@ object Interactive {
344344 if (tree.pos.contains(pos)) {
345345 // FIXME: We shouldn't need a cast. Change NavigateAST.pathTo to return a List of Tree?
346346 val path = NavigateAST .pathTo(pos, tree, skipZeroExtent = true ).asInstanceOf [List [untpd.Tree ]]
347- path.dropWhile(! _.hasType). asInstanceOf [ List [ tpd.Tree ]]
347+ path.dropWhile(! _.hasType) collect { case t : tpd.Tree @ unchecked => t }
348348 }
349349 else Nil
350350
@@ -365,7 +365,7 @@ object Interactive {
365365 case nested :: encl :: rest =>
366366 import typer .Typer ._
367367 val outer = contextOfPath(encl :: rest)
368- encl match {
368+ try encl match {
369369 case tree @ PackageDef (pkg, stats) =>
370370 assert(tree.symbol.exists)
371371 if (nested `eq` pkg) outer
@@ -401,6 +401,9 @@ object Interactive {
401401 case _ =>
402402 outer
403403 }
404+ catch {
405+ case ex : CyclicReference => outer
406+ }
404407 }
405408
406409 /** The first tree in the path that is a definition. */
Original file line number Diff line number Diff line change @@ -148,20 +148,24 @@ class InteractiveDriver(settings: List[String]) extends Driver {
148148 val names = new mutable.ListBuffer [String ]
149149 dirClassPaths.foreach { dirCp =>
150150 val root = dirCp.dir.toPath
151- Files .walkFileTree(root, new SimpleFileVisitor [Path ] {
152- override def visitFile (path : Path , attrs : BasicFileAttributes ) = {
153- if (! attrs.isDirectory) {
154- val name = path.getFileName.toString
155- for {
156- tastySuffix <- tastySuffixes
157- if name.endsWith(tastySuffix)
158- } {
159- names += root.relativize(path).toString.replace(" /" , " ." ).stripSuffix(tastySuffix)
151+ try
152+ Files .walkFileTree(root, new SimpleFileVisitor [Path ] {
153+ override def visitFile (path : Path , attrs : BasicFileAttributes ) = {
154+ if (! attrs.isDirectory) {
155+ val name = path.getFileName.toString
156+ for {
157+ tastySuffix <- tastySuffixes
158+ if name.endsWith(tastySuffix)
159+ } {
160+ names += root.relativize(path).toString.replace(" /" , " ." ).stripSuffix(tastySuffix)
161+ }
160162 }
163+ FileVisitResult .CONTINUE
161164 }
162- FileVisitResult .CONTINUE
163- }
164- })
165+ })
166+ catch {
167+ case _ : NoSuchFileException =>
168+ }
165169 }
166170 names.toList
167171 }
You can’t perform that action at this time.
0 commit comments