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

wrong code geneartion for state machine guards #796

Closed
vahdat-ab opened this Issue Mar 22, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@vahdat-ab
Member

vahdat-ab commented Mar 22, 2016

consider the following example:

class A{
    Boolean result;
    status {
        s0{
            go [result==true] -> s1;
        }
        s1{

        }
    }
}

Part of the generated code is as follows.

      case s0:
        if (getResult().equals(true))   // The problem is here
        {
          setStatus(Status.s1);
          wasEventProcessed = true;
          break;
        }
        break;

We cannot have a equals for a boolean. What is correct is to just use the name of variable (if it's boolean) or its get method.

@tlaport4

This comment has been minimized.

Contributor

tlaport4 commented Oct 25, 2016

Added logic to remove the comparison to true/false constant values. If it is comparing a boolean with "false" or is comparing with "!=" it will negate the boolean.

@TimLethbridge

This comment has been minimized.

Member

TimLethbridge commented Oct 26, 2016

PR successfully merged

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