Program: 27860
Project: 27860
Buggy source:
/** 
 * Defines a property if the property has not been defined yet.
 */
private void ensurePropertyDefined(Node getprop,JSType rightType){
  String propName=getprop.getLastChild().getString();
  Node obj=getprop.getFirstChild();
  JSType nodeType=getJSType(obj);
  ObjectType objectType=ObjectType.cast(nodeType.restrictByNotNullOrUndefined());
  if (objectType == null) {
    registry.registerPropertyOnType(propName,nodeType);
  }
 else {
    if (nodeType.isStruct() && !objectType.hasProperty(propName)) {
      if (!(obj.isThis() && getJSType(syntacticScope.getRootNode()).isConstructor())) {
        return;
      }
    }
    if (ensurePropertyDeclaredHelper(getprop,objectType)) {
      return;
    }
    if (!objectType.isPropertyTypeDeclared(propName)) {
      if (objectType.hasProperty(propName) || !objectType.isInstanceType()) {
        if ("String_Node_Str".equals(propName)) {
          objectType.defineDeclaredProperty(propName,rightType,getprop);
        }
 else {
          objectType.defineInferredProperty(propName,rightType,getprop);
        }
      }
 else       if (obj.isThis() && getJSType(syntacticScope.getRootNode()).isConstructor()) {
        objectType.defineInferredProperty(propName,rightType,getprop);
      }
 else {
        registry.registerPropertyOnType(propName,objectType);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Defines a property if the property has not been defined yet.
 */
private void ensurePropertyDefined(Node getprop,JSType rightType){
  String propName=getprop.getLastChild().getString();
  Node obj=getprop.getFirstChild();
  JSType nodeType=getJSType(obj);
  ObjectType objectType=ObjectType.cast(nodeType.restrictByNotNullOrUndefined());
  boolean propCreationInConstructor=obj.isThis() && getJSType(syntacticScope.getRootNode()).isConstructor();
  if (objectType == null) {
    registry.registerPropertyOnType(propName,nodeType);
  }
 else {
    if (nodeType.isStruct() && !objectType.hasProperty(propName)) {
      boolean staticPropCreation=false;
      Node maybeAssignStm=getprop.getParent().getParent();
      if (syntacticScope.isGlobal() && NodeUtil.isPrototypePropertyDeclaration(maybeAssignStm)) {
        String propCreationFilename=maybeAssignStm.getSourceFileName();
        Node ctor=objectType.getOwnerFunction().getSource();
        if (ctor != null && ctor.getSourceFileName().equals(propCreationFilename)) {
          staticPropCreation=true;
        }
      }
      if (!propCreationInConstructor && !staticPropCreation) {
        return;
      }
    }
    if (ensurePropertyDeclaredHelper(getprop,objectType)) {
      return;
    }
    if (!objectType.isPropertyTypeDeclared(propName)) {
      if (objectType.hasProperty(propName) || !objectType.isInstanceType()) {
        if ("String_Node_Str".equals(propName)) {
          objectType.defineDeclaredProperty(propName,rightType,getprop);
        }
 else {
          objectType.defineInferredProperty(propName,rightType,getprop);
        }
      }
 else       if (propCreationInConstructor) {
        objectType.defineInferredProperty(propName,rightType,getprop);
      }
 else {
        registry.registerPropertyOnType(propName,objectType);
      }
    }
  }
}