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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyanalyze/test_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

assert_is_value(x, KnownValue(True))
assert_is_value(y, MultiValuedValue([KnownValue(True), KnownValue(False)]))

Expand Down
Loading