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

Add test for illegal literal parameter #706

Closed
wants to merge 1 commit into from

Conversation

Glyphack
Copy link

@Glyphack Glyphack commented Nov 7, 2023

According to typing spec tuple value inside a Literal type annotation is not allowed.

@@ -127,7 +127,7 @@ def capybara(x: X, y: Y) -> None:
def test_literal(self):
from typing_extensions import Literal

def capybara(x: Literal[True], y: Literal[True, False]) -> None:
def capybara(x: Literal[True], y: Literal[(True, False)]) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think pyanalyze will catch this as the AST is the same either way. Mypy accepts this too.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for checking then I think I can close this, and open an issue in Python repo.

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