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

Support for annotated_types #673

Merged
merged 11 commits into from
Sep 10, 2023
Merged

Conversation

JelleZijlstra
Copy link
Contributor

@JelleZijlstra JelleZijlstra commented Sep 10, 2023

This adds support for checking annotated_types annotations against literals, as well as a few tricks to make them more usable:

  • Allowing stronger annotations where a weaker one is requested; for example, allow Annotated[int, Gt(6)] where Annotated[int, Gt(5)] is requested.
  • Inferring annotations in some cases (if x > 5: essentially adds the annotation Gt(5)).

Future work:

  • We should also infer predicates for if len(x) > 5: but we currently don't.

@JelleZijlstra JelleZijlstra merged commit f2cc707 into quora:master Sep 10, 2023
8 checks passed
@JelleZijlstra JelleZijlstra deleted the annotatedtypes branch September 10, 2023 04:01
@JelleZijlstra JelleZijlstra restored the annotatedtypes branch September 10, 2024 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant