code: private boolean isRecursive(TemplateType currentType, JSType replacementType) {
      TemplatizedType replacementTemplatizedType =
          replacementType.restrictByNotNullOrUndefined().toMaybeTemplatizedType();
      if (replacementTemplatizedType == null) {
        return false;
      }
  
      Iterable<JSType> replacementTemplateTypes = replacementTemplatizedType.getTemplateTypes();
      for (JSType replacementTemplateType : replacementTemplateTypes) {
        if (replacementTemplateType.isTemplateType()
            && isSameType(currentType, replacementTemplateType.toMaybeTemplateType())) {
          return true;
        }
      }
  
      return false;
    }
docs: Returns whether the replacement type is a templatized type which contains the current type.
  e.g. current type T is being replaced with Foo<T>