private Node buildSJSessionTypeCast(SJSessionTypeCast stc) throws SemanticException {
    SJTypeNode tn = disambiguateSJTypeNode(this, stc.sessionType());
    SJSessionType st = tn.type();

    if (stc instanceof SJAmbiguousCast) {
      SJNoAliasExprExt naee = getSJNoAliasExprExt(stc);

      Position pos = stc.position();
      Expr e = stc.expr();

      if (st instanceof SJBeginType) {
        stc = sjnf.SJChannelCast(pos, e, tn);
      } else {
        stc = sjnf.SJSessionCast(pos, e, tn);
      }

      stc = (SJSessionTypeCast) buildAndCheckTypes(this, stc);
      stc =
          (SJSessionTypeCast)
              SJNoAliasExprBuilder.setSJNoAliasExprExt(
                  sjef,
                  stc,
                  naee.isNoAlias(),
                  naee.isFinal(),
                  naee.fields(),
                  naee.locals(),
                  naee.arrayAccesses());
    } else {
      stc = stc.sessionType(tn);
    }

    stc = (SJSessionTypeCast) setSJTypeableExt(sjef, stc, st);

    return stc;
  }