code: public void rollback(List<Type> saved_undet) {
          Assert.check(saved_undet != null);
          //restore bounds (note: we need to preserve the old instances)
          ListBuffer<Type> newUndetVars = new ListBuffer<>();
          ListBuffer<Type> newInferenceVars = new ListBuffer<>();
          while (saved_undet.nonEmpty() && undetvars.nonEmpty()) {
              UndetVar uv = (UndetVar)undetvars.head;
              UndetVar uv_saved = (UndetVar)saved_undet.head;
              if (uv.qtype == uv_saved.qtype) {
                  uv_saved.dupTo(uv, types);
                  undetvars = undetvars.tail;
                  saved_undet = saved_undet.tail;
                  newUndetVars.add(uv);
                  newInferenceVars.add(uv.qtype);
              } else {
                  undetvars = undetvars.tail;
              }
          }
          undetvars = newUndetVars.toList();
          inferencevars = newInferenceVars.toList();
      }
docs: Restore the state of this inference context to the previous known checkpoint.
  Consider that the number of saved undetermined variables can be different to the current
  amount. This is because new captured variables could have been added.