code: public final JSType resolve(ErrorReporter reporter) {
      if (resolved) {
        if (resolveResult == null) {
          // If there is a circular definition, keep the NamedType around. This is not ideal,
          // but is still a better type than unknown.
          return this;
        }
        return resolveResult;
      }
      resolved = true;
      resolveResult = resolveInternal(reporter);
      resolveResult.setResolvedTypeInternal(resolveResult);
      return resolveResult;
    }
docs: Resolve this type in the given scope.
  
  The returned value must be equal to {@code this}, as defined by
  {@link #isEquivalentTo}. It may or may not be the same object. This method
  may modify the internal state of {@code this}, as long as it does
  so in a way that preserves Object equality.
  
  For efficiency, we should only resolve a type once per compilation job.
  For incremental compilations, one compilation job may need the
  artifacts from a previous generation, so we will eventually need
  a generational flag instead of a boolean one.