8000 None inferred as variable type from UninhabitedType · Issue #4104 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content 8000
None inferred as variable type from UninhabitedType #4104
@JukkaL

Description

@JukkaL

The inferred type for x is unexpected (especially when using --strict-optional):

from typing import TypeVar

T = TypeVar('T')

def f() -> T: pass

x = f()
reveal_type(x)  # None

It would be better to require an annotation for x.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0