nus-yam/ex-repair huggingface dataset:
Program: 27404
Project: 27404
Buggy source:
private void appendPathDefinition(String path,Node initializer){
  Node pathDefinition;
  if (!path.contains("String_Node_Str")) {
    if (initializer.isEmpty()) {
      pathDefinition=IR.var(IR.name(path));
    }
 else {
      pathDefinition=NodeUtil.newVarNode(path,initializer);
    }
  }
 else {
    Node qualifiedPath=NodeUtil.newQName(compiler,path);
    if (initializer.isEmpty()) {
      pathDefinition=NodeUtil.newExpr(qualifiedPath);
    }
 else {
      pathDefinition=NodeUtil.newExpr(IR.assign(qualifiedPath,initializer));
    }
  }
  externsRoot.addChildToBack(pathDefinition);
  alreadyExportedPaths.add(path);
}

Fixed version (ground truth):
private void appendPathDefinition(String path,Node initializer,JSDocInfo jsdoc){
  Node pathDefinition;
  if (!path.contains("String_Node_Str")) {
    if (initializer.isEmpty()) {
      pathDefinition=IR.var(IR.name(path));
    }
 else {
      pathDefinition=NodeUtil.newVarNode(path,initializer);
    }
  }
 else {
    Node qualifiedPath=NodeUtil.newQName(compiler,path);
    if (initializer.isEmpty()) {
      pathDefinition=NodeUtil.newExpr(qualifiedPath);
    }
 else {
      pathDefinition=NodeUtil.newExpr(IR.assign(qualifiedPath,initializer));
    }
  }
  if (jsdoc != null) {
    if (pathDefinition.isExprResult()) {
      pathDefinition.getFirstChild().setJSDocInfo(jsdoc);
    }
 else {
      Preconditions.checkState(pathDefinition.isVar());
      pathDefinition.setJSDocInfo(jsdoc);
    }
  }
  externsRoot.addChildToBack(pathDefinition);
  alreadyExportedPaths.add(path);
}
Program: 27406
Project: 27406
Buggy source:
@Override void add(Node n,Context context){
  Node parent=n.getParent();
  if (parent != null && (parent.isBlock() || parent.isScript())) {
    if (n.isFunction()) {
      add(getFunctionAnnotation(n));
    }
 else     if (n.isExprResult() && n.getFirstChild().isAssign()) {
      Node rhs=n.getFirstChild().getLastChild();
      add(getTypeAnnotation(rhs));
    }
 else     if (n.isVar() && n.getFirstFirstChild() != null) {
      add(getTypeAnnotation(n.getFirstFirstChild()));
    }
  }
  super.add(n,context);
}

Fixed version (ground truth):
@Override void add(Node n,Context context){
  Node parent=n.getParent();
  if (parent != null && (parent.isBlock() || parent.isScript())) {
    if (n.isFunction()) {
      add(getFunctionAnnotation(n));
    }
 else     if (n.isExprResult() && n.getFirstChild().isAssign()) {
      Node assign=n.getFirstChild();
      if (NodeUtil.isNamespaceDecl(assign.getFirstChild())) {
        add(JSDocInfoPrinter.print(assign.getJSDocInfo()));
      }
 else {
        Node rhs=assign.getLastChild();
        add(getTypeAnnotation(rhs));
      }
    }
 else     if (n.isVar() && n.getFirstFirstChild() != null) {
      if (NodeUtil.isNamespaceDecl(n.getFirstChild())) {
        add(JSDocInfoPrinter.print(n.getJSDocInfo()));
      }
 else {
        add(getTypeAnnotation(n.getFirstFirstChild()));
      }
    }
  }
  super.add(n,context);
}
Program: 27407
Project: 27407
Buggy source:
/** 
 * Gets the r-value (or intializer) of a node returned by getBestLValue. 
 */
static Node getRValueOfLValue(Node n){
  Node parent=n.getParent();
switch (parent.getType()) {
case Token.ASSIGN:
    return n.getNext();
case Token.VAR:
case Token.LET:
case Token.CONST:
case Token.OBJECTLIT:
  return n.getFirstChild();
case Token.FUNCTION:
case Token.CLASS:
return parent;
}
return null;
}

Fixed version (ground truth):
/** 
 * Gets the r-value (or intializer) of a node returned by getBestLValue. 
 */
static Node getRValueOfLValue(Node n){
  Node parent=n.getParent();
switch (parent.getType()) {
case Token.ASSIGN:
case Token.ASSIGN_BITOR:
case Token.ASSIGN_BITXOR:
case Token.ASSIGN_BITAND:
case Token.ASSIGN_LSH:
case Token.ASSIGN_RSH:
case Token.ASSIGN_URSH:
case Token.ASSIGN_ADD:
case Token.ASSIGN_SUB:
case Token.ASSIGN_MUL:
case Token.ASSIGN_DIV:
case Token.ASSIGN_MOD:
    return n.getNext();
case Token.VAR:
case Token.LET:
case Token.CONST:
case Token.OBJECTLIT:
  return n.getFirstChild();
case Token.FUNCTION:
case Token.CLASS:
return parent;
}
return null;
}
Program: 27408
Project: 27408
Buggy source:
void recordPassStart(String passName,boolean isOneTime){
  currentPass.push(new Stats(passName,isOneTime));
  codeChange.reset();
}

Fixed version (ground truth):
void recordPassStart(String passName,boolean isOneTime){
  currentPass.push(new Stats(passName,isOneTime));
  if (!passName.equals("String_Node_Str")) {
    codeChange.reset();
  }
}
Program: 27411
Project: 27411
Buggy source:
public void testForIn(){
  enableUnusedLocalAssignmentCheck=true;
  assertNoWarning("String_Node_Str");
}

Fixed version (ground truth):
public void testForIn(){
  enableUnusedLocalAssignmentCheck=true;
  assertNoWarning("String_Node_Str");
  assertNoWarning("String_Node_Str");
  assertNoWarning("String_Node_Str");
}
Program: 27412
Project: 27412
Buggy source:
@Override public void visit(NodeTraversal t,Node n,Node parent){
switch (n.getType()) {
case Token.CALL:
    Node callee=n.getFirstChild();
  if (callee.matchesQualifiedName("String_Node_Str")) {
    if (currentModuleName == null) {
      currentModuleName=extractFirstArgumentName(n);
    }
 else {
      t.report(n,MULTIPLE_MODULES_IN_FILE);
    }
  }
 else   if (callee.matchesQualifiedName("String_Node_Str")) {
    t.report(n,MODULE_AND_PROVIDES);
  }
 else   if (callee.matchesQualifiedName("String_Node_Str")) {
    checkRequireCall(t,n,parent);
  }
break;
case Token.THIS:
if (t.inGlobalHoistScope()) {
t.report(n,GOOG_MODULE_REFERENCES_THIS);
}
break;
case Token.THROW:
if (t.inGlobalHoistScope()) {
t.report(n,GOOG_MODULE_USES_THROW);
}
break;
case Token.GETPROP:
if (currentModuleName != null && n.matchesQualifiedName(currentModuleName)) {
t.report(n,REFERENCE_TO_MODULE_GLOBAL_NAME);
}
 else if (shortRequiredNamespaces.contains(n.getQualifiedName())) {
t.report(n,REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME);
}
break;
case Token.SCRIPT:
currentModuleName=null;
shortRequiredNamespaces.clear();
break;
}
}

Fixed version (ground truth):
@Override public void visit(NodeTraversal t,Node n,Node parent){
switch (n.getType()) {
case Token.CALL:
    Node callee=n.getFirstChild();
  if (callee.matchesQualifiedName("String_Node_Str")) {
    if (currentModuleName == null) {
      currentModuleName=extractFirstArgumentName(n);
    }
 else {
      t.report(n,MULTIPLE_MODULES_IN_FILE);
    }
  }
 else   if (callee.matchesQualifiedName("String_Node_Str")) {
    t.report(n,MODULE_AND_PROVIDES);
  }
 else   if (callee.matchesQualifiedName("String_Node_Str")) {
    checkRequireCall(t,n,parent);
  }
break;
case Token.THIS:
if (t.inGlobalHoistScope()) {
t.report(n,GOOG_MODULE_REFERENCES_THIS);
}
break;
case Token.THROW:
if (t.inGlobalHoistScope()) {
t.report(n,GOOG_MODULE_USES_THROW);
}
break;
case Token.GETPROP:
if (currentModuleName != null && n.matchesQualifiedName(currentModuleName)) {
t.report(n,REFERENCE_TO_MODULE_GLOBAL_NAME);
}
 else if (shortRequiredNamespaces.contains(n.getQualifiedName())) {
t.report(n,REFERENCE_TO_SHORT_IMPORT_BY_LONG_NAME,n.getQualifiedName());
}
break;
case Token.SCRIPT:
currentModuleName=null;
shortRequiredNamespaces.clear();
break;
}
}
Program: 27413
Project: 27413
Buggy source:
public void testTestTypes(){
  try {
    testTypes("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  AssertionError expected) {
  }
}

Fixed version (ground truth):
public void testTestTypes(){
  try {
    testTypes("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    throw new Error("String_Node_Str");
  }
 catch (  AssertionError expected) {
  }
}
Program: 27414
Project: 27414
Buggy source:
private static void lint(Path path,boolean fix) throws IOException {
  SourceFile file=SourceFile.fromFile(path.toString());
  Compiler compiler=new Compiler(System.out);
  CompilerOptions options=new CompilerOptions();
  options.setLanguage(LanguageMode.ECMASCRIPT6_STRICT);
  options.setSkipTranspilationAndCrash(true);
  options.setIdeMode(true);
  options.setCodingConvention(new GoogleCodingConvention());
  options.setWarningLevel(DiagnosticGroups.CHECK_TYPES,CheckLevel.WARNING);
  options.setWarningLevel(DiagnosticGroups.LINT_CHECKS,CheckLevel.WARNING);
  options.setWarningLevel(DiagnosticGroups.MISSING_REQUIRE,CheckLevel.WARNING);
  options.setWarningLevel(DiagnosticGroups.EXTRA_REQUIRE,CheckLevel.WARNING);
  compiler.setPassConfig(new LintPassConfig(options));
  compiler.disableThreads();
  SourceFile externs=SourceFile.fromCode("String_Node_Str","String_Node_Str");
  compiler.compile(ImmutableList.<SourceFile>of(externs),ImmutableList.of(file),options);
  if (fix) {
    List<SuggestedFix> fixes=new ArrayList<>();
    for (    JSError warning : compiler.getWarnings()) {
      SuggestedFix suggestedFix=ErrorToFixMapper.getFixForJsError(warning,compiler);
      if (suggestedFix != null) {
        fixes.add(suggestedFix);
      }
    }
    ApplySuggestedFixes.applySuggestedFixesToFiles(fixes);
  }
}

Fixed version (ground truth):
private static void lint(Path path,boolean fix) throws IOException {
  SourceFile file=SourceFile.fromFile(path.toString());
  Compiler compiler=new Compiler(System.out);
  CompilerOptions options=new CompilerOptions();
  options.setLanguage(LanguageMode.ECMASCRIPT6_STRICT);
  options.setSkipTranspilationAndCrash(true);
  options.setIdeMode(true);
  options.setCodingConvention(new GoogleCodingConvention());
  options.setWarningLevel(DiagnosticGroups.CHECK_TYPES,CheckLevel.WARNING);
  options.setWarningLevel(DiagnosticGroups.LINT_CHECKS,CheckLevel.WARNING);
  options.setWarningLevel(DiagnosticGroups.MISSING_REQUIRE,CheckLevel.WARNING);
  options.setWarningLevel(DiagnosticGroups.EXTRA_REQUIRE,CheckLevel.WARNING);
  compiler.setPassConfig(new LintPassConfig(options));
  compiler.disableThreads();
  SourceFile externs=SourceFile.fromCode("String_Node_Str","String_Node_Str");
  compiler.compile(ImmutableList.<SourceFile>of(externs),ImmutableList.of(file),options);
  if (fix) {
    List<SuggestedFix> fixes=new ArrayList<>();
    for (    JSError warning : concat(compiler.getErrors(),compiler.getWarnings(),JSError.class)) {
      SuggestedFix suggestedFix=ErrorToFixMapper.getFixForJsError(warning,compiler);
      if (suggestedFix != null) {
        fixes.add(suggestedFix);
      }
    }
    ApplySuggestedFixes.applySuggestedFixesToFiles(fixes);
  }
}
Program: 27415
Project: 27415
Buggy source:
@Override public JSType caseTemplateType(TemplateType type){
  if (replacements.hasTemplateKey(type)) {
    if (hasVisitedType(type) || !replacements.hasTemplateType(type)) {
      return type;
    }
 else {
      JSType replacement=replacements.getUnresolvedOriginalTemplateType(type);
      JSType restrictedReplacement=replacement.restrictByNotNullOrUndefined();
      if (restrictedReplacement.isTemplatizedType() && restrictedReplacement.toMaybeTemplatizedType().getTemplateTypes().contains(type)) {
        return type;
      }
      visitedTypes.push(type);
      JSType visitedReplacement=replacement.visit(this);
      visitedTypes.pop();
      return visitedReplacement;
    }
  }
 else {
    return type;
  }
}

Fixed version (ground truth):
@Override public JSType caseTemplateType(TemplateType type){
  if (replacements.hasTemplateKey(type)) {
    if (hasVisitedType(type) || !replacements.hasTemplateType(type)) {
      return type;
    }
 else {
      JSType replacement=replacements.getUnresolvedOriginalTemplateType(type);
      JSType restrictedReplacement=replacement.restrictByNotNullOrUndefined();
      if (restrictedReplacement.isTemplatizedType()) {
        Iterable<JSType> replacementTemplateTypes=restrictedReplacement.toMaybeTemplatizedType().getTemplateTypes();
        for (        JSType replacementTemplateType : replacementTemplateTypes) {
          if (!replacementTemplateType.differsFrom(type)) {
            return type;
          }
        }
      }
      visitedTypes.push(type);
      JSType visitedReplacement=replacement.visit(this);
      visitedTypes.pop();
      return visitedReplacement;
    }
  }
 else {
    return type;
  }
}
Program: 27416
Project: 27416
Buggy source:
@Override public JSType caseTemplateType(TemplateType type){
  if (replacements.hasTemplateKey(type)) {
    if (hasVisitedType(type) || !replacements.hasTemplateType(type)) {
      return type;
    }
 else {
      JSType replacement=replacements.getUnresolvedOriginalTemplateType(type);
      visitedTypes.push(type);
      JSType visitedReplacement=replacement.visit(this);
      visitedTypes.pop();
      return visitedReplacement;
    }
  }
 else {
    return type;
  }
}

Fixed version (ground truth):
@Override public JSType caseTemplateType(TemplateType type){
  if (replacements.hasTemplateKey(type)) {
    if (hasVisitedType(type) || !replacements.hasTemplateType(type)) {
      return type;
    }
 else {
      JSType replacement=replacements.getUnresolvedOriginalTemplateType(type);
      JSType restrictedReplacement=replacement.restrictByNotNullOrUndefined();
      if (restrictedReplacement.isTemplatizedType() && restrictedReplacement.toMaybeTemplatizedType().getTemplateTypes().contains(type)) {
        return type;
      }
      visitedTypes.push(type);
      JSType visitedReplacement=replacement.visit(this);
      visitedTypes.pop();
      return visitedReplacement;
    }
  }
 else {
    return type;
  }
}
Program: 27417
Project: 27417
Buggy source:
private FlagEntry<JsSourceType> createJsFile(String filename,String fileContent) throws IOException {
  File tempJsFile=File.createTempFile(filename,"String_Node_Str",Files.createTempDirectory("String_Node_Str").toFile());
  try (FileOutputStream fileOutputStream=new FileOutputStream(tempJsFile)){
    fileOutputStream.write(fileContent.getBytes(java.nio.charset.StandardCharsets.UTF_8));
  }
   return new FlagEntry<>(JsSourceType.JS,tempJsFile.getAbsolutePath());
}

Fixed version (ground truth):
private FlagEntry<JsSourceType> createJsFile(String filename,String fileContent) throws IOException {
  File tempJsFile=File.createTempFile(filename,"String_Node_Str",java.nio.file.Files.createTempDirectory("String_Node_Str").toFile());
  try (FileOutputStream fileOutputStream=new FileOutputStream(tempJsFile)){
    fileOutputStream.write(fileContent.getBytes(java.nio.charset.StandardCharsets.UTF_8));
  }
   return new FlagEntry<>(JsSourceType.JS,tempJsFile.getAbsolutePath());
}
Program: 27418
Project: 27418
Buggy source:
public void testGlobJs2() throws IOException, FlagUsageException {
  FlagEntry<JsSourceType> jsFile1=createJsFile("String_Node_Str","String_Node_Str");
  FlagEntry<JsSourceType> jsFile2=createJsFile("String_Node_Str","String_Node_Str");
  new File(jsFile2.value).renameTo(new File(new File(jsFile1.value).getParentFile() + File.separator + "String_Node_Str"));
  String glob=new File(jsFile1.value).getParent() + File.separator + "String_Node_Str";
  compileFiles("String_Node_Str",new FlagEntry<>(JsSourceType.JS,glob));
}

Fixed version (ground truth):
public void testGlobJs2() throws IOException {
  try {
    FlagEntry<JsSourceType> jsFile1=createJsFile("String_Node_Str","String_Node_Str");
    FlagEntry<JsSourceType> jsFile2=createJsFile("String_Node_Str","String_Node_Str");
    new File(jsFile2.value).renameTo(new File(new File(jsFile1.value).getParentFile() + File.separator + "String_Node_Str"));
    String glob=new File(jsFile1.value).getParent() + File.separator + "String_Node_Str";
    compileFiles("String_Node_Str",new FlagEntry<>(JsSourceType.JS,glob));
  }
 catch (  FlagUsageException e) {
    fail("String_Node_Str" + e);
  }
}
Program: 27419
Project: 27419
Buggy source:
private static FlagEntry<JsSourceType> createZipFile(Map<String,String> entryContentsByName) throws IOException {
  File tempZipFile=File.createTempFile("String_Node_Str","String_Node_Str",Files.createTempDirectory("String_Node_Str").toFile());
  try (ZipOutputStream zipOutputStream=new ZipOutputStream(new FileOutputStream(tempZipFile))){
    for (    Entry<String,String> entry : entryContentsByName.entrySet()) {
      zipOutputStream.putNextEntry(new ZipEntry(entry.getKey()));
      zipOutputStream.write(entry.getValue().getBytes(java.nio.charset.StandardCharsets.UTF_8));
    }
  }
   return new FlagEntry<>(JsSourceType.JS_ZIP,tempZipFile.getAbsolutePath());
}

Fixed version (ground truth):
private static FlagEntry<JsSourceType> createZipFile(Map<String,String> entryContentsByName) throws IOException {
  File tempZipFile=File.createTempFile("String_Node_Str","String_Node_Str",java.nio.file.Files.createTempDirectory("String_Node_Str").toFile());
  try (ZipOutputStream zipOutputStream=new ZipOutputStream(new FileOutputStream(tempZipFile))){
    for (    Entry<String,String> entry : entryContentsByName.entrySet()) {
      zipOutputStream.putNextEntry(new ZipEntry(entry.getKey()));
      zipOutputStream.write(entry.getValue().getBytes(java.nio.charset.StandardCharsets.UTF_8));
    }
  }
   return new FlagEntry<>(JsSourceType.JS_ZIP,tempZipFile.getAbsolutePath());
}
Program: 27420
Project: 27420
Buggy source:
public static JSType plus(JSType lhs,JSType rhs){
  if (lhs.equals(STRING) || rhs.equals(STRING)) {
    return STRING;
  }
  if (lhs.isUnknown() || lhs.isTop() || rhs.isUnknown()|| rhs.isTop()) {
    return UNKNOWN;
  }
  int newtype=(lhs.getMask() | rhs.getMask()) & STRING_MASK;
  if ((lhs.getMask() & ~STRING_MASK) != 0 && (rhs.getMask() & ~STRING_MASK) != 0) {
    newtype|=NUMBER_MASK;
  }
  return makeType(newtype);
}

Fixed version (ground truth):
public static JSType plus(JSType lhs,JSType rhs){
  if (!lhs.isUnknown() && !lhs.isBottom() && lhs.isSubtypeOf(STRING) || !rhs.isUnknown() && !rhs.isBottom() && rhs.isSubtypeOf(STRING)) {
    return STRING;
  }
  if (lhs.isUnknown() || lhs.isTop() || rhs.isUnknown()|| rhs.isTop()) {
    return UNKNOWN;
  }
  int newtype=(lhs.getMask() | rhs.getMask()) & STRING_MASK;
  if ((lhs.getMask() & ~STRING_MASK) != 0 && (rhs.getMask() & ~STRING_MASK) != 0) {
    newtype|=NUMBER_MASK;
  }
  return makeType(newtype);
}
Program: 27421
Project: 27421
Buggy source:
public void testEnumBasicTyping(){
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INEXISTENT_PROPERTY);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_OPERAND_TYPE);
}

Fixed version (ground truth):
public void testEnumBasicTyping(){
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INEXISTENT_PROPERTY);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck(LINE_JOINER.join("String_Node_Str","String_Node_Str","String_Node_Str"));
}
Program: 27423
Project: 27423
Buggy source:
@Override public boolean isSubtypeOf(TypeI other){
  JSType type2=(JSType)other;
  if (isLoose() || type2.isLoose()) {
    return autobox().isSubtypeOfHelper(true,type2.autobox());
  }
 else {
    return isSubtypeOfHelper(true,type2);
  }
}

Fixed version (ground truth):
@Override public boolean isSubtypeOf(TypeI other){
  if (this == other) {
    return true;
  }
  JSType type2=(JSType)other;
  if (isLoose() || type2.isLoose()) {
    return autobox().isSubtypeOfHelper(true,type2.autobox());
  }
 else {
    return isSubtypeOfHelper(true,type2);
  }
}
Program: 27424
Project: 27424
Buggy source:
private boolean isInvariantWith(Multimap<String,JSType> typeMultimap,NominalType other){
  Preconditions.checkState(isGeneric());
  Preconditions.checkState(this.rawType == other.rawType);
  Map<String,JSType> newTypeMap=new LinkedHashMap<>();
  for (  String typeVar : typeMultimap.keySet()) {
    Collection<JSType> c=typeMultimap.get(typeVar);
    if (c.size() != 1) {
      return false;
    }
    newTypeMap.put(typeVar,Preconditions.checkNotNull(Iterables.getOnlyElement(c)));
  }
  NominalType instantiated=instantiateGenerics(newTypeMap);
  return Objects.equals(instantiated.typeMap,other.typeMap);
}

Fixed version (ground truth):
private boolean isInvariantWith(Multimap<String,JSType> typeMultimap,NominalType other){
  Preconditions.checkState(isGeneric());
  Preconditions.checkState(this.rawType == other.rawType);
  Map<String,JSType> newTypeMap=new LinkedHashMap<>();
  for (  String typeVar : typeMultimap.keySet()) {
    Collection<JSType> c=typeMultimap.get(typeVar);
    if (c.size() != 1) {
      return false;
    }
    newTypeMap.put(typeVar,Preconditions.checkNotNull(Iterables.getOnlyElement(c)));
  }
  NominalType instantiated=instantiateGenerics(newTypeMap);
  Map<String,JSType> otherMap=other.typeMap;
  for (  Map.Entry<String,JSType> entry : instantiated.typeMap.entrySet()) {
    JSType t1=entry.getValue();
    JSType t2=otherMap.get(entry.getKey());
    if (!t1.isSubtypeOf(t2) || !t2.isSubtypeOf(t1)) {
      return false;
    }
  }
  return true;
}
Program: 27427
Project: 27427
Buggy source:
/** 
 * Creates JS source code inputs from a list of files.
 */
private List<SourceFile> createSourceInputs(List<FlagEntry<JsSourceType>> files,List<JsonFileSpec> jsonFiles) throws FlagUsageException, IOException {
  if (isInTestMode()) {
    return inputsSupplierForTesting != null ? inputsSupplierForTesting.get() : null;
  }
  if (files.isEmpty() && jsonFiles == null) {
    files=Collections.singletonList(new FlagEntry<JsSourceType>(JsSourceType.JS,"String_Node_Str"));
  }
  try {
    if (jsonFiles != null) {
      return createInputs(files,jsonFiles);
    }
 else {
      return createInputs(files,true);
    }
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Creates JS source code inputs from a list of files.
 */
private List<SourceFile> createSourceInputs(List<JsModuleSpec> jsModuleSpecs,List<FlagEntry<JsSourceType>> files,List<JsonFileSpec> jsonFiles) throws FlagUsageException, IOException {
  if (isInTestMode()) {
    return inputsSupplierForTesting != null ? inputsSupplierForTesting.get() : null;
  }
  if (files.isEmpty() && jsonFiles == null) {
    files=Collections.singletonList(new FlagEntry<JsSourceType>(JsSourceType.JS,"String_Node_Str"));
  }
  try {
    if (jsonFiles != null) {
      return createInputs(files,jsonFiles,jsModuleSpecs);
    }
 else {
      return createInputs(files,true,jsModuleSpecs);
    }
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}
Program: 27428
Project: 27428
Buggy source:
/** 
 * Creates JS extern inputs from a list of files.
 */
private List<SourceFile> createExternInputs(List<String> files) throws FlagUsageException, IOException {
  if (files.isEmpty()) {
    return ImmutableList.of(SourceFile.fromCode("String_Node_Str","String_Node_Str"));
  }
  List<FlagEntry<JsSourceType>> externFiles=new ArrayList<>();
  for (  String file : files) {
    externFiles.add(new FlagEntry<JsSourceType>(JsSourceType.EXTERN,file));
  }
  try {
    return createInputs(externFiles,false);
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Creates JS extern inputs from a list of files.
 */
private List<SourceFile> createExternInputs(List<String> files) throws FlagUsageException, IOException {
  if (files.isEmpty()) {
    return ImmutableList.of(SourceFile.fromCode("String_Node_Str","String_Node_Str"));
  }
  List<FlagEntry<JsSourceType>> externFiles=new ArrayList<>();
  for (  String file : files) {
    externFiles.add(new FlagEntry<JsSourceType>(JsSourceType.EXTERN,file));
  }
  try {
    return createInputs(externFiles,false,new ArrayList<JsModuleSpec>());
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}
Program: 27431
Project: 27431
Buggy source:
/** 
 * @param name Closure namespace used as an entry point. May start"goog:" when provided as a flag from the command line. Closure entry points may also be formatted as: 'moduleName:name.space' which specifies that the module name and provided namespace are different
 */
public static ModuleIdentifier forClosure(String name){
  String normalizedName=name;
  if (normalizedName.startsWith("String_Node_Str")) {
    normalizedName=normalizedName.substring(5);
  }
  String namespace=normalizedName;
  String moduleName=normalizedName;
  int splitPoint=normalizedName.indexOf(':');
  if (splitPoint != -1) {
    moduleName=normalizedName.substring(0,splitPoint);
    namespace=normalizedName.substring(Math.min(splitPoint + 1,normalizedName.length() - 1));
  }
  return new ModuleIdentifier(normalizedName,namespace,moduleName);
}

Fixed version (ground truth):
/** 
 * @param name Closure namespace used as an entry point. May start"goog:" when provided as a flag from the command line. Closure entry points may also be formatted as: 'goog:moduleName:name.space' which specifies that the module name and provided namespace are different
 */
public static ModuleIdentifier forClosure(String name){
  String normalizedName=name;
  if (normalizedName.startsWith("String_Node_Str")) {
    normalizedName=normalizedName.substring("String_Node_Str".length());
  }
  String namespace=normalizedName;
  String moduleName=normalizedName;
  int splitPoint=normalizedName.indexOf(':');
  if (splitPoint != -1) {
    moduleName=normalizedName.substring(0,splitPoint);
    namespace=normalizedName.substring(Math.min(splitPoint + 1,normalizedName.length() - 1));
  }
  return new ModuleIdentifier(normalizedName,namespace,moduleName);
}
Program: 27434
Project: 27434
Buggy source:
/** 
 * Creates JS source code inputs from a list of files.
 */
private List<SourceFile> createSourceInputs(List<String> files,List<String> zips,List<JsonFileSpec> jsonFiles) throws FlagUsageException, IOException {
  if (isInTestMode()) {
    return inputsSupplierForTesting != null ? inputsSupplierForTesting.get() : null;
  }
  if (files.isEmpty() && zips.isEmpty() && jsonFiles == null) {
    files=Collections.singletonList("String_Node_Str");
  }
  try {
    if (jsonFiles != null) {
      return createInputs(files,jsonFiles);
    }
 else {
      return createInputs(files,zips,true);
    }
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Creates JS source code inputs from a list of files.
 */
private List<SourceFile> createSourceInputs(List<FlagEntry<JsSourceType>> files,List<JsonFileSpec> jsonFiles) throws FlagUsageException, IOException {
  if (isInTestMode()) {
    return inputsSupplierForTesting != null ? inputsSupplierForTesting.get() : null;
  }
  if (files.isEmpty() && jsonFiles == null) {
    files=Collections.singletonList(new FlagEntry<JsSourceType>(JsSourceType.JS,"String_Node_Str"));
  }
  try {
    if (jsonFiles != null) {
      return createInputs(files,jsonFiles);
    }
 else {
      return createInputs(files,true);
    }
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}
Program: 27435
Project: 27435
Buggy source:
/** 
 * Creates JS extern inputs from a list of files.
 */
private List<SourceFile> createExternInputs(List<String> files) throws FlagUsageException, IOException {
  if (files.isEmpty()) {
    return ImmutableList.of(SourceFile.fromCode("String_Node_Str","String_Node_Str"));
  }
  try {
    return createInputs(files,false);
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Creates JS extern inputs from a list of files.
 */
private List<SourceFile> createExternInputs(List<String> files) throws FlagUsageException, IOException {
  if (files.isEmpty()) {
    return ImmutableList.of(SourceFile.fromCode("String_Node_Str","String_Node_Str"));
  }
  List<FlagEntry<JsSourceType>> externFiles=new ArrayList<>();
  for (  String file : files) {
    externFiles.add(new FlagEntry<JsSourceType>(JsSourceType.EXTERN,file));
  }
  try {
    return createInputs(externFiles,false);
  }
 catch (  FlagUsageException e) {
    throw new FlagUsageException("String_Node_Str" + e.getMessage());
  }
}
Program: 27437
Project: 27437
Buggy source:
/** 
 * Enables or disables the preservation of all whitespace and formatting within a JSDoc comment. By default, whitespace is collapsed for all comments except @license and
 * @preserve blocks,<p>Setting this option has no effect if  {@link #isParseJsDocDocumentation()}returns false.
 * @param preserveJsDocWhitespace True to preserve whitespace in text extracted from JSDoc comments.
 */
public void setPreserveJsDocWhitespace(boolean preserveJsDocWhitespace){
  this.preserveJsDocWhitespace=preserveJsDocWhitespace;
}

Fixed version (ground truth):
/** 
 * Enables or disables the preservation of all whitespace and formatting within a JSDoc comment. By default, whitespace is collapsed for all comments except   {@literal @license} and{@literal @preserve} blocks,<p>Setting this option has no effect if  {@link #isParseJsDocDocumentation()}returns false.
 * @param preserveJsDocWhitespace True to preserve whitespace in text extracted from JSDoc comments.
 */
public void setPreserveJsDocWhitespace(boolean preserveJsDocWhitespace){
  this.preserveJsDocWhitespace=preserveJsDocWhitespace;
}
Program: 27439
Project: 27439
Buggy source:
/** 
 * Get a region around the indicated line number. The exact definition of a region is implementation specific, but it must contain the line indicated by the line number. A region must not start or end by a carriage return.
 * @param lineNumber the line number, 1 being the first line of the file
 * @return the region around the line number indicated, or <code>null</null>if it does not exist
 */
Region getSourceRegion(String sourceName,int lineNumber);

Fixed version (ground truth):
/** 
 * Get a region around the indicated line number. The exact definition of a region is implementation specific, but it must contain the line indicated by the line number. A region must not start or end by a carriage return.
 * @param lineNumber the line number, 1 being the first line of the file
 * @return the region around the line number indicated, or {@code null}if it does not exist
 */
Region getSourceRegion(String sourceName,int lineNumber);
Program: 27440
Project: 27440
Buggy source:
/** 
 * This class depends on an input set that contains the white-list. The format of each white-list string is: <file-name>:<line-number>?  <warning-description> # <optional-comment>
 * @param whitelist The set of JS-warnings that are white-listed. This isexpected to have similar format as  {@code formatWarning(JSError)}.
 */
public WhitelistWarningsGuard(Set<String> whitelist){
  Preconditions.checkNotNull(whitelist);
  this.whitelist=normalizeWhitelist(whitelist);
}

Fixed version (ground truth):
/** 
 * This class depends on an input set that contains the white-list. The format of each white-list string is:  {@code <file-name>:<line-number>?  <warning-description>}{@code # <optional-comment>}
 * @param whitelist The set of JS-warnings that are white-listed. This isexpected to have similar format as  {@code formatWarning(JSError)}.
 */
public WhitelistWarningsGuard(Set<String> whitelist){
  Preconditions.checkNotNull(whitelist);
  this.whitelist=normalizeWhitelist(whitelist);
}
Program: 27441
Project: 27441
Buggy source:
/** 
 * Adds a <entrypoint/> entry Each entrypoint entry must have one attribute, name.
 */
public void addEntryPoint(Parameter entrypoint){
  this.entryPointParams.add(entrypoint);
}

Fixed version (ground truth):
/** 
 * Adds a   {@code <entrypoint/>} entryEach entrypoint entry must have one attribute, name.
 */
public void addEntryPoint(Parameter entrypoint){
  this.entryPointParams.add(entrypoint);
}
Program: 27442
Project: 27442
Buggy source:
/** 
 * Adds a <warning/> entry Each warning entry must have two attributes, group and level. Group must contain one of the constants from DiagnosticGroups (e.g., "ACCESS_CONTROLS"), while level must contain one of the CheckLevel constants ("ERROR", "WARNING" or "OFF").
 */
public void addWarning(Warning warning){
  this.warnings.add(warning);
}

Fixed version (ground truth):
/** 
 * Adds a   {@code <warning/>} entryEach warning entry must have two attributes, group and level. Group must contain one of the constants from DiagnosticGroups (e.g., "ACCESS_CONTROLS"), while level must contain one of the CheckLevel constants ("ERROR", "WARNING" or "OFF").
 */
public void addWarning(Warning warning){
  this.warnings.add(warning);
}
Program: 27443
Project: 27443
Buggy source:
/** 
 * Constructs a DependencyInfo object with the given list of provides & requires. This does *not* copy the given lists, but uses them directly.
 * @param srcPathRelativeToClosure The closure-relative path of the fileassociated with this DependencyInfo.
 * @param pathOfDefiningFile The path to the file from which this dependencyinformation was extracted.
 * @param provides List of provided symbols.
 * @param requires List of required symbols.
 */
public SimpleDependencyInfo(String srcPathRelativeToClosure,String pathOfDefiningFile,List<String> provides,List<String> requires,boolean isModule){
  this.srcPathRelativeToClosure=srcPathRelativeToClosure;
  this.pathOfDefiningFile=pathOfDefiningFile;
  this.provides=provides;
  this.requires=requires;
  this.isModule=isModule;
}

Fixed version (ground truth):
/** 
 * Constructs a DependencyInfo object with the given list of provides and requires. This does *not* copy the given lists, but uses them directly.
 * @param srcPathRelativeToClosure The closure-relative path of the fileassociated with this DependencyInfo.
 * @param pathOfDefiningFile The path to the file from which this dependencyinformation was extracted.
 * @param provides List of provided symbols.
 * @param requires List of required symbols.
 */
public SimpleDependencyInfo(String srcPathRelativeToClosure,String pathOfDefiningFile,List<String> provides,List<String> requires,boolean isModule){
  this.srcPathRelativeToClosure=srcPathRelativeToClosure;
  this.pathOfDefiningFile=pathOfDefiningFile;
  this.provides=provides;
  this.requires=requires;
  this.isModule=isModule;
}
Program: 27444
Project: 27444
Buggy source:
/** 
 * Unify   {@code this}, which may contain free type variables, with   {@code other}, a concrete type, modifying the supplied  {@code typeMultimap} to add any new template varaible type bindings.
 * @return Whether unification succeeded
 */
boolean unifyWithSubtype(ObjectType other,List<String> typeParameters,Multimap<String,JSType> typeMultimap){
  if (fn != null) {
    if (other.fn == null || !fn.unifyWithSubtype(other.fn,typeParameters,typeMultimap)) {
      return false;
    }
  }
  if (nominalType != null && other.nominalType != null) {
    return nominalType.unifyWithSubtype(other.nominalType,typeParameters,typeMultimap);
  }
  if (nominalType != null || other.nominalType != null) {
    return false;
  }
  for (  String propName : this.props.keySet()) {
    Property thisProp=props.get(propName);
    Property otherProp=other.props.get(propName);
    if (otherProp != null && !thisProp.unifyWithSubtype(otherProp,typeParameters,typeMultimap)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Unify   {@code this}, which may contain free type variables, with   {@code other}, a concrete type, modifying the supplied  {@code typeMultimap} to add any new template varaible type bindings.
 * @return Whether unification succeeded
 */
boolean unifyWithSubtype(ObjectType other,List<String> typeParameters,Multimap<String,JSType> typeMultimap){
  if (fn != null) {
    if (other.fn == null || !fn.unifyWithSubtype(other.fn,typeParameters,typeMultimap)) {
      return false;
    }
  }
  if (nominalType != null && other.nominalType != null) {
    return nominalType.unifyWithSubtype(other.nominalType,typeParameters,typeMultimap);
  }
  if (nominalType != null && other.nominalType == null) {
    return false;
  }
  for (  String propName : this.props.keySet()) {
    Property thisProp=props.get(propName);
    Property otherProp=other.props.get(propName);
    if (otherProp != null && !thisProp.unifyWithSubtype(otherProp,typeParameters,typeMultimap)) {
      return false;
    }
  }
  return true;
}
Program: 27446
Project: 27446
Buggy source:
/** 
 * Unify the two types symmetrically, given that we have already instantiated the type variables of interest in   {@code t1} and {@code t2}, treating JSType.UNKNOWN as a "hole" to be filled.
 * @return The unified type, or null if unification fails
 */
static ObjectType unifyUnknowns(ObjectType t1,ObjectType t2){
  if (!Objects.equals(t1.nominalType,t2.nominalType)) {
    return null;
  }
  FunctionType newFn=null;
  if (t1.fn != null || t2.fn != null) {
    newFn=FunctionType.unifyUnknowns(t1.fn,t2.fn);
    if (newFn == null) {
      return null;
    }
  }
  PersistentMap<String,Property> newProps=PersistentMap.create();
  for (  String propName : t1.props.keySet()) {
    Property prop1=t1.props.get(propName);
    Property prop2=t2.props.get(propName);
    if (prop2 == null) {
      return null;
    }
    Property p=Property.unifyUnknowns(prop1,prop2);
    if (p == null) {
      return null;
    }
    newProps=newProps.with(propName,p);
  }
  return makeObjectType(t1.nominalType,newProps,newFn,t1.isLoose || t2.isLoose,ObjectKind.join(t1.objectKind,t2.objectKind));
}

Fixed version (ground truth):
/** 
 * Unify the two types symmetrically, given that we have already instantiated the type variables of interest in   {@code t1} and {@code t2}, treating JSType.UNKNOWN as a "hole" to be filled.
 * @return The unified type, or null if unification fails
 */
static ObjectType unifyUnknowns(ObjectType t1,ObjectType t2){
  NominalType nt1=t1.nominalType;
  NominalType nt2=t2.nominalType;
  NominalType nt;
  if (nt1 == null && nt2 == null) {
    nt=null;
  }
 else   if (nt1 == null || nt2 == null) {
    return null;
  }
 else {
    nt=NominalType.unifyUnknowns(nt1,nt2);
    if (nt == null) {
      return null;
    }
  }
  FunctionType newFn=null;
  if (t1.fn != null || t2.fn != null) {
    newFn=FunctionType.unifyUnknowns(t1.fn,t2.fn);
    if (newFn == null) {
      return null;
    }
  }
  PersistentMap<String,Property> newProps=PersistentMap.create();
  for (  String propName : t1.props.keySet()) {
    Property prop1=t1.props.get(propName);
    Property prop2=t2.props.get(propName);
    if (prop2 == null) {
      return null;
    }
    Property p=Property.unifyUnknowns(prop1,prop2);
    if (p == null) {
      return null;
    }
    newProps=newProps.with(propName,p);
  }
  return makeObjectType(nt,newProps,newFn,t1.isLoose || t2.isLoose,ObjectKind.join(t1.objectKind,t2.objectKind));
}
Program: 27449
Project: 27449
Buggy source:
private void visitVar(Node nameNode,Node parent){
  String name=nameNode.getString();
  if (this.currentScope.isNamespace(name) || NodeUtil.isTypedefDecl(nameNode) || NodeUtil.isEnumDecl(nameNode)) {
    if (!this.currentScope.isDefinedLocally(name,false)) {
      this.currentScope.addLocal(name,JSType.UNKNOWN,false,nameNode.isFromExterns());
    }
    return;
  }
  Node initializer=nameNode.getFirstChild();
  if (initializer != null && initializer.isFunction()) {
    return;
  }
 else   if (this.currentScope.isDefinedLocally(name,false)) {
    return;
  }
  if (parent.isCatch()) {
    this.currentScope.addLocal(name,JSType.UNKNOWN,false,false);
  }
 else {
    boolean isConst=isConst(nameNode);
    JSType declType=getVarTypeFromAnnotation(nameNode,this.currentScope);
    if (declType == null) {
      declType=mayInferFromRhsIfConst(nameNode);
    }
    this.currentScope.addLocal(name,declType,isConst,nameNode.isFromExterns());
  }
}

Fixed version (ground truth):
private void visitVar(Node nameNode,Node parent){
  String name=nameNode.getString();
  boolean isDefinedLocally=this.currentScope.isDefinedLocally(name,false);
  if (isDefinedLocally && this.currentScope.isNamespace(name)) {
    return;
  }
  if (NodeUtil.isTypedefDecl(nameNode) || NodeUtil.isEnumDecl(nameNode)) {
    if (!isDefinedLocally) {
      this.currentScope.addLocal(name,JSType.UNKNOWN,false,nameNode.isFromExterns());
    }
    return;
  }
  Node initializer=nameNode.getFirstChild();
  if (initializer != null && initializer.isFunction()) {
    return;
  }
  if (parent.isCatch()) {
    this.currentScope.addLocal(name,JSType.UNKNOWN,false,false);
  }
 else {
    boolean isConst=isConst(nameNode);
    JSType declType=getVarTypeFromAnnotation(nameNode,this.currentScope);
    if (declType == null) {
      declType=mayInferFromRhsIfConst(nameNode);
    }
    this.currentScope.addLocal(name,declType,isConst,nameNode.isFromExterns());
  }
}
Program: 27450
Project: 27450
Buggy source:
private DeclaredFunctionType computeFnDeclaredType(JSDocInfo fnDoc,String functionName,Node declNode,RawNominalType ownerType,NTIScope parentScope){
  Preconditions.checkArgument(declNode.isFunction() || declNode.isGetProp());
  if (fnDoc == null && !NodeUtil.functionHasInlineJsdocs(declNode)) {
    DeclaredFunctionType t=getDeclaredFunctionTypeFromContext(functionName,declNode,parentScope);
    if (t != null) {
      return t;
    }
  }
  RawNominalType ctorType=declNode.isFunction() ? nominaltypesByNode.get(declNode) : null;
  FunctionAndSlotType result=typeParser.getFunctionType(fnDoc,functionName,declNode,ctorType,ownerType,parentScope);
  Node qnameNode=declNode.isGetProp() ? declNode : NodeUtil.getFunctionNameNode(declNode);
  if (result.slotType != null && qnameNode != null && qnameNode.isName()) {
    parentScope.addSimpleType(qnameNode,result.slotType);
  }
  if (ctorType != null) {
    ctorType.setCtorFunction(result.functionType.toFunctionType(),commonTypes);
  }
  if (declNode.isFunction()) {
    maybeWarnFunctionDeclaration(declNode,result.functionType);
  }
  return result.functionType;
}

Fixed version (ground truth):
private DeclaredFunctionType computeFnDeclaredType(JSDocInfo fnDoc,String functionName,Node declNode,RawNominalType ownerType,NTIScope parentScope){
  Preconditions.checkArgument(declNode.isFunction() || declNode.isGetProp());
  if (fnDoc == null && !NodeUtil.functionHasInlineJsdocs(declNode)) {
    DeclaredFunctionType t=getDeclaredFunctionTypeFromContext(functionName,declNode,parentScope);
    if (t != null) {
      return t;
    }
  }
  RawNominalType ctorType=declNode.isFunction() ? nominaltypesByNode.get(declNode) : null;
  FunctionAndSlotType result=typeParser.getFunctionType(fnDoc,functionName,declNode,ctorType,ownerType,parentScope);
  Node qnameNode=declNode.isGetProp() ? declNode : NodeUtil.getFunctionNameNode(declNode);
  if (result.slotType != null && qnameNode != null && qnameNode.isName()) {
    parentScope.addLocal(qnameNode.getString(),result.slotType,false,qnameNode.isFromExterns());
  }
  if (ctorType != null) {
    ctorType.setCtorFunction(result.functionType.toFunctionType(),commonTypes);
  }
  if (declNode.isFunction()) {
    maybeWarnFunctionDeclaration(declNode,result.functionType);
  }
  return result.functionType;
}
Program: 27451
Project: 27451
Buggy source:
void addLocal(String name,JSType declType,boolean isConstant,boolean isFromExterns){
  Preconditions.checkArgument(!name.contains("String_Node_Str"));
  Preconditions.checkArgument(!isDefinedLocally(name,false));
  if (isConstant) {
    constVars.add(name);
  }
  if (isFromExterns) {
    externs.put(name,declType);
  }
 else {
    locals.put(name,declType);
  }
}

Fixed version (ground truth):
void addLocal(String name,JSType declType,boolean isConstant,boolean isFromExterns){
  Preconditions.checkArgument(!name.contains("String_Node_Str"));
  if (isConstant) {
    constVars.add(name);
  }
  if (isFromExterns) {
    externs.put(name,declType);
  }
 else {
    locals.put(name,declType);
  }
}
Program: 27452
Project: 27452
Buggy source:
private void addNamespaceLit(Node qnameNode,NamespaceLit nslit){
  Preconditions.checkArgument(!isNamespace(qnameNode));
  if (qnameNode.isName()) {
    String varName=qnameNode.getString();
    localNamespaces.put(varName,nslit);
    if (qnameNode.isFromExterns() && !externs.containsKey(varName)) {
      externs.put(qnameNode.getString(),null);
    }
  }
 else {
    QualifiedName qname=QualifiedName.fromNode(qnameNode);
    Namespace ns=getNamespace(qname.getLeftmostName());
    ns.addSubnamespace(qname.getAllButLeftmost(),nslit);
  }
}

Fixed version (ground truth):
private void addNamespaceLit(Node qnameNode,NamespaceLit nslit){
  if (qnameNode.isName()) {
    String varName=qnameNode.getString();
    Preconditions.checkArgument(!isDefinedLocally(varName,false) || !isNamespace(qnameNode));
    localNamespaces.put(varName,nslit);
    if (qnameNode.isFromExterns() && !externs.containsKey(varName)) {
      externs.put(qnameNode.getString(),null);
    }
  }
 else {
    Preconditions.checkArgument(!isNamespace(qnameNode));
    QualifiedName qname=QualifiedName.fromNode(qnameNode);
    Namespace ns=getNamespace(qname.getLeftmostName());
    ns.addSubnamespace(qname.getAllButLeftmost(),nslit);
  }
}