File tree 2 files changed +21
-14
lines changed
compiler/src/dotty/tools/dotc/interactive
2 files changed +21
-14
lines changed Original file line number Diff line number Diff line change @@ -344,7 +344,7 @@ object Interactive {
344
344
if (tree.pos.contains(pos)) {
345
345
// FIXME: We shouldn't need a cast. Change NavigateAST.pathTo to return a List of Tree?
346
346
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 }
348
348
}
349
349
else Nil
350
350
@@ -365,7 +365,7 @@ object Interactive {
365
365
case nested :: encl :: rest =>
366
366
import typer .Typer ._
367
367
val outer = contextOfPath(encl :: rest)
368
- encl match {
368
+ try encl match {
369
369
case tree @ PackageDef (pkg, stats) =>
370
370
assert(tree.symbol.exists)
371
371
if (nested `eq` pkg) outer
@@ -401,6 +401,9 @@ object Interactive {
401
401
case _ =>
402
402
outer
403
403
}
404
+ catch {
405
+ case ex : CyclicReference => outer
406
+ }
404
407
}
405
408
406
409
/** 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 {
148
148
val names = new mutable.ListBuffer [String ]
149
149
dirClassPaths.foreach { dirCp =>
150
150
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
+ }
160
162
}
163
+ FileVisitResult .CONTINUE
161
164
}
162
- FileVisitResult .CONTINUE
163
- }
164
- })
165
+ })
166
+ catch {
167
+ case _ : NoSuchFileException =>
168
+ }
165
169
}
166
170
names.toList
167
171
}
You can’t perform that action at this time.
0 commit comments