File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
compiler/src/dotty/tools/dotc/ast Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -361,13 +361,16 @@ object Trees {
361
361
val nameStart =
362
362
if (point != span.start) point
363
363
else {
364
+ // Use an immutable ArraySeq to work around https://github.com/scala/bug/issues/11708
365
+ val content = collection.immutable.ArraySeq .unsafeWrapArray(source.content())
366
+
364
367
// Point might be too far away from start to be recorded. In this case we fall back to scanning
365
368
// forwards from the start offset for the name.
366
369
// Note: This might be inaccurate since scanning might hit accidentally the same
367
370
// name (e.g. in a comment) before finding the real definition.
368
371
// To make this behavior more robust we'd have to change the trees for definitions to contain
369
372
// a fully positioned Ident in place of a name.
370
- val idx = source. content() .indexOfSlice(realName, point)
373
+ val idx = content.indexOfSlice(realName, point)
371
374
if (idx >= 0 ) idx
372
375
else point // use `point` anyway. This is important if no source exists so scanning fails
373
376
}
You can’t perform that action at this time.
0 commit comments