Improve inference from return type annotations in completer (#14357)...
Improve inference from return type annotations in completer (#14357)
Addresses the issue of non-jedi completer not picking type annotations
for `__init__()` brought up in
https://github.com/ipython/ipython/issues/14336
![completion_works](
https://github.com/ipython/ipython/assets/5832902/73d44e26-123e-4691-87a6-e4d92c6f5061)
Follow-up to
https://github.com/ipython/ipython/pull/14185
Supports:
- [x] `Annotated`
- [x] `AnyStr`
- [x] `Literal`
- [x] `LiteralString`
- [x] `NewType`
- [x] `Optional`
- [x] `Protocol`
- [x] `Self`
- [x] `TypeAliasType` (`type` keyword in Python 3.12+)
- [x] `TypedDict`
- [x] `TypeGuard`
- [x] `Union`
Limitations:
- no type narrowing: ambiguous return types from `Union`, and `Optional`
will always return all possible values
- generics (`TypeVar` and `Generic`) are not support (except for
`AnyStr`)
- old style `TypeAlias` (deprecated in Python 3.12) is not supported