Skip to content

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

@jpivarski

Description

@jpivarski

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions