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

Understand type[A | B] special form in annotations #14830

Merged
merged 2 commits into from
Dec 7, 2024

Conversation

Glyphack
Copy link
Contributor

@Glyphack Glyphack commented Dec 7, 2024

resolves #14703

I decided to use recursion to get the type, so if anything is added to the single element inference it will be applied for the union.
Also added this change in this PR since it was easy.

@Glyphack Glyphack marked this pull request as draft December 7, 2024 15:21
Copy link
Contributor

github-actions bot commented Dec 7, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@Glyphack Glyphack marked this pull request as ready for review December 7, 2024 16:32
Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

@carljm carljm enabled auto-merge (squash) December 7, 2024 17:30
@carljm carljm merged commit 269e47b into astral-sh:main Dec 7, 2024
20 checks passed
@Glyphack Glyphack deleted the typing-type-union branch December 7, 2024 18:06
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.

[red-knot] understand type[A | B] where A and B are both classes
2 participants