Basic support for ParamSpec type checking (#11594)
Add support for type checking several ParamSpec use cases (PEP 612).
@hauntsaninja previously added support for semantic analysis of ParamSpec
definitions, and this builds on top that foundation.
The implementation has these main things going on:
* `ParamSpecType` that is similar to `TypeVarType` but has three "flavors" that
correspond to `P`, `P.args` and `P.kwargs`
* `CallableType` represents `Callable[P, T]` if the arguments are
(`*args: P.args`, `**kwargs: P.kwargs`) -- and more generally, there can also
be arbitrary additional prefix arguments
* Type variables of functions and classes can now be represented using
`ParamSpecType` in addition to `TypeVarType`
There are still a bunch of TODOs. Some of these are important to address before the
release that includes this. I believe that this is good enough to merge and remaining
issues can be fixed in follow-up PRs.
Notable missing features include these:
* `Concatenate`
* Specifying the value of ParamSpec explicitly (e.g. `Z[[int, str, bool]]`)
* Various validity checks -- currently only some errors are caught
* Special case of decorating a method (python/typeshed#6347)
* `atexit.register(lambda: ...)` generates an error