Skip to content

Go-to-def fails on unreachable branches #1254

@yangdanny97

Description

@yangdanny97

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 #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

Metadata

Metadata

Assignees

No one assigned

    Labels

    language-serverIssues specific to our IDE integration rather than type checkingmeta

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions