-
Notifications
You must be signed in to change notification settings - Fork 216
Description
This can be done by creating a diagnostic with the UnnecessaryCode tag.
Our reachability infrastructure should be powerful enough to support this but recording reachability constraints for every node is probably too expensive and we have to do it at the basic block level instead.
The diagnostic reported by ty should also cover the maximum span that's unreachable instead of having a diagnostic for each node (which would be very verbose. It's worth looking into how other type checker handle this).
There's an UX question for what we want to do about code that is unreachable with the current configuration settings (e.g. for a newer python version). Ideally, this code gets grayed out in the LSP but reporting a diagnostic in the CLI might be annoying (but can be useful to detect code that's no longer revelant after upgrading to a newer Python version)