KEMBAR78
Code is not cheked after some function calls: binder/inference bug · Issue #3994 · python/mypy · GitHub
Skip to content

Code is not cheked after some function calls: binder/inference bug #3994

@ilevkivskyi

Description

@ilevkivskyi

Any code after an UninhabitedType is marked as unreachable in binder. This leads to dangerous behaviour together with how type inference currently works "in all uncertain situations infer uninhabited" (see also #3283 for discussion). For example no error is reported in this code:

from typing import TypeVar
T = TypeVar('T')

def f() -> T:
    ...

class C:
    f()
    1 + 'this is not checked'

def fun() -> None:
    f()
    1 + 'can do everything here'

if True:
    f()
    1 + 'whatever'

There are other function signatures (all involve type variables) that lead to this behaviour: type checking stops after a call to such function.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions