-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Allow assignment to an empty tuple #5617
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
Conversation
@@ -373,11 +373,6 @@ main:1: error: can't assign to literal | |||
[out] | |||
main:1: error: can't assign to literal | |||
|
|||
[case testInvalidLvalues5] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this still be an error saying 1 is not iterable
or similar?
Also, I would like to see a new test that does things like () = []
or a, () = list()
and asserts that there are no errors.
test-data/unit/semanal-basic.test
Outdated
@@ -47,6 +47,14 @@ MypyFile:1( | |||
NameExpr(f [__main__.f]) | |||
Args()))) | |||
|
|||
[case testAssignEmptyTuple] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we need this test; these tests that print out internal data structures are harder to maintain and harder to map to user-visible behavior.
@tyehle This still looks like an easy win -- but it does seem reasonable to ask for some test that indeed works. Also note that in Python 2, assignment to |
Hmm. I did some more tests, and it looks like |
You can pass mypy's |
@tyehle do you think you'll have a chance to return to this? |
@msullivan I forgot about this. I think I'll take another crack at it :) |
I can't figure out how to make these two tests pass
I don't know what is required to make the tests realize that
The test passing with python 3.5 makes sense because I removed that check. I'm honestly not sure why it correctly produces an error when given |
Sorry, I missed your comments here and dropped this. When does it throw |
Yeah it throws |
I apologize that I took a year and a half to look at this again. Adding a Thanks. |
Fixes #5594. Simply removes the check in the semantic analyzer. I made a best guess on what to do about the tests.