Program: 27326
Project: 27326
Buggy source:
/** 
 * Returns the type in the chain from the given type that contains the given field or null if it is not found anywhere. Can return a subtype of the input type.
 */
@VisibleForTesting ObjectType getTypeWithProperty(String field,JSType type){
  if (type == null) {
    return null;
  }
  ObjectType foundType=gtwpCacheGet(field,type);
  if (foundType != null) {
    return foundType.equals(BOTTOM_OBJECT) ? null : foundType;
  }
  if (type.isEnumElementType()) {
    foundType=getTypeWithProperty(field,type.toMaybeEnumElementType().getPrimitiveType());
    gtwpCachePut(field,type,foundType == null ? BOTTOM_OBJECT : foundType);
    return foundType;
  }
  if (!(type instanceof ObjectType)) {
    if (type.autoboxesTo() != null) {
      foundType=getTypeWithProperty(field,type.autoboxesTo());
      gtwpCachePut(field,type,foundType == null ? BOTTOM_OBJECT : foundType);
      return foundType;
    }
 else {
      gtwpCachePut(field,type,BOTTOM_OBJECT);
      return null;
    }
  }
  if ("String_Node_Str".equals(field)) {
    gtwpCachePut(field,type,BOTTOM_OBJECT);
    return null;
  }
  ObjectType objType=ObjectType.cast(type);
  if (objType != null && objType.getConstructor() != null && objType.getConstructor().isInterface()) {
    ObjectType topInterface=FunctionType.getTopDefiningInterface(objType,field);
    if (topInterface != null && topInterface.getConstructor() != null) {
      foundType=topInterface.getConstructor().getPrototype();
    }
  }
 else {
    while (objType != null && !Objects.equals(objType.getImplicitPrototype(),objType)) {
      if (objType.hasOwnProperty(field)) {
        foundType=objType;
      }
      objType=objType.getImplicitPrototype();
    }
  }
  if (foundType == null) {
    ObjectType maybeType=ObjectType.cast(registry.getGreatestSubtypeWithProperty(type,field));
    if (maybeType != null && maybeType.hasOwnProperty(field)) {
      foundType=maybeType;
    }
  }
  if (foundType != null && foundType.isTemplatizedType()) {
    foundType=foundType.toMaybeTemplatizedType().getReferencedType();
  }
  if (foundType != null && foundType.isNamedType()) {
    foundType=foundType.toMaybeNamedType().getReferencedType().toMaybeObjectType();
  }
  gtwpCachePut(field,type,foundType == null ? BOTTOM_OBJECT : foundType);
  return foundType;
}

Fixed version (ground truth):
/** 
 * Returns the type in the chain from the given type that contains the given field or null if it is not found anywhere. Can return a subtype of the input type.
 */
private ObjectType getTypeWithProperty(String field,JSType type){
  if (type == null) {
    return null;
  }
  ObjectType foundType=gtwpCacheGet(field,type);
  if (foundType != null) {
    return foundType.equals(BOTTOM_OBJECT) ? null : foundType;
  }
  if (type.isEnumElementType()) {
    foundType=getTypeWithProperty(field,type.toMaybeEnumElementType().getPrimitiveType());
    gtwpCachePut(field,type,foundType == null ? BOTTOM_OBJECT : foundType);
    return foundType;
  }
  if (!(type instanceof ObjectType)) {
    if (type.autoboxesTo() != null) {
      foundType=getTypeWithProperty(field,type.autoboxesTo());
      gtwpCachePut(field,type,foundType == null ? BOTTOM_OBJECT : foundType);
      return foundType;
    }
 else {
      gtwpCachePut(field,type,BOTTOM_OBJECT);
      return null;
    }
  }
  if ("String_Node_Str".equals(field)) {
    gtwpCachePut(field,type,BOTTOM_OBJECT);
    return null;
  }
  ObjectType objType=ObjectType.cast(type);
  if (objType != null && objType.getConstructor() != null && objType.getConstructor().isInterface()) {
    ObjectType topInterface=FunctionType.getTopDefiningInterface(objType,field);
    if (topInterface != null && topInterface.getConstructor() != null) {
      foundType=topInterface.getConstructor().getPrototype();
    }
  }
 else {
    while (objType != null && !Objects.equals(objType.getImplicitPrototype(),objType)) {
      if (objType.hasOwnProperty(field)) {
        foundType=objType;
      }
      objType=objType.getImplicitPrototype();
    }
  }
  if (foundType == null) {
    ObjectType maybeType=ObjectType.cast(registry.getGreatestSubtypeWithProperty(type,field));
    if (maybeType != null && maybeType.hasOwnProperty(field)) {
      foundType=maybeType;
    }
  }
  if (foundType != null && foundType.isTemplatizedType()) {
    foundType=foundType.toMaybeTemplatizedType().getReferencedType();
  }
  if (foundType != null && foundType.isNamedType()) {
    foundType=foundType.toMaybeNamedType().getReferencedType().toMaybeObjectType();
  }
  gtwpCachePut(field,type,foundType == null ? BOTTOM_OBJECT : foundType);
  return foundType;
}