Skip to content

Commit e5fc2be

Browse files
committed
Make 'namePos' return a point position if name is 'nme.ERROR'
'namePos' used to return nonsensical position when the tree was malformed (e.g. "case class").
1 parent d97bce0 commit e5fc2be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ object Trees {
338338
*/
339339
def namePos =
340340
if (pos.exists)
341-
if (rawMods.is(Synthetic)) Position(pos.point, pos.point)
341+
if (rawMods.is(Synthetic) || name.toTermName == nme.ERROR) Position(pos.point, pos.point)
342342
else Position(pos.point, pos.point + name.stripModuleClassSuffix.lastPart.length, pos.point)
343343
else pos
344344
}

0 commit comments

Comments
 (0)