-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PEP 695] Partial support for new type parameter syntax in Python 3.12 (
#17233) Add basic support for most features of PEP 695. It's still not generally useful, but it should be enough for experimentation and testing. I will continue working on follow-up PRs after this has been merged. This is currently behind a feature flag: `--enable-incomplete-feature=NewGenericSyntax` These features, among other things, are unimplemented (or at least untested): * Recursive type aliases * Checking for various errors * Inference of variance in complex cases * Dealing with unknown variance consistently * Scoping * Mypy daemon * Compilation using mypyc The trickiest remaining thing is probably variance inference in cases where some types aren't ready (i.e. not inferred) when we need variance. I have some ideas about how to tackle this, but it might need significant work. Currently the idea is to infer variance on demand when we need it, but we may need to defer if variance can't be calculated, for example if a type of an attribute is not yet ready. The current approach is to fall back to covariance in some cases, which is not ideal. Work on #15238.
- Loading branch information
Showing
17 changed files
with
1,441 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.