Skip to content
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

False negative for non-overlapping type check inside function with strict_equality flag #10055

Closed
Garrett-R opened this issue Feb 9, 2021 · 2 comments
Labels
bug mypy got something wrong

Comments

@Garrett-R
Copy link

Bug Report

To Reproduce

Run this file to test.py:

if 'red' == 5:  # <-- Mypy finds error
    print('equal')

def foo():
    if 'red' == 5:  # <-- Mypy does not find error
        print('equal')

foo()

then execute

mypy test.py --strict-equality

Expected Behavior

Mypy should find 2 errors in this file.

Actual Behavior

Mypy fails to find the error inside the function.

Your Environment

  • Mypy version used: 0.8000
  • Mypy command-line flags: --strict-equality
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.9.1
  • Operating system and version: Ubuntu 18.04
@Garrett-R Garrett-R added the bug mypy got something wrong label Feb 9, 2021
@hauntsaninja
Copy link
Collaborator

First item of https://mypy.readthedocs.io/en/stable/common_issues.html#no-errors-reported-for-obviously-wrong-code

@Garrett-R
Copy link
Author

Ah, my apologies! Thank you for your time and thanks for the package!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants