Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve inference from return type annotations in completer #14357

Merged

Conversation

krassowski
Copy link
Member

@krassowski krassowski commented Feb 26, 2024

Addresses the issue of non-jedi completer not picking type annotations for __init__() brought up in #14336

completion_works

Follow-up to #14185

Supports:

  • Annotated
  • AnyStr
  • Literal
  • LiteralString
  • NewType
  • Optional
  • Protocol
  • Self
  • TypeAliasType (type keyword in Python 3.12+)
  • TypedDict
  • TypeGuard
  • 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

@krassowski krassowski marked this pull request as draft February 26, 2024 15:23
@krassowski krassowski force-pushed the completion-improve-inference-from-types branch from aeff24b to 55e79ef Compare February 26, 2024 21:58
@krassowski krassowski marked this pull request as ready for review February 26, 2024 22:09
@Carreau Carreau added this to the 8.23 milestone Feb 27, 2024
@Carreau Carreau merged commit 7c22387 into ipython:main Feb 27, 2024
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants