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

Fix type annotation with two string literals #1853

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

Glyphack
Copy link
Contributor

@Glyphack Glyphack commented Sep 3, 2024

I noticed there are two strings as type annotation and I thought this is not intended because if I understand correctly forward annotations cannot consist of two string literals.

Although this is syntactically correct because the strings can be concatenated. But testing it out on pyright for example this does not pass:

a: "int" "| string" = 1  # error: Expected type but received a string literal (reportGeneralTypeIssues)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@JelleZijlstra JelleZijlstra merged commit f816a64 into python:main Sep 3, 2024
5 checks passed
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.

2 participants