nus-yam/ex-repair huggingface dataset:
Program: 27709
Project: 27709
Buggy source:
private EnvTypePair analyzeObjLitBwd(Node objLit,TypeEnv outEnv,JSType requiredType){
  if (NodeUtil.isEnumDecl(objLit.getParent().getParent())) {
    return analyzeEnumObjLitBwd(objLit,outEnv,requiredType);
  }
  TypeEnv env=outEnv;
  JSType result=pickReqObjType(objLit);
  for (Node prop=objLit.getLastChild(); prop != null; prop=objLit.getChildBefore(prop)) {
    QualifiedName pname=new QualifiedName(NodeUtil.getObjectLitKeyName(prop));
    if (prop.isGetterDef() || prop.isSetterDef()) {
      env=analyzeExprBwd(prop.getFirstChild(),env).env;
    }
 else {
      JSType jsdocType=symbolTable.getPropDeclaredType(prop);
      JSType reqPtype;
      if (jsdocType != null) {
        reqPtype=jsdocType;
      }
 else       if (requiredType.mayHaveProp(pname)) {
        reqPtype=requiredType.getProp(pname);
      }
 else {
        reqPtype=JSType.UNKNOWN;
      }
      EnvTypePair pair=analyzeExprBwd(prop.getFirstChild(),env,reqPtype);
      result=result.withProperty(pname,pair.type);
      env=pair.env;
    }
  }
  return new EnvTypePair(env,result);
}

Fixed version (ground truth):
private EnvTypePair analyzeObjLitBwd(Node objLit,TypeEnv outEnv,JSType requiredType){
  if (NodeUtil.isEnumDecl(objLit.getParent())) {
    return analyzeEnumObjLitBwd(objLit,outEnv,requiredType);
  }
  TypeEnv env=outEnv;
  JSType result=pickReqObjType(objLit);
  for (Node prop=objLit.getLastChild(); prop != null; prop=objLit.getChildBefore(prop)) {
    QualifiedName pname=new QualifiedName(NodeUtil.getObjectLitKeyName(prop));
    if (prop.isGetterDef() || prop.isSetterDef()) {
      env=analyzeExprBwd(prop.getFirstChild(),env).env;
    }
 else {
      JSType jsdocType=symbolTable.getPropDeclaredType(prop);
      JSType reqPtype;
      if (jsdocType != null) {
        reqPtype=jsdocType;
      }
 else       if (requiredType.mayHaveProp(pname)) {
        reqPtype=requiredType.getProp(pname);
      }
 else {
        reqPtype=JSType.UNKNOWN;
      }
      EnvTypePair pair=analyzeExprBwd(prop.getFirstChild(),env,reqPtype);
      result=result.withProperty(pname,pair.type);
      env=pair.env;
    }
  }
  return new EnvTypePair(env,result);
}
Program: 27710
Project: 27710
Buggy source:
static boolean isEnumDecl(Node n){
  if (n.isVar() || n.isName() && n.getParent().isVar() || (n.isGetProp() && n.getParent().isAssign() && n.getParent().getParent().isExprResult())) {
    JSDocInfo jsdoc=getBestJSDocInfo(n);
    return jsdoc != null && jsdoc.hasEnumParameterType();
  }
  return false;
}

Fixed version (ground truth):
static boolean isEnumDecl(Node n){
  if (n.isVar() || n.isName() && n.getParent().isVar() || (n.isGetProp() && n.getParent().isAssign() && n.getParent().getParent().isExprResult()) || (n.isAssign() && n.getParent().isExprResult())) {
    JSDocInfo jsdoc=getBestJSDocInfo(n);
    return jsdoc != null && jsdoc.hasEnumParameterType();
  }
  return false;
}
Program: 27711
Project: 27711
Buggy source:
public JSType toJSType(){
  return enumObjType;
}

Fixed version (ground truth):
public JSType toJSType(){
  Preconditions.checkState(state == State.RESOLVED);
  if (enumObjType == null) {
    enumObjType=computeObjType();
  }
  return enumObjType;
}
Program: 27712
Project: 27712
Buggy source:
void resolveEnum(JSType t){
  Preconditions.checkNotNull(t);
  if (state == State.RESOLVED) {
    return;
  }
  Preconditions.checkState(state == State.DURING_RESOLUTION,"String_Node_Str",state.toString());
  state=State.RESOLVED;
  typeExpr=null;
  declaredType=t;
  enumPropType=JSType.fromEnum(this);
  enumObjType=computeObjType();
}

Fixed version (ground truth):
void resolveEnum(JSType t){
  Preconditions.checkNotNull(t);
  if (state == State.RESOLVED) {
    return;
  }
  Preconditions.checkState(state == State.DURING_RESOLUTION,"String_Node_Str",state.toString());
  state=State.RESOLVED;
  typeExpr=null;
  declaredType=t;
  enumPropType=JSType.fromEnum(this);
}
Program: 27713
Project: 27713
Buggy source:
public void resolveEnum(String name,DeclaredTypeRegistry registry){
  EnumType e=registry.getEnum(name);
  Preconditions.checkState(e != null,"String_Node_Str" + "String_Node_Str");
  if (e.isResolved()) {
    return;
  }
  JSTypeExpression texp=e.getTypeExpr();
  JSType enumeratedType;
  if (texp == null) {
    warn("String_Node_Str",e.getTypeExprForErrorReporting().getRootNode());
    enumeratedType=JSType.UNKNOWN;
  }
 else {
    int numTypeVars=howmanyTypeVars;
    enumeratedType=getTypeFromJSTypeExpression(texp,null,registry,null);
    if (howmanyTypeVars > numTypeVars) {
      warn("String_Node_Str",texp.getRootNode());
      enumeratedType=JSType.UNKNOWN;
      howmanyTypeVars=numTypeVars;
    }
 else     if (enumeratedType.isTop()) {
      warn("String_Node_Str" + "String_Node_Str",texp.getRootNode());
      enumeratedType=JSType.UNKNOWN;
    }
 else     if (enumeratedType.isUnion()) {
      warn("String_Node_Str",texp.getRootNode());
      enumeratedType=JSType.UNKNOWN;
    }
  }
  e.resolveEnum(enumeratedType);
}

Fixed version (ground truth):
public void resolveEnum(EnumType e,DeclaredTypeRegistry registry){
  Preconditions.checkState(e != null,"String_Node_Str" + "String_Node_Str");
  if (e.isResolved()) {
    return;
  }
  JSTypeExpression texp=e.getTypeExpr();
  JSType enumeratedType;
  if (texp == null) {
    warn("String_Node_Str",e.getTypeExprForErrorReporting().getRootNode());
    enumeratedType=JSType.UNKNOWN;
  }
 else {
    int numTypeVars=howmanyTypeVars;
    enumeratedType=getTypeFromJSTypeExpression(texp,null,registry,null);
    if (howmanyTypeVars > numTypeVars) {
      warn("String_Node_Str",texp.getRootNode());
      enumeratedType=JSType.UNKNOWN;
      howmanyTypeVars=numTypeVars;
    }
 else     if (enumeratedType.isTop()) {
      warn("String_Node_Str" + "String_Node_Str",texp.getRootNode());
      enumeratedType=JSType.UNKNOWN;
    }
 else     if (enumeratedType.isUnion()) {
      warn("String_Node_Str",texp.getRootNode());
      enumeratedType=JSType.UNKNOWN;
    }
  }
  e.resolveEnum(enumeratedType);
}
Program: 27714
Project: 27714
Buggy source:
public void resolveTypedef(String name,DeclaredTypeRegistry registry){
  Typedef td=registry.getTypedef(name);
  Preconditions.checkState(td != null,"String_Node_Str" + "String_Node_Str");
  if (td.isResolved()) {
    return;
  }
  JSTypeExpression texp=td.getTypeExpr();
  JSType tdType;
  if (texp == null) {
    warn("String_Node_Str",td.getTypeExprForErrorReporting().getRootNode());
    tdType=JSType.UNKNOWN;
  }
 else {
    tdType=getTypeFromJSTypeExpression(texp,null,registry,null);
  }
  td.resolveTypedef(tdType);
}

Fixed version (ground truth):
public void resolveTypedef(Typedef td,DeclaredTypeRegistry registry){
  Preconditions.checkState(td != null,"String_Node_Str" + "String_Node_Str");
  if (td.isResolved()) {
    return;
  }
  JSTypeExpression texp=td.getTypeExpr();
  JSType tdType;
  if (texp == null) {
    warn("String_Node_Str",td.getTypeExprForErrorReporting().getRootNode());
    tdType=JSType.UNKNOWN;
  }
 else {
    tdType=getTypeFromJSTypeExpression(texp,null,registry,null);
  }
  td.resolveTypedef(tdType);
}
Program: 27715
Project: 27715
Buggy source:
private JSType getTypedefType(String name,DeclaredTypeRegistry registry){
  resolveTypedef(name,registry);
  return registry.getTypedef(name).getType();
}

Fixed version (ground truth):
private JSType getTypedefType(Typedef td,DeclaredTypeRegistry registry){
  resolveTypedef(td,registry);
  return td.getType();
}
Program: 27716
Project: 27716
Buggy source:
private JSType getEnumPropType(String name,DeclaredTypeRegistry registry){
  resolveEnum(name,registry);
  return registry.getEnum(name).getPropType();
}

Fixed version (ground truth):
private JSType getEnumPropType(EnumType e,DeclaredTypeRegistry registry){
  resolveEnum(e,registry);
  return e.getPropType();
}
Program: 27717
Project: 27717
Buggy source:
private JSType getNamedTypeHelper(Node n,RawNominalType ownerType,DeclaredTypeRegistry registry,ImmutableList<String> outerTypeParameters) throws UnknownTypeException {
  String typeName=n.getString();
switch (typeName) {
case "String_Node_Str":
    return JSType.BOOLEAN;
case "String_Node_Str":
  return JSType.NULL;
case "String_Node_Str":
return JSType.NUMBER;
case "String_Node_Str":
return JSType.STRING;
case "String_Node_Str":
case "String_Node_Str":
return JSType.UNDEFINED;
case "String_Node_Str":
return UNKNOWN_FUNCTION_OR_NULL;
case "String_Node_Str":
return OBJECT_OR_NULL;
default :
{
if (hasTypeVariable(outerTypeParameters,ownerType,typeName)) {
return JSType.fromTypeVar(typeName);
}
 else {
if (registry.getTypedef(typeName) != null) {
return getTypedefType(typeName,registry);
}
if (registry.getEnum(typeName) != null) {
return getEnumPropType(typeName,registry);
}
JSType namedType=registry.lookupTypeByName(typeName);
if (namedType == null) {
unknownTypeNames.put(n,typeName);
throw new UnknownTypeException("String_Node_Str" + typeName);
}
if (namedType.isTypeVariable()) {
howmanyTypeVars++;
return namedType;
}
return getNominalTypeHelper(namedType,n,ownerType,registry,outerTypeParameters);
}
}
}
}

Fixed version (ground truth):
private JSType getNamedTypeHelper(Node n,RawNominalType ownerType,DeclaredTypeRegistry registry,ImmutableList<String> outerTypeParameters) throws UnknownTypeException {
  String typeName=n.getString();
switch (typeName) {
case "String_Node_Str":
    return JSType.BOOLEAN;
case "String_Node_Str":
  return JSType.NULL;
case "String_Node_Str":
return JSType.NUMBER;
case "String_Node_Str":
return JSType.STRING;
case "String_Node_Str":
case "String_Node_Str":
return JSType.UNDEFINED;
case "String_Node_Str":
return UNKNOWN_FUNCTION_OR_NULL;
case "String_Node_Str":
return OBJECT_OR_NULL;
default :
{
if (hasTypeVariable(outerTypeParameters,ownerType,typeName)) {
return JSType.fromTypeVar(typeName);
}
 else {
Typedef td=registry.getTypedef(typeName);
if (td != null) {
return getTypedefType(td,registry);
}
EnumType e=registry.getEnum(typeName);
if (e != null) {
return getEnumPropType(e,registry);
}
JSType namedType=registry.lookupTypeByName(typeName);
if (namedType == null) {
unknownTypeNames.put(n,typeName);
throw new UnknownTypeException("String_Node_Str" + typeName);
}
if (namedType.isTypeVariable()) {
howmanyTypeVars++;
return namedType;
}
return getNominalTypeHelper(namedType,n,ownerType,registry,outerTypeParameters);
}
}
}
}
Program: 27718
Project: 27718
Buggy source:
private void visitExport(NodeTraversal t,Node n,Node parent){
  if (n.getBooleanProp(Node.EXPORT_DEFAULT)) {
    compiler.report(JSError.make(n,Es6ToEs3Converter.CANNOT_CONVERT_YET,"String_Node_Str"));
  }
 else   if (n.getBooleanProp(Node.EXPORT_ALL_FROM)) {
    compiler.report(JSError.make(n,Es6ToEs3Converter.CANNOT_CONVERT_YET,"String_Node_Str"));
  }
 else {
    if (n.getChildCount() == 2) {
      compiler.report(JSError.make(n,Es6ToEs3Converter.CANNOT_CONVERT_YET,"String_Node_Str"));
      return;
    }
    if (n.getFirstChild().getType() == Token.EXPORT_SPECS) {
      for (      Node grandChild : n.getFirstChild().children()) {
        Node origName=grandChild.getFirstChild();
        exportMap.put(grandChild.getChildCount() == 2 ? grandChild.getLastChild().getString() : origName.getString(),origName.getString());
      }
      parent.removeChild(n);
    }
 else {
      String name=n.getFirstChild().getFirstChild().getString();
      Var v=t.getScope().getVar(name);
      if (v == null || v.isGlobal()) {
        exportMap.put(name,name);
      }
      parent.replaceChild(n,n.removeFirstChild());
    }
    compiler.reportCodeChange();
  }
}

Fixed version (ground truth):
private void visitExport(NodeTraversal t,Node n,Node parent){
  if (n.getBooleanProp(Node.EXPORT_DEFAULT)) {
    compiler.report(JSError.make(n,Es6ToEs3Converter.CANNOT_CONVERT_YET,"String_Node_Str"));
  }
 else   if (n.getBooleanProp(Node.EXPORT_ALL_FROM)) {
    compiler.report(JSError.make(n,Es6ToEs3Converter.CANNOT_CONVERT_YET,"String_Node_Str"));
  }
 else {
    if (n.getChildCount() == 2) {
      compiler.report(JSError.make(n,Es6ToEs3Converter.CANNOT_CONVERT_YET,"String_Node_Str"));
      return;
    }
    if (n.getFirstChild().getType() == Token.EXPORT_SPECS) {
      for (      Node grandChild : n.getFirstChild().children()) {
        Node origName=grandChild.getFirstChild();
        exportMap.put(grandChild.getChildCount() == 2 ? grandChild.getLastChild().getString() : origName.getString(),origName.getString());
      }
      parent.removeChild(n);
    }
 else {
      for (      Node grandChild : n.getFirstChild().children()) {
        if (!grandChild.isName()) {
          break;
        }
        String name=grandChild.getString();
        Var v=t.getScope().getVar(name);
        if (v == null || v.isGlobal()) {
          exportMap.put(name,name);
        }
      }
      parent.replaceChild(n,n.removeFirstChild());
    }
    compiler.reportCodeChange();
  }
}
Program: 27719
Project: 27719
Buggy source:
public void testExport(){
  test("String_Node_Str","String_Node_Str");
  test("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testExport(){
  test("String_Node_Str","String_Node_Str");
  test("String_Node_Str","String_Node_Str");
  test("String_Node_Str","String_Node_Str");
  test("String_Node_Str","String_Node_Str");
}
Program: 27720
Project: 27720
Buggy source:
@Override public void visit(NodeTraversal t,Node n,Node parent){
switch (n.getType()) {
case Token.LABEL:
    tryMinimizeExits(n.getLastChild(),Token.BREAK,n.getFirstChild().getString());
  break;
case Token.FOR:
case Token.WHILE:
tryMinimizeExits(NodeUtil.getLoopCodeBlock(n),Token.CONTINUE,null);
break;
case Token.DO:
tryMinimizeExits(NodeUtil.getLoopCodeBlock(n),Token.CONTINUE,null);
Node cond=NodeUtil.getConditionExpression(n);
if (NodeUtil.getImpureBooleanValue(cond) == TernaryValue.FALSE) {
tryMinimizeExits(n.getFirstChild(),Token.BREAK,null);
}
break;
case Token.FUNCTION:
tryMinimizeExits(n.getLastChild(),Token.RETURN,null);
break;
}
}

Fixed version (ground truth):
@Override public void visit(NodeTraversal t,Node n,Node parent){
switch (n.getType()) {
case Token.LABEL:
    tryMinimizeExits(n.getLastChild(),Token.BREAK,n.getFirstChild().getString());
  break;
case Token.FOR:
case Token.WHILE:
tryMinimizeExits(NodeUtil.getLoopCodeBlock(n),Token.CONTINUE,null);
break;
case Token.DO:
tryMinimizeExits(NodeUtil.getLoopCodeBlock(n),Token.CONTINUE,null);
Node cond=NodeUtil.getConditionExpression(n);
if (NodeUtil.getPureBooleanValue(cond) == TernaryValue.FALSE) {
tryMinimizeExits(n.getFirstChild(),Token.BREAK,null);
}
break;
case Token.FUNCTION:
tryMinimizeExits(n.getLastChild(),Token.RETURN,null);
break;
}
}
Program: 27721
Project: 27721
Buggy source:
/** 
 * Gets the boolean value of a node that represents a expression. This method effectively emulates the <code>Boolean()</code> JavaScript cast function. Note: unlike getBooleanValue this function does not return UNKNOWN for expressions with side-effects.
 */
static TernaryValue getImpureBooleanValue(Node n){
switch (n.getType()) {
case Token.ASSIGN:
case Token.COMMA:
    return getImpureBooleanValue(n.getLastChild());
case Token.NOT:
  TernaryValue value=getImpureBooleanValue(n.getLastChild());
return value.not();
case Token.AND:
{
TernaryValue lhs=getImpureBooleanValue(n.getFirstChild());
TernaryValue rhs=getImpureBooleanValue(n.getLastChild());
return lhs.and(rhs);
}
case Token.OR:
{
TernaryValue lhs=getImpureBooleanValue(n.getFirstChild());
TernaryValue rhs=getImpureBooleanValue(n.getLastChild());
return lhs.or(rhs);
}
case Token.HOOK:
{
TernaryValue trueValue=getImpureBooleanValue(n.getFirstChild().getNext());
TernaryValue falseValue=getImpureBooleanValue(n.getLastChild());
if (trueValue.equals(falseValue)) {
return trueValue;
}
 else {
return TernaryValue.UNKNOWN;
}
}
case Token.ARRAYLIT:
case Token.OBJECTLIT:
return TernaryValue.TRUE;
case Token.VOID:
return TernaryValue.FALSE;
default :
return getPureBooleanValue(n);
}
}

Fixed version (ground truth):
/** 
 * Gets the boolean value of a node that represents a expression. This method effectively emulates the <code>Boolean()</code> JavaScript cast function. Note: unlike getPureBooleanValue this function does not return UNKNOWN for expressions with side-effects.
 */
static TernaryValue getImpureBooleanValue(Node n){
switch (n.getType()) {
case Token.ASSIGN:
case Token.COMMA:
    return getImpureBooleanValue(n.getLastChild());
case Token.NOT:
  TernaryValue value=getImpureBooleanValue(n.getLastChild());
return value.not();
case Token.AND:
{
TernaryValue lhs=getImpureBooleanValue(n.getFirstChild());
TernaryValue rhs=getImpureBooleanValue(n.getLastChild());
return lhs.and(rhs);
}
case Token.OR:
{
TernaryValue lhs=getImpureBooleanValue(n.getFirstChild());
TernaryValue rhs=getImpureBooleanValue(n.getLastChild());
return lhs.or(rhs);
}
case Token.HOOK:
{
TernaryValue trueValue=getImpureBooleanValue(n.getFirstChild().getNext());
TernaryValue falseValue=getImpureBooleanValue(n.getLastChild());
if (trueValue.equals(falseValue)) {
return trueValue;
}
 else {
return TernaryValue.UNKNOWN;
}
}
case Token.ARRAYLIT:
case Token.OBJECTLIT:
return TernaryValue.TRUE;
case Token.VOID:
return TernaryValue.FALSE;
default :
return getPureBooleanValue(n);
}
}
Program: 27722
Project: 27722
Buggy source:
/** 
 * Vars are hoisted into the closure containing the iterator to preserve their state accross multiple calls to next().
 */
private void visitVar(Node varStatement,Node enclosingCase,Node hoistRoot){
  Node name=varStatement.getFirstChild();
  enclosingCase.getLastChild().addChildToBack(IR.exprResult(IR.assign(name.detachFromParent(),name.removeFirstChild())));
  hoistRoot.getParent().addChildAfter(IR.var(name.cloneTree()),hoistRoot);
}

Fixed version (ground truth):
/** 
 * Vars are hoisted into the closure containing the iterator to preserve their state accross multiple calls to next().
 */
private void visitVar(Node varStatement,Node enclosingCase,Node hoistRoot){
  Node name=varStatement.removeFirstChild();
  while (name != null) {
    enclosingCase.getLastChild().addChildToBack(IR.exprResult(IR.assign(name,name.removeFirstChild())));
    hoistRoot.getParent().addChildAfter(IR.var(name.cloneTree()),hoistRoot);
    name=varStatement.removeFirstChild();
  }
}
Program: 27723
Project: 27723
Buggy source:
public void testSimpleGenerator(){
  test("String_Node_Str",Joiner.on('\n').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","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  test("String_Node_Str",Joiner.on('\n').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","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  test("String_Node_Str",Joiner.on('\n').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","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","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
public void testSimpleGenerator(){
  test("String_Node_Str",Joiner.on('\n').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","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  test("String_Node_Str",Joiner.on('\n').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","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  test("String_Node_Str",Joiner.on('\n').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","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  test("String_Node_Str",Joiner.on('\n').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","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","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
}
Program: 27724
Project: 27724
Buggy source:
private Scope getScopeHelper(String fnName){
  Scope s=localFunDefs.get(fnName);
  if (s != null) {
    return s;
  }
 else   if (parent != null) {
    return parent.getScopeHelper(fnName);
  }
  return null;
}

Fixed version (ground truth):
private Scope getScopeHelper(String fnName){
  Scope s=localFunDefs.get(fnName);
  if (s != null) {
    return s;
  }
 else   if (parent != null && !isDefinedLocally(fnName)) {
    return parent.getScopeHelper(fnName);
  }
  return null;
}
Program: 27726
Project: 27726
Buggy source:
public void testDeferredChecks(){
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_INFERRED_RETURN_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str",TypeCheck.WRONG_ARGUMENT_COUNT);
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_INFERRED_RETURN_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_INFERRED_RETURN_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  checkNoWarnings("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"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",TypeCheck.WRONG_ARGUMENT_COUNT);
}

Fixed version (ground truth):
public void testDeferredChecks(){
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_INFERRED_RETURN_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str",TypeCheck.WRONG_ARGUMENT_COUNT);
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_INFERRED_RETURN_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_INFERRED_RETURN_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  checkNoWarnings("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"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",TypeCheck.WRONG_ARGUMENT_COUNT);
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 27728
Project: 27728
Buggy source:
public void testParserWithTypeTransformationNewline(){
  parse("String_Node_Str");
}

Fixed version (ground truth):
public void testParserWithTypeTransformationNewline(){
  parse("String_Node_Str","String_Node_Str");
}
Program: 27729
Project: 27729
Buggy source:
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.isCall() && !NodeUtil.isExpressionResultUsed(n) && (n.getFirstChild().isName() || n.getFirstChild().isString())) {
    JSType targetType=n.getFirstChild().getJSType();
    if (targetType != null && targetType.isFunctionType()) {
      targetType=targetType.restrictByNotNullOrUndefined();
      FunctionType functionType=targetType.toMaybeFunctionType();
      JSDocInfo functionJSDocInfo=functionType.getJSDocInfo();
      if (functionJSDocInfo != null && functionJSDocInfo.isNoSideEffects() && functionJSDocInfo.getAssociatedNode() != null && functionJSDocInfo.getAssociatedNode().isFromExterns()) {
        t.getCompiler().report(t.makeError(n,level,USELESS_CODE_ERROR,n.getFirstChild().getString()));
        problemNodes.add(n);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void visit(NodeTraversal t,Node n,Node parent){
  if (n.isCall() && !NodeUtil.isExpressionResultUsed(n) && (n.getFirstChild().isName() || n.getFirstChild().isString() || n.getFirstChild().isGetProp())) {
    JSType targetType=n.getFirstChild().getJSType();
    if (targetType != null && targetType.isFunctionType()) {
      targetType=targetType.restrictByNotNullOrUndefined();
      FunctionType functionType=targetType.toMaybeFunctionType();
      JSDocInfo functionJSDocInfo=functionType.getJSDocInfo();
      if (functionJSDocInfo != null && functionJSDocInfo.isNoSideEffects() && functionJSDocInfo.getAssociatedNode() != null && functionJSDocInfo.getAssociatedNode().isFromExterns()) {
        t.getCompiler().report(t.makeError(n,level,USELESS_CODE_ERROR,n.getFirstChild().getQualifiedName()));
        problemNodes.add(n);
      }
    }
  }
}
Program: 27730
Project: 27730
Buggy source:
public void testUselessCode(){
  String externs="String_Node_Str" + "String_Node_Str";
  test(externs,"String_Node_Str","String_Node_Str",ok,null);
  test(externs,"String_Node_Str","String_Node_Str",null,e,"String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
public void testUselessCode(){
  String externs="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  test(externs,"String_Node_Str","String_Node_Str",ok,null);
  test(externs,"String_Node_Str","String_Node_Str",null,e,"String_Node_Str" + "String_Node_Str");
  test(externs,"String_Node_Str","String_Node_Str",ok,null);
  test(externs,"String_Node_Str","String_Node_Str",null,e,"String_Node_Str" + "String_Node_Str");
}
Program: 27732
Project: 27732
Buggy source:
private Token scanPostZero(int beginToken){
switch (peekChar()) {
case 'b':
case 'B':
    nextChar();
  if (!isBinaryDigit(peekChar())) {
    reportError("String_Node_Str");
  }
skipBinaryDigits();
return new LiteralToken(TokenType.NUMBER,getTokenString(beginToken),getTokenRange(beginToken));
case 'o':
case 'O':
nextChar();
if (!isOctalDigit(peekChar())) {
reportError("String_Node_Str");
}
skipOctalDigits();
return new LiteralToken(TokenType.NUMBER,getTokenString(beginToken),getTokenRange(beginToken));
case 'x':
case 'X':
nextChar();
if (!isHexDigit(peekChar())) {
reportError("String_Node_Str");
}
skipHexDigits();
return new LiteralToken(TokenType.NUMBER,getTokenString(beginToken),getTokenRange(beginToken));
case '.':
return scanFractionalNumericLiteral(beginToken);
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
return scanPostDigit(beginToken);
default :
return new LiteralToken(TokenType.NUMBER,getTokenString(beginToken),getTokenRange(beginToken));
}
}

Fixed version (ground truth):
private Token scanPostZero(int beginToken){
switch (peekChar()) {
case 'b':
case 'B':
    nextChar();
  if (!isBinaryDigit(peekChar())) {
    reportError("String_Node_Str");
  }
skipBinaryDigits();
return new LiteralToken(TokenType.NUMBER,getTokenString(beginToken),getTokenRange(beginToken));
case 'o':
case 'O':
nextChar();
if (!isOctalDigit(peekChar())) {
reportError("String_Node_Str");
}
skipOctalDigits();
return new LiteralToken(TokenType.NUMBER,getTokenString(beginToken),getTokenRange(beginToken));
case 'x':
case 'X':
nextChar();
if (!isHexDigit(peekChar())) {
reportError("String_Node_Str");
}
skipHexDigits();
return new LiteralToken(TokenType.NUMBER,getTokenString(beginToken),getTokenRange(beginToken));
case 'e':
case 'E':
return scanExponentOfNumericLiteral(beginToken);
case '.':
return scanFractionalNumericLiteral(beginToken);
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
skipDecimalDigits();
if (peek('.')) {
nextChar();
skipDecimalDigits();
}
return new LiteralToken(TokenType.NUMBER,getTokenString(beginToken),getTokenRange(beginToken));
default :
return new LiteralToken(TokenType.NUMBER,getTokenString(beginToken),getTokenRange(beginToken));
}
}
Program: 27733
Project: 27733
Buggy source:
private static boolean collectObjectProperty(Node objectLiteral,Node propertyCandidate){
  Node assignment=propertyCandidate.getFirstChild();
  Node lhs=assignment.getFirstChild(), rhs=lhs.getNext();
  Node obj=lhs.getFirstChild();
  Node property=obj.getNext();
  if (lhs.isGetElem() && (!property.isString() && !property.isNumber())) {
    return false;
  }
  String propertyName;
  if (property.isNumber()) {
    propertyName=NodeUtil.getStringValue(property);
  }
 else {
    propertyName=property.getString();
  }
  Node newProperty=IR.stringKey(propertyName).copyInformationFrom(property);
  if (lhs.isGetElem()) {
    newProperty.setQuotedString();
  }
  Node newValue=rhs.detachFromParent();
  newProperty.addChildToBack(newValue);
  objectLiteral.addChildToBack(newProperty);
  propertyCandidate.detachFromParent();
  return true;
}

Fixed version (ground truth):
private static boolean collectObjectProperty(Node objectLiteral,Node propertyCandidate){
  Node assignment=propertyCandidate.getFirstChild();
  Node lhs=assignment.getFirstChild(), rhs=lhs.getNext();
  Node obj=lhs.getFirstChild();
  Node property=obj.getNext();
  if (lhs.isGetElem() && (!property.isString() && !property.isNumber())) {
    return false;
  }
  String propertyName;
  if (property.isNumber()) {
    propertyName=NodeUtil.getStringValue(property);
  }
 else {
    propertyName=property.getString();
  }
  Node newProperty=IR.stringKey(propertyName).copyInformationFrom(property);
  if (lhs.isGetElem()) {
    newProperty.setQuotedString();
  }
  Node newValue=rhs.detachFromParent();
  newProperty.addChildToBack(newValue);
  boolean propertyExists=false;
  for (  Node currentProperty : objectLiteral.children()) {
    String currentPropertyName=currentProperty.getString();
    Node currentValue=currentProperty.getFirstChild();
    if (currentPropertyName.equals(propertyName)) {
      propertyExists=true;
      boolean isCurrentValueSideEffect=NodeUtil.canBeSideEffected(currentValue);
      boolean isNewValueSideEffect=NodeUtil.canBeSideEffected(newValue);
      if (!isCurrentValueSideEffect && !isNewValueSideEffect) {
        objectLiteral.removeChild(currentProperty);
        objectLiteral.addChildToBack(newProperty);
        propertyCandidate.detachFromParent();
        return true;
      }
      break;
    }
  }
  if (!propertyExists) {
    objectLiteral.addChildToBack(newProperty);
  }
  propertyCandidate.detachFromParent();
  return true;
}
Program: 27734
Project: 27734
Buggy source:
private ParseTree parseComputedProperty(){
  SourcePosition start=getTreeStartLocation();
  eat(TokenType.OPEN_SQUARE);
  ParseTree assign=parseAssignmentExpression();
  eat(TokenType.CLOSE_SQUARE);
  eat(TokenType.COLON);
  ParseTree value=parseExpression();
  return new ComputedPropertyAssignmentTree(getTreeLocation(start),assign,value);
}

Fixed version (ground truth):
private ParseTree parseComputedProperty(){
  SourcePosition start=getTreeStartLocation();
  eat(TokenType.OPEN_SQUARE);
  ParseTree assign=parseAssignmentExpression();
  eat(TokenType.CLOSE_SQUARE);
  eat(TokenType.COLON);
  ParseTree value=parseAssignmentExpression();
  return new ComputedPropertyAssignmentTree(getTreeLocation(start),assign,value);
}
Program: 27735
Project: 27735
Buggy source:
static boolean areSubtypes(JSType t1,JSType t2){
  ImmutableSet<EnumType> s1=t1.getEnums();
  if (s1 == null) {
    return true;
  }
  ImmutableSet<EnumType> s2=t2.getEnums();
  for (  EnumType e : s1) {
    if (s2 != null && s2.contains(e)) {
      continue;
    }
    if (!e.getEnumeratedType().isSubtypeOf(t2)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
static boolean areSubtypes(JSType t1,JSType t2){
  ImmutableSet<EnumType> s1=t1.getEnums();
  if (s1 == null) {
    return true;
  }
  ImmutableSet<EnumType> s2=t2.getEnums();
  for (  EnumType e : s1) {
    if (s2 != null && s2.contains(e)) {
      continue;
    }
    if (!e.declaredType.isSubtypeOf(t2)) {
      return false;
    }
  }
  return true;
}
Program: 27736
Project: 27736
Buggy source:
static ImmutableSet<EnumType> normalizeForJoin(ImmutableSet<EnumType> newEnums,JSType joinWithoutEnums){
  boolean recreateEnums=false;
  for (  EnumType e : newEnums) {
    if (e.getEnumeratedType().isSubtypeOf(joinWithoutEnums)) {
      recreateEnums=true;
      break;
    }
  }
  if (!recreateEnums) {
    return newEnums;
  }
  ImmutableSet.Builder<EnumType> builder=ImmutableSet.builder();
  for (  EnumType e : newEnums) {
    if (!e.getEnumeratedType().isSubtypeOf(joinWithoutEnums)) {
      builder.add(e);
    }
  }
  return builder.build();
}

Fixed version (ground truth):
static ImmutableSet<EnumType> normalizeForJoin(ImmutableSet<EnumType> newEnums,JSType joinWithoutEnums){
  boolean recreateEnums=false;
  for (  EnumType e : newEnums) {
    if (e.declaredType.isSubtypeOf(joinWithoutEnums)) {
      recreateEnums=true;
      break;
    }
  }
  if (!recreateEnums) {
    return newEnums;
  }
  ImmutableSet.Builder<EnumType> builder=ImmutableSet.builder();
  for (  EnumType e : newEnums) {
    if (!e.declaredType.isSubtypeOf(joinWithoutEnums)) {
      builder.add(e);
    }
  }
  return builder.build();
}
Program: 27737
Project: 27737
Buggy source:
/** 
 * Turns the class-less object of this type (if any) into a loose object 
 */
public JSType withLoose(){
  Preconditions.checkNotNull(this.objs);
  return new JSType(this.mask,this.location,ObjectType.withLooseObjects(this.objs),typeVar,enums);
}

Fixed version (ground truth):
/** 
 * Turns the class-less object of this type (if any) into a loose object 
 */
public JSType withLoose(){
  if (objs == null) {
    Preconditions.checkState(enums != null);
    return this;
  }
  return new JSType(this.mask,this.location,ObjectType.withLooseObjects(this.objs),typeVar,enums);
}
Program: 27738
Project: 27738
Buggy source:
public JSType removeType(JSType other){
  if (isUnknown()) {
    return this;
  }
  int otherMask=other.mask;
  if (isTop()) {
    if ((otherMask & NON_SCALAR_MASK) == 0 && (otherMask & TYPEVAR_MASK) == 0 && (otherMask & ENUM_MASK) == 0) {
      return ALMOST_TOP.removeType(other);
    }
    return this;
  }
  if ((otherMask & NON_SCALAR_MASK) == 0 && (otherMask & TYPEVAR_MASK) == 0 && (otherMask & ENUM_MASK) == 0) {
    return new JSType(mask & ~otherMask,location,objs,typeVar,enums);
  }
  if (objs == null || (otherMask & ~NON_SCALAR_MASK) != 0) {
    return this;
  }
  Preconditions.checkState(otherMask == NON_SCALAR_MASK && other.objs.size() == 1,"String_Node_Str" + other);
  NominalType otherKlass=Iterables.getOnlyElement(other.objs).getNominalType();
  ImmutableSet.Builder<ObjectType> newObjs=ImmutableSet.builder();
  for (  ObjectType obj : objs) {
    if (!Objects.equal(obj.getNominalType(),otherKlass)) {
      newObjs.add(obj);
    }
  }
  return new JSType(mask,location,newObjs.build(),typeVar,enums);
}

Fixed version (ground truth):
public JSType removeType(JSType other){
  int otherMask=other.mask;
  Preconditions.checkState(!other.isTop() && !other.isUnknown() && (otherMask & TYPEVAR_MASK) == 0 && (otherMask & ENUM_MASK) == 0);
  if (isUnknown()) {
    return this;
  }
  if (isTop()) {
    return ALMOST_TOP.removeType(other);
  }
  int newMask=mask & ~otherMask;
  if ((otherMask & NON_SCALAR_MASK) == 0) {
    return new JSType(newMask,location,objs,typeVar,enums);
  }
  Preconditions.checkState(other.objs.size() == 1,"String_Node_Str",other);
  ObjectType otherObj=Iterables.getOnlyElement(other.objs);
  ImmutableSet<ObjectType> newObjs=null;
  ImmutableSet<EnumType> newEnums=null;
  if (objs != null) {
    ImmutableSet.Builder<ObjectType> builder=ImmutableSet.builder();
    for (    ObjectType obj : objs) {
      if (!obj.isSubtypeOf(otherObj)) {
        builder.add(obj);
      }
    }
    newObjs=builder.build();
  }
  if (enums != null) {
    ImmutableSet.Builder<EnumType> builder=ImmutableSet.builder();
    for (    EnumType e : enums) {
      if (!e.getEnumeratedType().isSubtypeOf(other)) {
        builder.add(e);
      }
    }
    newEnums=builder.build();
  }
  return new JSType(newMask,location,newObjs,typeVar,newEnums);
}
Program: 27739
Project: 27739
Buggy source:
public boolean hasNonScalar(){
  return objs != null;
}

Fixed version (ground truth):
public boolean hasNonScalar(){
  return objs != null || EnumType.hasNonScalar(enums);
}
Program: 27740
Project: 27740
Buggy source:
public void testInstanceof(){
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck("String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck("String_Node_Str",VarCheck.UNDEFINED_VAR_ERROR);
  typeCheck("String_Node_Str" + "String_Node_Str",ImmutableList.of(NewTypeInference.INVALID_OPERAND_TYPE,NewTypeInference.PROPERTY_ACCESS_ON_NONOBJECT));
}

Fixed version (ground truth):
public void testInstanceof(){
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck("String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_ARGUMENT_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck("String_Node_Str",VarCheck.UNDEFINED_VAR_ERROR);
  typeCheck("String_Node_Str" + "String_Node_Str",ImmutableList.of(NewTypeInference.INVALID_OPERAND_TYPE,NewTypeInference.PROPERTY_ACCESS_ON_NONOBJECT));
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  checkNoWarnings("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");
}
Program: 27741
Project: 27741
Buggy source:
public void testEnumsWithNonScalarDeclaredType(){
  typeCheck("String_Node_Str" + "String_Node_Str",TypeCheck.INEXISTENT_PROPERTY);
  checkNoWarnings("String_Node_Str" + "String_Node_Str");
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.CONST_REASSIGNED);
}

Fixed version (ground truth):
public void testEnumsWithNonScalarDeclaredType(){
  typeCheck("String_Node_Str" + "String_Node_Str",TypeCheck.INEXISTENT_PROPERTY);
  checkNoWarnings("String_Node_Str" + "String_Node_Str");
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.INVALID_OPERAND_TYPE);
  typeCheck("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",NewTypeInference.CONST_REASSIGNED);
  checkNoWarnings("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 27743
Project: 27743
Buggy source:
public JSType negate(){
  if (isTop() || isUnknown()) {
    return this;
  }
  if (isTruthy()) {
    return FALSY;
  }
 else   if (isFalsy()) {
    return TRUTHY;
  }
 else   if (objs == null && typeVar == null) {
    return new JSType(TOP_SCALAR_MASK & ~mask);
  }
  return UNKNOWN;
}

Fixed version (ground truth):
public JSType negate(){
  if (isTop() || isUnknown()) {
    return this;
  }
  if (isTruthy()) {
    return FALSY;
  }
 else   if (isFalsy()) {
    return TRUTHY;
  }
  return UNKNOWN.removeType(this);
}
Program: 27745
Project: 27745
Buggy source:
private EnvTypePair analyzeSpecializedTypeof(Node typeof,Node typeString,int comparisonOp,TypeEnv inEnv,JSType specializedType){
  EnvTypePair pair;
  Node typeofRand=typeof.getFirstChild();
  JSType comparedType=getTypeFromString(typeString);
  checkInvalidTypename(typeString);
  if (comparedType.isUnknown()) {
    pair=analyzeExprFwd(typeofRand,inEnv);
    pair=analyzeExprFwd(typeString,pair.env);
  }
 else   if ((specializedType.isTruthy() && (comparisonOp == Token.SHEQ || comparisonOp == Token.EQ)) || (specializedType.isFalsy() && (comparisonOp == Token.SHNE || comparisonOp == Token.NE))) {
    pair=analyzeExprFwd(typeofRand,inEnv,JSType.UNKNOWN,comparedType);
  }
 else {
    pair=analyzeExprFwd(typeofRand,inEnv,JSType.UNKNOWN,comparedType.negate());
  }
  pair.type=specializedType.toBoolean();
  return pair;
}

Fixed version (ground truth):
private EnvTypePair analyzeSpecializedTypeof(Node typeof,Node typeString,int comparisonOp,TypeEnv inEnv,JSType specializedType){
  EnvTypePair pair;
  Node typeofRand=typeof.getFirstChild();
  JSType comparedType=getTypeFromString(typeString);
  checkInvalidTypename(typeString);
  if (comparedType.isUnknown()) {
    pair=analyzeExprFwd(typeofRand,inEnv);
    pair=analyzeExprFwd(typeString,pair.env);
  }
 else   if ((specializedType.isTruthy() && (comparisonOp == Token.SHEQ || comparisonOp == Token.EQ)) || (specializedType.isFalsy() && (comparisonOp == Token.SHNE || comparisonOp == Token.NE))) {
    pair=analyzeExprFwd(typeofRand,inEnv,JSType.UNKNOWN,comparedType);
  }
 else {
    pair=analyzeExprFwd(typeofRand,inEnv);
    pair=analyzeExprFwd(typeofRand,inEnv,JSType.UNKNOWN,pair.type.removeType(comparedType));
  }
  pair.type=specializedType.toBoolean();
  return pair;
}
Program: 27747
Project: 27747
Buggy source:
private EnvTypePair analyzeCallNodeArgumentsFwd(Node callNode,TypeEnv inEnv){
  TypeEnv env=inEnv;
  for (Node arg=callNode.getFirstChild(); arg != null; arg=arg.getNext()) {
    env=analyzeExprFwd(arg,env).env;
  }
  return new EnvTypePair(env,JSType.UNKNOWN);
}

Fixed version (ground truth):
private EnvTypePair analyzeCallNodeArgumentsFwd(Node callNode,TypeEnv inEnv){
  TypeEnv env=inEnv;
  for (Node arg=callNode.getFirstChild().getNext(); arg != null; arg=arg.getNext()) {
    env=analyzeExprFwd(arg,env).env;
  }
  return new EnvTypePair(env,JSType.UNKNOWN);
}
Program: 27748
Project: 27748
Buggy source:
public JSType removeType(JSType other){
  if ((isTop() || isUnknown()) && other.equals(NULL)) {
    return TOP_MINUS_NULL;
  }
  if ((isTop() || isUnknown()) && other.equals(UNDEFINED)) {
    return TOP_MINUS_UNDEF;
  }
  if (other.equals(NULL) || other.equals(UNDEFINED)) {
    return new JSType(mask & ~other.mask,location,objs,typeVar,enums);
  }
  if (objs == null) {
    return this;
  }
  Preconditions.checkState((other.mask & ~NON_SCALAR_MASK) == 0 && other.objs.size() == 1);
  NominalType otherKlass=Iterables.getOnlyElement(other.objs).getNominalType();
  ImmutableSet.Builder<ObjectType> newObjs=ImmutableSet.builder();
  for (  ObjectType obj : objs) {
    if (!Objects.equal(obj.getNominalType(),otherKlass)) {
      newObjs.add(obj);
    }
  }
  return new JSType(mask,location,newObjs.build(),typeVar,enums);
}

Fixed version (ground truth):
public JSType removeType(JSType other){
  if (isUnknown()) {
    return this;
  }
  int otherMask=other.mask;
  if (isTop()) {
    if ((otherMask & NON_SCALAR_MASK) == 0 && (otherMask & TYPEVAR_MASK) == 0 && (otherMask & ENUM_MASK) == 0) {
      return ALMOST_TOP.removeType(other);
    }
    return this;
  }
  if ((otherMask & NON_SCALAR_MASK) == 0 && (otherMask & TYPEVAR_MASK) == 0 && (otherMask & ENUM_MASK) == 0) {
    return new JSType(mask & ~otherMask,location,objs,typeVar,enums);
  }
  if (objs == null || (otherMask & ~NON_SCALAR_MASK) != 0) {
    return this;
  }
  Preconditions.checkState(otherMask == NON_SCALAR_MASK && other.objs.size() == 1,"String_Node_Str" + other);
  NominalType otherKlass=Iterables.getOnlyElement(other.objs).getNominalType();
  ImmutableSet.Builder<ObjectType> newObjs=ImmutableSet.builder();
  for (  ObjectType obj : objs) {
    if (!Objects.equal(obj.getNominalType(),otherKlass)) {
      newObjs.add(obj);
    }
  }
  return new JSType(mask,location,newObjs.build(),typeVar,enums);
}
Program: 27749
Project: 27749
Buggy source:
public JSType negate(){
  if (isTop() || isUnknown()) {
    return this;
  }
  if (isTruthy()) {
    return FALSY;
  }
 else   if (isFalsy()) {
    return TRUTHY;
  }
  return UNKNOWN.removeType(this);
}

Fixed version (ground truth):
public JSType negate(){
  if (isTop() || isUnknown()) {
    return this;
  }
  if (isTruthy()) {
    return FALSY;
  }
 else   if (isFalsy()) {
    return TRUTHY;
  }
  return UNKNOWN;
}