Skip to content

Commit

Permalink
Merge pull request #7476 from dotty-staging/fix-#7189
Browse files Browse the repository at this point in the history
Fix #7189: Do not try to load contents if file does not exist
  • Loading branch information
nicolasstucki authored Oct 31, 2019
2 parents 1fe9555 + f87d240 commit f73eec7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/ast/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ object Trees {
// name (e.g. in a comment) before finding the real definition.
// To make this behavior more robust we'd have to change the trees for definitions to contain
// a fully positioned Ident in place of a name.
val idx = source.content().indexOfSlice(realName, point)
val contents = if source.exists then source.content() else Array.empty[Char]
val idx = contents.indexOfSlice(realName, point)
if (idx >= 0) idx
else point // use `point` anyway. This is important if no source exists so scanning fails
}
Expand Down

0 comments on commit f73eec7

Please sign in to comment.