Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #7189: Do not try to load contents if file does not exist #7476

Merged
merged 1 commit into from
Oct 31, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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