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

Don't silently ignore some partial types #3031

Open
ddfisher opened this issue Mar 19, 2017 · 1 comment
Open

Don't silently ignore some partial types #3031

ddfisher opened this issue Mar 19, 2017 · 1 comment
Labels
bug mypy got something wrong

Comments

@ddfisher
Copy link
Collaborator

After #3024, mypy won't complain when inferring the type of a variable as None. Unfortunately, in some circumstances we drop information about the variable that makes this invalid. For example:

T = TypeVar('T')
def f(*x: T) -> Dict[int, T]: pass
x = None
if bool():
    x = f()
reveal_type(x)  # E: Revealed type is 'builtins.None'
@ddfisher
Copy link
Collaborator Author

See also: testPartiallyInitializedToNoneAndThenToIncompleteType.

@AlexWaygood AlexWaygood added the bug mypy got something wrong label Mar 29, 2022
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