void addError(int index, @NotNull Error error) {
      if (myErrors == null) {
        myErrors = new SmartList<>();
        myAffected = new BitSet();
      }
      ErrorWithIndex errorWithIndex = new ErrorWithIndex(index, error);
      myErrors.add(errorWithIndex);
      updateAffected(index, error);

      if (myPattern != null) {
        myPattern = applyError(myPattern, errorWithIndex);
      }
    }
void addError(int index, @NotNull Error error)