Skip to content

Commit d198b18

Browse files
committed
Fix namePos in SourceTree as well
1 parent 7faeced commit d198b18

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import scala.io.Codec
66

77
import ast.tpd
88
import core._, core.Decorators.{sourcePos => _, _}
9-
import Contexts._, NameOps._, Symbols._
9+
import Contexts._, NameOps._, Symbols._, StdNames._
1010
import util._, util.Positions._
1111

1212
/** A typechecked named `tree` coming from `source` */
@@ -18,7 +18,7 @@ case class SourceTree(tree: tpd.NameTree, source: SourceFile) {
1818
def namePos(implicit ctx: Context): SourcePosition = {
1919
// FIXME: Merge with NameTree#namePos ?
2020
val treePos = tree.pos
21-
if (treePos.isZeroExtent)
21+
if (treePos.isZeroExtent || tree.name.toTermName == nme.ERROR)
2222
NoSourcePosition
2323
else {
2424
val nameLength = tree.name.stripModuleClassSuffix.show.toString.length

0 commit comments

Comments
 (0)