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

Fails to decompile "x, y = y, x" or other TUPLE = TUPLE where rhs is not literal #27

Open
jpivarski opened this issue Jul 31, 2017 · 1 comment

Comments

@jpivarski
Copy link
Contributor

Examples: x, y = y, x incorrectly decompiles to x = y = y and x, y = 1, z incorrectly decompiles to x = y = 1.

The fix is jpivarski@0941482 and I'll submit a pull request as soon as I can figure out how this testing framework works.

Below are tests I performed by hand. The "CORRECT" is after my correction, "INCORRECT" is original:

SOURCE             CORRECT             INCORRECT             
-----------------------------------------------------------
x = 1              x = 1               x = 1
x = 1, 2           x = (1, 2)          x = (1, 2)
x, y = 1, 2        (x, y) = (1, 2)     (x, y) = (1, 2)
x = 1, z           x = (1, z)          x = (1, z)
x, y = 1, z        (x, y) = (1, z)     x = y = 1           WRONG!
x, y = y, x        (x, y) = (y, x)     x = y = y           WRONG!
x, y, z = 1        (x, y, z) = 1       (x, y, z) = 1
x, y, z = zzz      (x, y, z) = zzz     (x, y, z) = zzz
x, y, z = 1, 2     (x, y, z) = (1, 2)  (x, y, z) = (1, 2)
x, y, z = 1, z     (x, y, z) = (1, z)  (x, y, z) = (1, z)
x = y = 1          x = y = 1           x = y = 1
x = y = 1, 2       x = y = (1, 2)      x = y = (1, 2)
x = y = 1, z       x = y = (1, z)      x = y = (1, z)
x = y = z          x = y = z           x = y = z
x = y = z = 1      x = y = z = 1       x = y = z = 1
x = y = z = 1, 2   x = y = z = (1, 2)  x = y = z = (1, 2)
x = y = z = 1, z   x = y = z = (1, z)  x = y = z = (1, z)
x, y = z = 1, z    (x, y) = z = (1, z) (x, y) = z = (1, z)

So it really was just this narrow case.

@jpivarski
Copy link
Contributor Author

Clarification: we only see this as a bug inside of a function. I've written unit tests and will be pull-requesting shortly.

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

No branches or pull requests

1 participant