Skip to content

Compound assignment operators perform plain assignment #65

Description

@mattcce

Description

Compound assignment operators (e.g. +=, -=) appear to get parsed as plain assignment operators.

Reproduction

This program:

class A {
    public static void main(String[] args) {
        int x = 0;
        x -= 1;
        x += 1;
    }
}

in the CSE machine results in x being set to 1 twice instead of -1, then 0 as expected. The final value of x is 1.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions