Program: 19398
Project: 19398
Buggy source:
private void maybeRecordNominalType(Node defSite,Node nameNode,JSDocInfo fnDoc,boolean isRedeclaration){
  Preconditions.checkState(nameNode == null || nameNode.isQualifiedName());
  if (fnDoc == null) {
    return;
  }
  if (fnDoc.isConstructorOrInterface()) {
    if (nameNode == null) {
      warnings.add(JSError.make(defSite,ANONYMOUS_NOMINAL_TYPE));
      nameNode=IR.name(ANON_FUN_PREFIX + funNameGen.generateNextName());
      nameNode.useSourceInfoFrom(defSite);
    }
    String qname=nameNode.getQualifiedName();
    ImmutableList.Builder<String> builder=ImmutableList.builder();
    for (    String typeParam : fnDoc.getTemplateTypeNames()) {
      builder.add(varNameGen.getNextName(typeParam));
    }
    ImmutableList<String> typeParameters=builder.build();
    RawNominalType rawType;
    if (fnDoc.usesImplicitMatch()) {
      rawType=RawNominalType.makeStructuralInterface(commonTypes,defSite,qname,typeParameters);
    }
 else     if (fnDoc.isInterface()) {
      rawType=RawNominalType.makeNominalInterface(commonTypes,defSite,qname,typeParameters);
    }
 else     if (fnDoc.makesStructs()) {
      rawType=RawNominalType.makeStructClass(commonTypes,defSite,qname,typeParameters);
    }
 else     if (fnDoc.makesDicts()) {
      rawType=RawNominalType.makeDictClass(commonTypes,defSite,qname,typeParameters);
    }
 else {
      rawType=RawNominalType.makeUnrestrictedClass(commonTypes,defSite,qname,typeParameters);
    }
    nominaltypesByNode.put(defSite,rawType);
    if (isRedeclaration) {
      return;
    }
    Node firstChild=nameNode.getFirstChild();
    if (nameNode.isName() || currentScope.isNamespace(firstChild) || mayCreateFunctionNamespace(firstChild)|| mayCreateWindowNamespace(firstChild)) {
      if (nameNode.isGetProp()) {
        defSite.getParent().getFirstChild().putBooleanProp(Node.ANALYZED_DURING_GTI,true);
      }
 else       if (currentScope.isTopLevel()) {
        maybeRecordBuiltinType(qname,rawType);
      }
      currentScope.addNamespace(nameNode,rawType);
    }
  }
 else   if (fnDoc.makesStructs()) {
    warnings.add(JSError.make(defSite,STRUCTDICT_WITHOUT_CTOR,"String_Node_Str"));
  }
 else   if (fnDoc.makesDicts()) {
    warnings.add(JSError.make(defSite,STRUCTDICT_WITHOUT_CTOR,"String_Node_Str"));
  }
}

Fixed version (ground truth):
private void maybeRecordNominalType(Node defSite,Node nameNode,JSDocInfo fnDoc,boolean isRedeclaration){
  Preconditions.checkState(nameNode == null || nameNode.isQualifiedName());
  if (fnDoc == null) {
    return;
  }
  if (fnDoc.isConstructorOrInterface()) {
    if (nameNode == null) {
      warnings.add(JSError.make(defSite,ANONYMOUS_NOMINAL_TYPE));
      nameNode=IR.name(ANON_FUN_PREFIX + funNameGen.generateNextName());
      nameNode.useSourceInfoFrom(defSite);
    }
    String qname=nameNode.getQualifiedName();
    ImmutableList.Builder<String> builder=ImmutableList.builder();
    for (    String typeParam : fnDoc.getTemplateTypeNames()) {
      builder.add(varNameGen.getNextName(typeParam));
    }
    ImmutableList<String> typeParameters=builder.build();
    RawNominalType rawType;
    ObjectKind objKind=fnDoc.makesStructs() ? ObjectKind.STRUCT : (fnDoc.makesDicts() ? ObjectKind.DICT : ObjectKind.UNRESTRICTED);
    if (fnDoc.isConstructor()) {
      rawType=RawNominalType.makeClass(commonTypes,defSite,qname,typeParameters,objKind);
    }
 else     if (fnDoc.usesImplicitMatch()) {
      rawType=RawNominalType.makeStructuralInterface(commonTypes,defSite,qname,typeParameters,objKind);
    }
 else {
      Preconditions.checkState(fnDoc.isInterface());
      rawType=RawNominalType.makeNominalInterface(commonTypes,defSite,qname,typeParameters,objKind);
    }
    nominaltypesByNode.put(defSite,rawType);
    if (isRedeclaration) {
      return;
    }
    Node firstChild=nameNode.getFirstChild();
    if (nameNode.isName() || currentScope.isNamespace(firstChild) || mayCreateFunctionNamespace(firstChild)|| mayCreateWindowNamespace(firstChild)) {
      if (nameNode.isGetProp()) {
        defSite.getParent().getFirstChild().putBooleanProp(Node.ANALYZED_DURING_GTI,true);
      }
 else       if (currentScope.isTopLevel()) {
        maybeRecordBuiltinType(qname,rawType);
      }
      currentScope.addNamespace(nameNode,rawType);
    }
  }
 else   if (fnDoc.makesStructs()) {
    warnings.add(JSError.make(defSite,STRUCT_WITHOUT_CTOR_OR_INTERF));
  }
  if (fnDoc.makesDicts() && !fnDoc.isConstructor()) {
    warnings.add(JSError.make(defSite,DICT_WITHOUT_CTOR));
  }
}