Open
Description
Bug Report
See mypy Playground.
In mypy 1.15 and below, attempting to use Any
as an actual type (with instances) gives an unambiguous reason for why it's not valid:
from typing import Any
def get_obj[T](t: type[T], /) -> T: ...
a: int = get_obj(Any) # E: Argument 1 to "get_obj" has incompatible type "<typing special form>"; expected "type[Never]" [arg-type]
In mypy 1.16 this is no longer clear:
a: int = get_obj(Any) # E: Incompatible types in assignment (expression has type "Any", variable has type "int") [assignment]
It looks like mypy now thinks you can create actual instances of typing.Any
.
reveal_type(get_obj(Any)) # N: Revealed type is "typing.Any"