-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Does not detect type change in two if branches #3803
Comments
Mypy by default does look at whether something is always true or always false in an if condition, and will react accordingly. Your Are you saying that in your code, mypy is taking the skip variable to incorrectly always be False, thus missing the other branch? |
Yes, in my real example, |
I edited the links to code so they point to the right commit, so I can fix it without breaking this report. |
That link is a 404, can you double-check it? |
The correct link is https://github.com/StyXman/elevation/blob/7340f5e8eecbbe7f28cb4224d2532c2e987057eb/generate_tiles.py#L241 (on Github the URLs are |
OK, but then the bug report seems wrong -- the bug report complains that there's no type checking in a branch that's detectable dead code (due to |
Yeah, sorry about the links, I edited them by hand.
No, my complaint is that |
Then I suspect it's all because this all inside the def loop(self) -> None: |
It looks like no actions required here. |
I have code that boils down to this:
If I run
mypy
on it, I get nothing:Now, if the if reads
if False:
or evenif maybe()
, I get:which is what I was expecting. I think this is more or less related to #1174.
If you're curious, the code where this was silent is this one. Line 260 has the right type, but the construction in the else branch is of type
Dict[int, Dict[int, bool]]
.The text was updated successfully, but these errors were encountered: