Detect continuations at start-of-file (#5173)

## Summary

Given:

```python
\
import os
```

Deleting `import os` leaves a syntax error: a file can't end in a
continuation. We have code to handle this case, but it failed to pick up
continuations at the _very start_ of a file.

Closes #5156.
This commit is contained in:
Charlie Marsh 2023-06-19 00:09:02 -04:00 committed by GitHub
parent a6cf31cc89
commit 2b82caa163
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,10 +49,7 @@ impl Indexer {
}
// Newlines after a newline never form a continuation.
if !matches!(
prev_token,
Some(Tok::Newline | Tok::NonLogicalNewline) | None
) {
if !matches!(prev_token, Some(Tok::Newline | Tok::NonLogicalNewline)) {
continuation_lines.push(line_start);
}