facebookincubator / cinder

Cinder is Meta's internal performance-oriented production version of CPython.

Home Page:https://trycinder.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve handling of Type[...] so distinguish between types and instances properly

DinoV opened this issue · comments

Currently we don't really fully handle instances of types correctly. One example of this is:

def produce() -> type:
    @final
    class C:
        pass
    return C
C = produce()
reveal_type(C)

The inferred type of "C" becomes "Type[type]", when it really should be "Type[object]", "Type[typing.Any]" or "Type[dynamic]".

There's other places that tie into this like can_assign_from might be better taking a Value vs. a class.