Next: , Previous: , Up: Well-formedness -- Valued Actions and Calls   [Contents][Index]


11.8.2 action used in a complex expression

An action is used in a complex expression.

interface ihello
{
  in bool hello ();
  in bool cruel ();
  behavior
  {
    on hello: reply (true);
    on cruel: reply (true);
  }
}

component action_in_complex_expression
{
  provides ihello p;
  requires ihello r;
  behavior
  {
    bool b = true;
    void f (bool b)
    {
      reply (b);
    }
    on p.hello ():
      if (r.hello () && r.cruel ())  // not allowed
        reply (false || r.cruel ()); // not allowed
      else if (r.hello () || true)
        reply (r.hello () == true);
      else
        reply (!r.hello ());
    on p.cruel (): f (r.hello ());   // not allowed
  }
}

This results in the following error messages:

action-in-complex-expression.dzn:24:25: error: action used in a complex
    expression
action-in-complex-expression.dzn:25:25: error: action used in a complex
    expression
action-in-complex-expression.dzn:30:23: error: action used in a complex
    expression