facebook / facebook/pyrefly

Go-to-def fails on unreachable branches

Open
#1,254 5 comments 0 reactions 0 assignees View on GitHub
language-server meta
Dominant language
Rust
Stars
7k
Forks
519
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

If we incorrectly infer the type of something, our control flow modeling will incorrectly treat branches as unreachable, and go-to-def does not work inside those branches.

The root cause of the unreachability in the sandbox example is https://github.com/facebook/pyrefly/issues/1159, but I think we would want go-to-def to work even if the branch is not reachable.

### Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeS4ATrgLYAEALqcROgOZ0Q3G6UN2UYANxiooAfSbEYAHXRyAxlFRw4dACrwGiOXT11MMMHXHjWEBqYAUcGFDABKHen2vOxvLihWADE91ugbb2hKh0ALx0AHK46LIugXR2ts6JbsFgoRF0AIx6AMR0bLgAtAylhsYA7rwA1moAFjCCAYEQxhlZEGrouPwxcalp%2BmGRnWGFxWUVRnRgqNCNzTAgADQgZIJgUKSE5TRQFIUACqRbO3RoWHj4dAqxkGwArpSoDBCxhHKFAMowMHQGgwGMQ4IgAPTgzZGHaEXhscEwdDgzC4BRwcH3dCPF5vD7Iua8OioIQLZTYWB3B4QZ6vd6xOi4Yj09BwL7oMgMBqxEoiShwfHZGQgADMhByACZhXIQABfdaoBTvEQAMWgK0QICuOAIJHIsqAA

### (Only applicable for extension issues) IDE Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.