Allow assignment to an empty tuple - #5617
Conversation
| [out] | ||
| main:1: error: can't assign to literal | ||
|
|
||
| [case testInvalidLvalues5] |
There was a problem hiding this comment.
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.
| NameExpr(f [__main__.f]) | ||
| Args()))) | ||
|
|
||
| [case testAssignEmptyTuple] |
There was a problem hiding this comment.
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.