-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Regression: missing output from reveal_type #15954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This doesn't actually have anything to do with reveal_type: the reason why mypy doesn't output anything for those reveal_type calls is just because mypy doesn't analyse any blocks of code it has determined are unreachable, and it has (erroneously) determined here that all code below the FWIW, it's a deliberate design decision for mypy to ignore all code it considers unreachable, but I agree that it can lead to some pretty unintuitive and unexpected behaviour at times. |
@AlexWaygood thank you for the explanation. In that case, the question is whether isinstance() should be considered always false. If there's already an issue about this, feel free to close this as a duplicate. |
@AlexWaygood both of these issues are pretty old. The change here happened between 1.4 and 1.5, so this is something new. |
@ikonst recently improved the consistency of whether or not mypy will actually ignore all blocks of code that are deemed unreachable or not. So the recent change in behaviour is likely due to that. But that's a strict improvement over the previous behaviour since, as I say, by design, mypy is currently meant to ignore everything in a block of code it considers unreachable. The reachability analysis hasn't changed (mypy considered the block of code at the bottom unreachable in v1.4.x as well); the only difference is that mypy is now more consistent about how it treats unreachable code, which is a good thing. |
Apologies if this was already reported.
reveal_type
is a hard thing to search for.To Reproduce
https://mypy-play.net/?mypy=latest&python=3.11&gist=2a1d6a831177eb02b175a25fc07a374e
Expected Behavior
I expect to see 2 lines of output from
reveal_type
. This works in 1.4.x but stopped working in 1.5.x.Actual Behavior
No output.
Your Environment
The text was updated successfully, but these errors were encountered: