Unreachable code not well detected
Open
- Dominant language
- Rust
- Stars
- 22.3k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Flow version: 0.44.1
```
function foo(): string {
if (true) {
return ''
}
}
function bar(): string {
while (true) {
return ''
}
}
```
Flow complained:
```
1: function foo(): string {
^ string. This type is incompatible with an implicitly-returned undefined.
7: function bar(): string {
^ string. This type is incompatible with an implicitly-returned undefined.
```
while I expected it would pass since both implicitly-returned undefineds are unreachable.
Contributor guide
Assessment
This issue has not been assessed yet.