nus-yam/ex-repair huggingface dataset:
Program: 29468
Project: 29468
Buggy source:
void resetAttribute(){
  attributeName=null;
  equalsSignLocation=null;
  attributeValue=null;
}

Fixed version (ground truth):
void resetAttribute(){
  attributeName=null;
  equalsSignLocation=null;
  attributeValue=null;
  quotedAttributeValueStart=null;
  attributeValueChildren.clear();
}
Program: 29469
Project: 29469
Buggy source:
/** 
 * Completes an unquoted attribute value. 
 */
void createUnquotedAttributeValue(SourceLocation.Point endPoint){
  if (!hasUnquotedAttributeValueParts()) {
    if (attributeName != null) {
      errorReporter.report(endPoint.asLocation(filePath),EXPECTED_ATTRIBUTE_VALUE);
    }
 else {
      errorReporter.report(endPoint.asLocation(filePath),FOUND_END_OF_ATTRIBUTE_STARTED_IN_ANOTHER_BLOCK);
    }
    resetAttribute();
    setState(State.AFTER_TAG_NAME_OR_ATTRIBUTE,endPoint);
    return;
  }
  HtmlAttributeValueNode valueNode=new HtmlAttributeValueNode(nodeIdGen.genId(),getLocationOf(attributeValueChildren),Quotes.NONE);
  edits.addChildren(valueNode,attributeValueChildren);
  attributeValueChildren.clear();
  setAttributeValue(valueNode);
}

Fixed version (ground truth):
/** 
 * Completes an unquoted attribute value. 
 */
void createUnquotedAttributeValue(SourceLocation.Point endPoint){
  if (!hasUnquotedAttributeValueParts()) {
    if (attributeName != null) {
      errorReporter.report(endPoint.asLocation(filePath),EXPECTED_ATTRIBUTE_VALUE);
    }
 else {
      errorReporter.report(endPoint.asLocation(filePath),FOUND_END_OF_ATTRIBUTE_STARTED_IN_ANOTHER_BLOCK);
      throw new AbortParsingBlockError();
    }
    resetAttribute();
    setState(State.AFTER_TAG_NAME_OR_ATTRIBUTE,endPoint);
    return;
  }
  HtmlAttributeValueNode valueNode=new HtmlAttributeValueNode(nodeIdGen.genId(),getLocationOf(attributeValueChildren),Quotes.NONE);
  edits.addChildren(valueNode,attributeValueChildren);
  attributeValueChildren.clear();
  setAttributeValue(valueNode);
}
Program: 29471
Project: 29471
Buggy source:
/** 
 * Generate bytecode that coerces the top of stack to the correct type for the given field. 
 */
private static void coerce(CodeBuilder cb,Type currentType,FieldDescriptor field){
switch (field.getJavaType()) {
case BOOLEAN:
case DOUBLE:
case STRING:
    return;
case FLOAT:
  if (!currentType.equals(Type.FLOAT_TYPE)) {
    cb.cast(currentType,Type.FLOAT_TYPE);
  }
return;
case INT:
if (!currentType.equals(Type.INT_TYPE)) {
cb.cast(currentType,Type.INT_TYPE);
}
return;
case LONG:
if (shouldConvertBetweenStringAndLong(field)) {
MethodRef.LONG_PARSE_LONG.invokeUnchecked(cb);
}
return;
case BYTE_STRING:
BASE_ENCODING_BASE_64.invokeUnchecked(cb);
cb.swap();
BASE_ENCODING_DECODE.invokeUnchecked(cb);
BYTE_STRING_COPY_FROM.invokeUnchecked(cb);
return;
case MESSAGE:
coerceToMessage(cb,field);
return;
case ENUM:
if (!currentType.equals(Type.INT_TYPE)) {
cb.cast(currentType,Type.INT_TYPE);
}
if (!isProto3EnumField(field)) {
getForNumberMethod(field.getEnumType()).invokeUnchecked(cb);
}
return;
default :
throw new AssertionError("String_Node_Str" + field);
}
}

Fixed version (ground truth):
/** 
 * Generate bytecode that coerces the top of stack to the correct type for the given field setter.
 */
private static void coerce(CodeBuilder cb,Type currentType,FieldDescriptor field){
switch (field.getJavaType()) {
case BOOLEAN:
case DOUBLE:
case STRING:
    break;
case FLOAT:
  if (!currentType.equals(Type.FLOAT_TYPE)) {
    cb.cast(currentType,Type.FLOAT_TYPE);
  }
break;
case INT:
if (!currentType.equals(Type.INT_TYPE)) {
cb.cast(currentType,Type.INT_TYPE);
}
break;
case LONG:
if (shouldConvertBetweenStringAndLong(field)) {
MethodRef.LONG_PARSE_LONG.invokeUnchecked(cb);
}
break;
case BYTE_STRING:
BASE_ENCODING_BASE_64.invokeUnchecked(cb);
cb.swap();
BASE_ENCODING_DECODE.invokeUnchecked(cb);
BYTE_STRING_COPY_FROM.invokeUnchecked(cb);
break;
case MESSAGE:
coerceToMessage(cb,field);
break;
case ENUM:
if (!currentType.equals(Type.INT_TYPE)) {
cb.cast(currentType,Type.INT_TYPE);
}
if (!isProto3EnumField(field)) {
getForNumberMethod(field.getEnumType()).invokeUnchecked(cb);
}
return;
default :
throw new AssertionError("String_Node_Str" + field);
}
if (field.isExtension()) {
Type fieldType=getRuntimeType(field);
if (isPrimitive(fieldType)) {
cb.valueOf(fieldType);
}
}
}
Program: 29472
Project: 29472
Buggy source:
/** 
 * Returns a Statement that handles a single proto builder setFoo() call. <p>The Statement assumes that just before .gen(), there is an instance of the proto builder at the top of the stack. After .gen() it is guaranteed to leave an instance of the builder at the top of the stack, without changing stack heights.
 */
private Statement handleNormalSetter(final SoyExpression baseArg,final FieldDescriptor field){
  final MethodRef setterMethod=getSetOrAddMethod(field);
  if (baseArg.isNonNullable()) {
    final Expression arg=shouldUnbox(field) ? baseArg.unboxAs(classToUnboxTo(field)) : baseArg;
    return new Statement(){
      @Override void doGen(      CodeBuilder cb){
        arg.gen(cb);
        coerce(cb,arg.resultType(),field);
        setterMethod.invokeUnchecked(cb);
      }
    }
;
  }
  return new Statement(){
    @Override void doGen(    CodeBuilder cb){
      baseArg.gen(cb);
      Label argIsNull=new Label();
      Label end=new Label();
      cb.dup();
      cb.ifNull(argIsNull);
      Type currentType;
      if (shouldUnbox(field)) {
        currentType=unboxUnchecked(cb,baseArg.soyRuntimeType().runtimeType(),classToUnboxTo(field));
      }
 else {
        currentType=SANITIZED_CONTENT_TYPE;
      }
      coerce(cb,currentType,field);
      setterMethod.invokeUnchecked(cb);
      cb.goTo(end);
      cb.mark(argIsNull);
      cb.pop();
      cb.mark(end);
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Returns a Statement that handles a single proto builder setFoo() call. <p>The Statement assumes that just before .gen(), there is an instance of the proto builder at the top of the stack. After .gen() it is guaranteed to leave an instance of the builder at the top of the stack, without changing stack heights.
 */
private Statement handleNormalSetter(final SoyExpression baseArg,final FieldDescriptor field){
  final MethodRef setterMethod=getSetOrAddMethod(field);
  final boolean isNullable=!baseArg.isNonNullable();
  return new Statement(){
    @Override void doGen(    CodeBuilder cb){
      baseArg.gen(cb);
      Label argIsNull=null;
      Label end=null;
      if (isNullable) {
        argIsNull=new Label();
        end=new Label();
        cb.dup();
        cb.ifNull(argIsNull);
      }
      unboxAndCoerce(cb,baseArg,field);
      setterMethod.invokeUnchecked(cb);
      if (isNullable) {
        cb.goTo(end);
        cb.mark(argIsNull);
        cb.pop();
        cb.mark(end);
      }
    }
  }
;
}
Program: 29473
Project: 29473
Buggy source:
@Override void doGen(CodeBuilder cb){
  cb.checkCast(EXTENDABLE_BUILDER_TYPE);
  baseArg.gen(cb);
  Label argIsNull=new Label();
  Label end=new Label();
  cb.dup();
  cb.ifNull(argIsNull);
  Type currentType;
  if (shouldUnbox(field)) {
    currentType=unboxUnchecked(cb,baseArg.soyRuntimeType().runtimeType(),classToUnboxTo(field));
  }
 else {
    currentType=SANITIZED_CONTENT_TYPE;
  }
  coerce(cb,currentType,field);
  Type fieldType=getRuntimeType(field);
  if (isPrimitive(fieldType)) {
    cb.valueOf(fieldType);
  }
  extensionIdentifier.gen(cb);
  cb.swap();
  setterMethod.invokeUnchecked(cb);
  cb.goTo(end);
  cb.mark(argIsNull);
  cb.pop();
  cb.mark(end);
  cb.checkCast(builderRuntimeType(descriptor).type());
}

Fixed version (ground truth):
@Override void doGen(CodeBuilder cb){
  cb.checkCast(EXTENDABLE_BUILDER_TYPE);
  baseArg.gen(cb);
  Label argIsNull=null;
  Label end=null;
  if (isNullable) {
    argIsNull=new Label();
    end=new Label();
    cb.dup();
    cb.ifNull(argIsNull);
  }
  unboxAndCoerce(cb,baseArg,field);
  extensionIdentifier.gen(cb);
  cb.swap();
  setterMethod.invokeUnchecked(cb);
  if (isNullable) {
    cb.goTo(end);
    cb.mark(argIsNull);
    cb.pop();
    cb.mark(end);
  }
  cb.checkCast(builderRuntimeType(descriptor).type());
}
Program: 29474
Project: 29474
Buggy source:
private Statement handleExtension(final SoyExpression baseArg,final FieldDescriptor field){
  final Expression extensionIdentifier=getExtensionField(field).accessor();
  final MethodRef setterMethod=field.isRepeated() ? EXTENDABLE_BUILDER_ADD_EXTENSION : EXTENDABLE_BUILDER_SET_EXTENSION;
  if (baseArg.isNonNullable()) {
    final Expression arg=shouldUnbox(field) ? baseArg.unboxAs(classToUnboxTo(field)) : baseArg;
    return new Statement(){
      @Override void doGen(      CodeBuilder cb){
        cb.checkCast(EXTENDABLE_BUILDER_TYPE);
        extensionIdentifier.gen(cb);
        arg.gen(cb);
        coerce(cb,arg.resultType(),field);
        Type fieldType=getRuntimeType(field);
        if (isPrimitive(fieldType)) {
          cb.valueOf(fieldType);
        }
        setterMethod.invokeUnchecked(cb);
        cb.checkCast(builderRuntimeType(descriptor).type());
      }
    }
;
  }
  return new Statement(){
    @Override void doGen(    CodeBuilder cb){
      cb.checkCast(EXTENDABLE_BUILDER_TYPE);
      baseArg.gen(cb);
      Label argIsNull=new Label();
      Label end=new Label();
      cb.dup();
      cb.ifNull(argIsNull);
      Type currentType;
      if (shouldUnbox(field)) {
        currentType=unboxUnchecked(cb,baseArg.soyRuntimeType().runtimeType(),classToUnboxTo(field));
      }
 else {
        currentType=SANITIZED_CONTENT_TYPE;
      }
      coerce(cb,currentType,field);
      Type fieldType=getRuntimeType(field);
      if (isPrimitive(fieldType)) {
        cb.valueOf(fieldType);
      }
      extensionIdentifier.gen(cb);
      cb.swap();
      setterMethod.invokeUnchecked(cb);
      cb.goTo(end);
      cb.mark(argIsNull);
      cb.pop();
      cb.mark(end);
      cb.checkCast(builderRuntimeType(descriptor).type());
    }
  }
;
}

Fixed version (ground truth):
private Statement handleExtension(final SoyExpression baseArg,final FieldDescriptor field){
  final Expression extensionIdentifier=getExtensionField(field).accessor();
  final MethodRef setterMethod=field.isRepeated() ? EXTENDABLE_BUILDER_ADD_EXTENSION : EXTENDABLE_BUILDER_SET_EXTENSION;
  final boolean isNullable=!baseArg.isNonNullable();
  return new Statement(){
    @Override void doGen(    CodeBuilder cb){
      cb.checkCast(EXTENDABLE_BUILDER_TYPE);
      baseArg.gen(cb);
      Label argIsNull=null;
      Label end=null;
      if (isNullable) {
        argIsNull=new Label();
        end=new Label();
        cb.dup();
        cb.ifNull(argIsNull);
      }
      unboxAndCoerce(cb,baseArg,field);
      extensionIdentifier.gen(cb);
      cb.swap();
      setterMethod.invokeUnchecked(cb);
      if (isNullable) {
        cb.goTo(end);
        cb.mark(argIsNull);
        cb.pop();
        cb.mark(end);
      }
      cb.checkCast(builderRuntimeType(descriptor).type());
    }
  }
;
}
Program: 29475
Project: 29475
Buggy source:
@Override public void report(SourceLocation sourceLocation,SoyErrorKind error,Object... args){
  throw new AssertionError(String.format("String_Node_Str",error.format(args),sourceLocation));
}

Fixed version (ground truth):
@Override public void report(SourceLocation sourceLocation,SoyErrorKind error,Object... args){
  checkNotNull(sourceLocation);
  throw new AssertionError(String.format("String_Node_Str",error.format(args),sourceLocation));
}
Program: 29476
Project: 29476
Buggy source:
@Override public void report(SourceLocation sourceLocation,SoyErrorKind error,Object... args){
  errorMessages.add(error.format(args));
}

Fixed version (ground truth):
@Override public void report(SourceLocation sourceLocation,SoyErrorKind error,Object... args){
  checkNotNull(sourceLocation);
  errorMessages.add(error.format(args));
}
Program: 29477
Project: 29477
Buggy source:
@Override public SoyError create(SourceLocation location,SoyErrorKind kind,Object... args){
  String message=kind.format(args);
  return createError(location,kind,message,location + "String_Node_Str" + message);
}

Fixed version (ground truth):
@Override public SoyError create(SourceLocation location,SoyErrorKind kind,Object... args){
  checkNotNull(location);
  String message=kind.format(args);
  return createError(location,kind,message,location + "String_Node_Str" + message);
}
Program: 29478
Project: 29478
Buggy source:
/** 
 * Sets the SoyDoc for the node to be built. The SoyDoc will be parsed to fill in SoyDoc param info.
 * @return This builder.
 */
public TemplateNodeBuilder setSoyDoc(String soyDoc,SourceLocation soyDocLocation){
  Preconditions.checkState(this.soyDoc == null);
  Preconditions.checkState(cmdText != null);
  this.soyDoc=soyDoc;
  Preconditions.checkArgument(soyDoc.startsWith("String_Node_Str") && soyDoc.endsWith("String_Node_Str"));
  String cleanedSoyDoc=cleanSoyDocHelper(soyDoc);
  this.soyDocDesc=parseSoyDocDescHelper(cleanedSoyDoc);
  this.addParams(parseSoyDocDeclsHelper(cleanedSoyDoc,soyDocLocation));
  return this;
}

Fixed version (ground truth):
/** 
 * Sets the SoyDoc for the node to be built. The SoyDoc will be parsed to fill in SoyDoc param info.
 * @return This builder.
 */
public TemplateNodeBuilder setSoyDoc(String soyDoc,SourceLocation soyDocLocation){
  Preconditions.checkState(this.soyDoc == null);
  Preconditions.checkState(cmdText != null);
  this.soyDoc=soyDoc;
  Preconditions.checkArgument(soyDoc.startsWith("String_Node_Str") && soyDoc.endsWith("String_Node_Str"));
  String cleanedSoyDoc=cleanSoyDocHelper(soyDoc);
  this.soyDocDesc=parseSoyDocDescHelper(cleanedSoyDoc);
  this.addParams(parseSoyDocDeclsHelper(soyDoc,cleanedSoyDoc,soyDocLocation));
  return this;
}
Program: 29480
Project: 29480
Buggy source:
/** 
 * Helper for   {@code setSoyDoc()} and {@code setHeaderDecls()}. This method is intended to be called at most once for SoyDoc params and at most once for header params.
 * @param params The params to add.
 */
public TemplateNodeBuilder addParams(Iterable<? extends TemplateParam> params){
  Set<String> seenParamKeys=new HashSet<>();
  if (this.params == null) {
    this.params=ImmutableList.copyOf(params);
  }
 else {
    for (    TemplateParam oldParam : this.params) {
      seenParamKeys.add(oldParam.name());
    }
    this.params=ImmutableList.<TemplateParam>builder().addAll(this.params).addAll(params).build();
  }
  for (  TemplateParam param : params) {
    if (param.name().equals("String_Node_Str")) {
      errorReporter.report(paramSourceLocation(param),INVALID_PARAM_NAMED_IJ);
    }
    if (!seenParamKeys.add(param.name())) {
      errorReporter.report(paramSourceLocation(param),PARAM_ALREADY_DECLARED,param.name());
    }
  }
  return this;
}

Fixed version (ground truth):
/** 
 * Helper for   {@code setSoyDoc()} and {@code setHeaderDecls()}. This method is intended to be called at most once for SoyDoc params and at most once for header params.
 * @param params The params to add.
 */
public TemplateNodeBuilder addParams(Iterable<? extends TemplateParam> params){
  Set<String> seenParamKeys=new HashSet<>();
  if (this.params == null) {
    this.params=ImmutableList.copyOf(params);
  }
 else {
    for (    TemplateParam oldParam : this.params) {
      seenParamKeys.add(oldParam.name());
    }
    this.params=ImmutableList.<TemplateParam>builder().addAll(this.params).addAll(params).build();
  }
  for (  TemplateParam param : params) {
    if (param.name().equals("String_Node_Str")) {
      errorReporter.report(param.nameLocation(),INVALID_PARAM_NAMED_IJ);
    }
    if (!seenParamKeys.add(param.name())) {
      errorReporter.report(param.nameLocation(),PARAM_ALREADY_DECLARED,param.name());
    }
  }
  return this;
}
Program: 29481
Project: 29481
Buggy source:
public HeaderParam(String name,SourceLocation nameLocation,SoyType type,TypeNode typeNode,boolean isRequired,boolean isInjected,@Nullable String desc){
  super(name,type,isRequired,isInjected,desc);
  Preconditions.checkArgument(type != null);
  this.nameLocation=nameLocation;
  this.typeNode=typeNode;
}

Fixed version (ground truth):
public HeaderParam(String name,SourceLocation nameLocation,SoyType type,TypeNode typeNode,boolean isRequired,boolean isInjected,@Nullable String desc){
  super(name,type,isRequired,isInjected,desc,nameLocation);
  Preconditions.checkArgument(type != null);
  this.typeNode=typeNode;
}
Program: 29482
Project: 29482
Buggy source:
@Override public SoyDocParam copyEssential(){
  SoyDocParam soyDocParam=new SoyDocParam(name(),isRequired(),null);
  soyDocParam.setLocalVariableIndex(localVariableIndex());
  return soyDocParam;
}

Fixed version (ground truth):
@Override public SoyDocParam copyEssential(){
  SoyDocParam soyDocParam=new SoyDocParam(name(),isRequired(),null,null);
  soyDocParam.setLocalVariableIndex(localVariableIndex());
  return soyDocParam;
}
Program: 29483
Project: 29483
Buggy source:
TemplateParam(TemplateParam param){
  super(param);
  this.isRequired=param.isRequired;
  this.isInjected=param.isInjected;
  this.desc=param.desc;
}

Fixed version (ground truth):
TemplateParam(TemplateParam param){
  super(param);
  this.isRequired=param.isRequired;
  this.isInjected=param.isInjected;
  this.desc=param.desc;
  this.nameLocation=param.nameLocation;
}
Program: 29484
Project: 29484
Buggy source:
@Override void doFormatOutputExpr(FormattingContext ctx,OutputContext outputContext){
  ctx.append(varName());
}

Fixed version (ground truth):
@Override void doFormatOutputExpr(FormattingContext ctx,OutputContext outputContext){
  if (outputContext != OutputContext.EXPRESSION) {
    return;
  }
  ctx.append(varName());
}
Program: 29485
Project: 29485
Buggy source:
/** 
 * Layer of indirection to check if the output expression should end in a semicolon+newline. Subclasses must call this, and not   {@link #doFormatOutputExpr}.
 * @param outputContext The surrounding context where the expression is inserted.
 */
final void formatOutputExpr(FormattingContext ctx,OutputContext outputContext){
  doFormatOutputExpr(ctx,outputContext);
  if (outputContext == STATEMENT && !(this instanceof Composite) && !(this instanceof GoogRequire && (((GoogRequire)this).underlying() instanceof Composite))) {
    ctx.append(';').endLine();
  }
}

Fixed version (ground truth):
/** 
 * Layer of indirection to check if the output expression should end in a semicolon+newline. Subclasses must call this, and not   {@link #doFormatOutputExpr}.
 * @param outputContext The surrounding context where the expression is inserted.
 */
final void formatOutputExpr(FormattingContext ctx,OutputContext outputContext){
  doFormatOutputExpr(ctx,outputContext);
  if (outputContext == STATEMENT && !(this instanceof Composite) && !(this instanceof Assignment) && !(this instanceof GoogRequire && (((GoogRequire)this).underlying() instanceof Composite || ((GoogRequire)this).underlying() instanceof Assignment))) {
    ctx.append(';').endLine();
  }
}
Program: 29486
Project: 29486
Buggy source:
/** 
 * Example: <pre> {let $boo} Hello {$name} {/let} </pre> might generate <pre> var boo35 = 'Hello ' + opt_data.name; </pre>
 */
@Override protected void visitLetContentNode(LetContentNode node){
  if (node.getChildren().size() == 1 && node.getChild(0) instanceof MsgFallbackGroupNode) {
    String msgVar=getAssistantForMsgs().generateMsgGroupVariable((MsgFallbackGroupNode)node.getChild(0));
    templateTranslationContext.soyToJsVariableMappings().put(node.getVarName(),id(msgVar));
    return;
  }
  String generatedVarName=node.getUniqueVarName();
  jsCodeBuilder.pushOutputVar(generatedVarName);
  visitChildren(node);
  jsCodeBuilder.popOutputVar();
  if (node.getContentKind() != null) {
    final String sanitizedContentOrdainer=NodeContentKinds.toJsSanitizedContentOrdainerForInternalBlocks(node.getContentKind());
    jsCodeBuilder.appendLine(generatedVarName,"String_Node_Str",sanitizedContentOrdainer,"String_Node_Str",generatedVarName,"String_Node_Str");
  }
  templateTranslationContext.soyToJsVariableMappings().put(node.getVarName(),id(generatedVarName));
}

Fixed version (ground truth):
/** 
 * Example: <pre> {let $boo} Hello {$name} {/let} </pre> might generate <pre> var boo35 = 'Hello ' + opt_data.name; </pre>
 */
@Override protected void visitLetContentNode(LetContentNode node){
  if (node.getChildren().size() == 1 && node.getChild(0) instanceof MsgFallbackGroupNode) {
    String msgVar=getAssistantForMsgs().generateMsgGroupVariable((MsgFallbackGroupNode)node.getChild(0));
    templateTranslationContext.soyToJsVariableMappings().put(node.getVarName(),id(msgVar));
    return;
  }
  String generatedVarName=node.getUniqueVarName();
  CodeChunk.WithValue generatedVar=id(generatedVarName);
  jsCodeBuilder.pushOutputVar(generatedVarName);
  visitChildren(node);
  jsCodeBuilder.popOutputVar();
  if (node.getContentKind() != null) {
    jsCodeBuilder.append(assign(generatedVarName,sanitizedContentOrdainerFunctionForInternalBlocks(node.getContentKind()).call(generatedVar)));
  }
  templateTranslationContext.soyToJsVariableMappings().put(node.getVarName(),generatedVar);
}
Program: 29488
Project: 29488
Buggy source:
@Test public void testDelTemplate(){
  String testFileContent="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  TemplateNode template=(TemplateNode)SharedTestUtils.getNode(SoyFileSetParserBuilder.forFileContents(testFileContent).parse().fileSet());
  String expectedJsCode="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";
  genJsCodeVisitor.jsCodeBuilder=new JsCodeBuilder();
  genJsCodeVisitor.visitForTesting(template,ExplodingErrorReporter.get());
  assertThat(genJsCodeVisitor.jsCodeBuilder.getCode()).isEqualTo(expectedJsCode);
}

Fixed version (ground truth):
@Test public void testDelTemplate(){
  String testFileContent="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  ParseResult parseResult=SoyFileSetParserBuilder.forFileContents(testFileContent).parse();
  String expectedJsCode="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";
  genJsCodeVisitor.jsSrcOptions.setShouldProvideRequireSoyNamespaces(true);
  String file=genJsCodeVisitor.gen(parseResult.fileSet(),parseResult.registry(),ExplodingErrorReporter.get()).get(0);
  assertThat(file).endsWith(expectedJsCode);
}
Program: 29489
Project: 29489
Buggy source:
public void testIsEqualto(){
  SoyListData sld0=new SoyListData();
  SoyListData sld1=new SoyListData("String_Node_Str");
  assertTrue(sld0.equals(sld0));
  assertTrue(sld1.equals(sld1));
  assertFalse(sld0.equals(sld1));
  assertFalse(sld0.equals(new SoyListData()));
}

Fixed version (ground truth):
public void testIsEqualto(){
  SoyListData sld0=new SoyListData();
  SoyListData sld1=new SoyListData("String_Node_Str");
  new EqualsTester().addEqualityGroup(sld0).addEqualityGroup(sld1).testEquals();
  assertFalse(sld0.equals(new SoyListData()));
}
Program: 29490
Project: 29490
Buggy source:
public void testIsEqualto(){
  SoyMapData smd0=new SoyMapData();
  SoyMapData smd1=new SoyMapData("String_Node_Str","String_Node_Str");
  assertTrue(smd0.equals(smd0));
  assertTrue(smd1.equals(smd1));
  assertFalse(smd0.equals(smd1));
  assertFalse(smd0.equals(new SoyMapData()));
}

Fixed version (ground truth):
public void testIsEqualto(){
  SoyMapData smd0=new SoyMapData();
  SoyMapData smd1=new SoyMapData("String_Node_Str","String_Node_Str");
  new EqualsTester().addEqualityGroup(smd0).addEqualityGroup(smd1).testEquals();
  assertFalse(smd0.equals(new SoyMapData()));
}
Program: 29491
Project: 29491
Buggy source:
/** 
 * Given a collection type, compute the element type.
 * @param collectionType The base type.
 * @param owningNode The current error context, in other words the SoyNode owning theexpression being scanned.
 * @return The type of the elements of the collection.
 */
private SoyType getElementType(SoyType collectionType,ExprHolderNode owningNode){
  Preconditions.checkNotNull(collectionType);
switch (collectionType.getKind()) {
case UNKNOWN:
    return UnknownType.getInstance();
case LIST:
  return ((ListType)collectionType).getElementType();
case UNION:
{
  UnionType unionType=(UnionType)collectionType;
  List<SoyType> fieldTypes=new ArrayList<>(unionType.getMembers().size());
  for (  SoyType unionMember : unionType.getMembers()) {
    fieldTypes.add(getElementType(unionMember,owningNode));
  }
  return typeOps.computeLowestCommonType(fieldTypes);
}
default :
throw new AssertionError("String_Node_Str" + collectionType);
}
}

Fixed version (ground truth):
/** 
 * Given a collection type, compute the element type.
 * @param collectionType The base type.
 * @param node The ForeachNonemptyNode being iterated.
 * @return The type of the elements of the collection.
 */
private SoyType getElementType(SoyType collectionType,ForeachNonemptyNode node){
  Preconditions.checkNotNull(collectionType);
switch (collectionType.getKind()) {
case UNKNOWN:
    return UnknownType.getInstance();
case LIST:
  return ((ListType)collectionType).getElementType();
case UNION:
{
  UnionType unionType=(UnionType)collectionType;
  List<SoyType> fieldTypes=new ArrayList<>(unionType.getMembers().size());
  for (  SoyType unionMember : unionType.getMembers()) {
    SoyType elementType=getElementType(unionMember,node);
    if (elementType.getKind() == SoyType.Kind.ERROR) {
      return ErrorType.getInstance();
    }
    fieldTypes.add(elementType);
  }
  return typeOps.computeLowestCommonType(fieldTypes);
}
default :
errorReporter.report(node.getParent().getSourceLocation(),BAD_FOREACH_TYPE,node.getExpr().toSourceString(),node.getExpr().getType());
return ErrorType.getInstance();
}
}
Program: 29492
Project: 29492
Buggy source:
@Override protected void visitForeachNonemptyNode(ForeachNonemptyNode node){
  visitExpressions(node.getParent());
  node.getVar().setType(getElementType(node.getExpr().getType(),node.getParent()));
  visitChildren(node);
}

Fixed version (ground truth):
@Override protected void visitForeachNonemptyNode(ForeachNonemptyNode node){
  visitExpressions(node.getParent());
  node.getVar().setType(getElementType(node.getExpr().getType(),node));
  visitChildren(node);
}
Program: 29494
Project: 29494
Buggy source:
@Override public TemplateDelegateNodeBuilder setSoyDoc(String soyDoc){
  if (soyDoc == null) {
    errorReporter.report(sourceLocation,NO_SOY_DOC);
  }
  return (TemplateDelegateNodeBuilder)super.setSoyDoc(soyDoc);
}

Fixed version (ground truth):
@Override public TemplateDelegateNodeBuilder setSoyDoc(String soyDoc){
  return (TemplateDelegateNodeBuilder)super.setSoyDoc(soyDoc);
}
Program: 29495
Project: 29495
Buggy source:
private String computeLcTagName(ErrorReporter errorReporter){
  String firstChildText=((RawTextNode)children.get(0)).getRawText();
  Matcher matcher=TAG_NAME_PATTERN.matcher(firstChildText);
  if (!matcher.find()) {
    if (firstChildText.startsWith("String_Node_Str")) {
      errorReporter.report(sourceLocation,HTML_COMMENT_WITHIN_MSG_BLOCK,firstChildText);
    }
 else {
      errorReporter.report(sourceLocation,UNNAMED_HTML_TAG_WITHIN_MSG_BLOCK,firstChildText);
    }
  }
  return matcher.group().toLowerCase(Locale.ENGLISH);
}

Fixed version (ground truth):
@Nullable private String computeLcTagName(ErrorReporter errorReporter){
  String firstChildText=((RawTextNode)children.get(0)).getRawText();
  Matcher matcher=TAG_NAME_PATTERN.matcher(firstChildText);
  if (!matcher.find()) {
    if (firstChildText.startsWith("String_Node_Str")) {
      errorReporter.report(sourceLocation,HTML_COMMENT_WITHIN_MSG_BLOCK,firstChildText);
    }
 else {
      errorReporter.report(sourceLocation,UNNAMED_HTML_TAG_WITHIN_MSG_BLOCK,firstChildText);
    }
    return null;
  }
  return matcher.group().toLowerCase(Locale.ENGLISH);
}
Program: 29496
Project: 29496
Buggy source:
public ResolvePackageRelativeCssNamesVisitor(ErrorReporter errorReporter){
  this.errorReporter=errorReporter;
}

Fixed version (ground truth):
ResolvePackageRelativeCssNamesVisitor(ErrorReporter errorReporter){
  this.errorReporter=errorReporter;
}
Program: 29497
Project: 29497
Buggy source:
@Override protected void visitCssNode(CssNode node){
  String selectorText=node.getSelectorText();
  if (!selectorText.startsWith("String_Node_Str")) {
    return;
  }
  if (node.getComponentNameExpr() != null) {
    throw SoySyntaxExceptionUtils.createWithNode("String_Node_Str" + selectorText + "String_Node_Str",node);
  }
  if (packagePrefix == null) {
    throw SoySyntaxExceptionUtils.createWithNode("String_Node_Str" + selectorText + "String_Node_Str",node);
  }
  BlockNode parent=node.getParent();
  int indexInParent=parent.getChildIndex(node);
  parent.removeChild(indexInParent);
  CssNode newNode=new CssNode(node,packagePrefix + selectorText.substring(1),new CopyState());
  parent.addChild(indexInParent,newNode);
}

Fixed version (ground truth):
@Override protected void visitCssNode(CssNode node){
  String selectorText=node.getSelectorText();
  if (!selectorText.startsWith("String_Node_Str")) {
    return;
  }
  if (node.getComponentNameExpr() != null) {
    errorReporter.report(node.getSourceLocation(),PACKAGE_RELATIVE_CLASS_NAME_USED_WITH_COMPONENT_NAME,selectorText);
  }
  if (packagePrefix == null) {
    errorReporter.report(node.getSourceLocation(),NO_CSS_PACKAGE,selectorText);
  }
  BlockNode parent=node.getParent();
  int indexInParent=parent.getChildIndex(node);
  parent.removeChild(indexInParent);
  CssNode newNode=new CssNode(node,packagePrefix + selectorText.substring(1),new CopyState());
  parent.addChild(indexInParent,newNode);
}
Program: 29498
Project: 29498
Buggy source:
public void testMissingCssBase(){
  try {
    compileTemplate("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  SoySyntaxException e) {
    assertThat(e.getMessage()).contains("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testMissingCssBase(){
  FormattingErrorReporter errorReporter=new FormattingErrorReporter();
  compileTemplate("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",errorReporter);
  assertThat(errorReporter.getErrorMessages()).hasSize(1);
  assertThat(errorReporter.getErrorMessages().get(0)).isEqualTo("String_Node_Str");
}
Program: 29499
Project: 29499
Buggy source:
public void testWithComponentName(){
  try {
    compileTemplate("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    fail("String_Node_Str");
  }
 catch (  SoySyntaxException e) {
    assertThat(e.getMessage()).contains("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testWithComponentName(){
  FormattingErrorReporter errorReporter=new FormattingErrorReporter();
  compileTemplate("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",errorReporter);
  assertThat(errorReporter.getErrorMessages()).hasSize(2);
  assertThat(errorReporter.getErrorMessages().get(0)).isEqualTo("String_Node_Str");
  assertThat(errorReporter.getErrorMessages().get(1)).isEqualTo("String_Node_Str");
}
Program: 29500
Project: 29500
Buggy source:
public List<CssNode> compileTemplate(String templateText){
  ErrorReporter boom=ExplodingErrorReporter.get();
  SoyFileSetNode soyTree=SoyFileSetParserBuilder.forFileContents(templateText).errorReporter(boom).parse().fileSet();
  TemplateNode template=(TemplateNode)SharedTestUtils.getNode(soyTree);
  new ResolvePackageRelativeCssNamesVisitor(boom).exec(template);
  return getCssNodes(template);
}

Fixed version (ground truth):
private List<CssNode> compileTemplate(String templateText){
  return compileTemplate(templateText,ExplodingErrorReporter.get());
}
Program: 29501
Project: 29501
Buggy source:
@Override protected void visitTemplateNode(TemplateNode node){
  currentTemplateName=node.getTemplateNameForUserMsgs();
  localVariables=new LocalVariables();
  localVariables.enterScope();
  ijParams=new HashMap<>();
  for (  TemplateParam param : node.getAllParams()) {
    localVariables.define(param,node);
  }
  visitSoyNode(node);
  localVariables.exitScope();
  localVariables.verify();
  node.setMaxLocalVariableTableSize(localVariables.nextSlotToClaim);
  localVariables=null;
  ijParams=null;
}

Fixed version (ground truth):
@Override protected void visitTemplateNode(TemplateNode node){
  localVariables=new LocalVariables();
  localVariables.enterScope();
  ijParams=new HashMap<>();
  for (  TemplateParam param : node.getAllParams()) {
    localVariables.define(param,node);
  }
  visitSoyNode(node);
  localVariables.exitScope();
  localVariables.verify();
  node.setMaxLocalVariableTableSize(localVariables.nextSlotToClaim);
  localVariables=null;
  ijParams=null;
}
Program: 29502
Project: 29502
Buggy source:
private void visitExpressions(ExprHolderNode node){
  ResolveNamesExprVisitor exprVisitor=new ResolveNamesExprVisitor(node);
  for (  ExprUnion exprUnion : node.getAllExprUnions()) {
    if (exprUnion.getExpr() != null) {
      exprVisitor.exec(exprUnion.getExpr());
    }
  }
}

Fixed version (ground truth):
private void visitExpressions(ExprHolderNode node){
  ResolveNamesExprVisitor exprVisitor=new ResolveNamesExprVisitor();
  for (  ExprUnion exprUnion : node.getAllExprUnions()) {
    if (exprUnion.getExpr() != null) {
      exprVisitor.exec(exprUnion.getExpr());
    }
  }
}
Program: 29503
Project: 29503
Buggy source:
@Override protected void visitVarRefNode(VarRefNode varRef){
  if (varRef.isInjected()) {
    InjectedParam ijParam=ijParams.get(varRef.getName());
    if (ijParam == null) {
      ijParam=new InjectedParam(varRef.getName());
      ijParams.put(varRef.getName(),ijParam);
    }
    varRef.setDefn(ijParam);
    return;
  }
  VarDefn varDefn=localVariables.lookup(varRef.getName());
  if (varDefn == null) {
    if (declaredSyntaxVersion.num >= SyntaxVersion.V9_9.num) {
      throw createExceptionForInvalidExpr("String_Node_Str" + varRef.getName());
    }
 else {
      varDefn=new UndeclaredVar(varRef.getName());
    }
  }
  varRef.setDefn(varDefn);
}

Fixed version (ground truth):
@Override protected void visitVarRefNode(VarRefNode varRef){
  if (varRef.isInjected()) {
    InjectedParam ijParam=ijParams.get(varRef.getName());
    if (ijParam == null) {
      ijParam=new InjectedParam(varRef.getName());
      ijParams.put(varRef.getName(),ijParam);
    }
    varRef.setDefn(ijParam);
    return;
  }
  VarDefn varDefn=localVariables.lookup(varRef.getName());
  if (varDefn == null) {
    varDefn=new UndeclaredVar(varRef.getName());
  }
  varRef.setDefn(varDefn);
}
Program: 29504
Project: 29504
Buggy source:
/** 
 * Defines a variable. 
 */
void define(VarDefn defn,SoyNode definingNode){
  VarDefn preexisting=lookup(defn.name());
  if (preexisting != null) {
    throw SoySyntaxException.createWithMetaInfo("String_Node_Str" + defn.name() + "String_Node_Str",definingNode.getSourceLocation(),null,currentTemplateName);
  }
  currentScope.peek().put(defn.name(),defn);
  defn.setLocalVariableIndex(claimSlot());
}

Fixed version (ground truth):
/** 
 * Defines a variable. 
 */
void define(VarDefn defn,SoyNode definingNode){
  VarDefn preexisting=lookup(defn.name());
  if (preexisting != null) {
    Optional<SourceLocation> sourceLocation=forVarDefn(preexisting);
    String location=sourceLocation.isPresent() ? "String_Node_Str" + sourceLocation.get().getLineNumber() : "String_Node_Str";
    errorReporter.report(definingNode.getSourceLocation(),VARIABLE_ALREADY_DEFINED,defn.name(),location);
    return;
  }
  currentScope.peek().put(defn.name(),defn);
  defn.setLocalVariableIndex(claimSlot());
}
Program: 29505
Project: 29505
Buggy source:
ResolveNamesVisitor(SyntaxVersion declaredSyntaxVersion,ErrorReporter errorReporter){
  this.errorReporter=errorReporter;
  this.declaredSyntaxVersion=declaredSyntaxVersion;
}

Fixed version (ground truth):
ResolveNamesVisitor(ErrorReporter errorReporter){
  this.errorReporter=errorReporter;
}
Program: 29506
Project: 29506
Buggy source:
@Override public Void exec(ExprNode node){
  Preconditions.checkArgument(node instanceof ExprRootNode);
  this.currExprRootNode=(ExprRootNode)node;
  visit(node);
  this.currExprRootNode=null;
  return null;
}

Fixed version (ground truth):
@Override public Void exec(ExprNode node){
  Preconditions.checkArgument(node instanceof ExprRootNode);
  visit(node);
  return null;
}
Program: 29508
Project: 29508
Buggy source:
public void testParamNameLookupSuccess(){
  SoyFileSetNode soyTree=SoyFileSetParserBuilder.forFileContents(constructTemplateSource("String_Node_Str","String_Node_Str")).parse().fileSet();
  createResolveNamesVisitorForMaxSyntaxVersion().exec(soyTree);
  TemplateNode n=soyTree.getChild(0).getChild(0);
  assertThat(n.getMaxLocalVariableTableSize()).isEqualTo(1);
  assertThat(n.getParams().get(0).localVariableIndex()).isEqualTo(0);
}

Fixed version (ground truth):
public void testParamNameLookupSuccess(){
  SoyFileSetNode soyTree=SoyFileSetParserBuilder.forFileContents(constructTemplateSource("String_Node_Str","String_Node_Str")).parse().fileSet();
  new ResolveNamesVisitor(ExplodingErrorReporter.get()).exec(soyTree);
  TemplateNode n=soyTree.getChild(0).getChild(0);
  assertThat(n.getMaxLocalVariableTableSize()).isEqualTo(1);
  assertThat(n.getParams().get(0).localVariableIndex()).isEqualTo(0);
}
Program: 29509
Project: 29509
Buggy source:
public void testInjectedParamNameLookupSuccess(){
  SoyFileSetNode soyTree=SoyFileSetParserBuilder.forFileContents(constructTemplateSource("String_Node_Str","String_Node_Str")).parse().fileSet();
  createResolveNamesVisitorForMaxSyntaxVersion().exec(soyTree);
  TemplateNode n=soyTree.getChild(0).getChild(0);
  assertThat(n.getMaxLocalVariableTableSize()).isEqualTo(1);
  assertThat(n.getInjectedParams().get(0).localVariableIndex()).isEqualTo(0);
}

Fixed version (ground truth):
public void testInjectedParamNameLookupSuccess(){
  SoyFileSetNode soyTree=SoyFileSetParserBuilder.forFileContents(constructTemplateSource("String_Node_Str","String_Node_Str")).parse().fileSet();
  new ResolveNamesVisitor(ExplodingErrorReporter.get()).exec(soyTree);
  TemplateNode n=soyTree.getChild(0).getChild(0);
  assertThat(n.getMaxLocalVariableTableSize()).isEqualTo(1);
  assertThat(n.getInjectedParams().get(0).localVariableIndex()).isEqualTo(0);
}
Program: 29510
Project: 29510
Buggy source:
public void testLetNameLookupSuccess(){
  SoyFileSetNode soyTree=SoyFileSetParserBuilder.forFileContents(constructTemplateSource("String_Node_Str","String_Node_Str")).parse().fileSet();
  createResolveNamesVisitorForMaxSyntaxVersion().exec(soyTree);
  TemplateNode n=soyTree.getChild(0).getChild(0);
  assertThat(n.getMaxLocalVariableTableSize()).isEqualTo(1);
  assertThat(((LetValueNode)n.getChild(0)).getVar().localVariableIndex()).isEqualTo(0);
}

Fixed version (ground truth):
public void testLetNameLookupSuccess(){
  SoyFileSetNode soyTree=SoyFileSetParserBuilder.forFileContents(constructTemplateSource("String_Node_Str","String_Node_Str")).parse().fileSet();
  new ResolveNamesVisitor(ExplodingErrorReporter.get()).exec(soyTree);
  TemplateNode n=soyTree.getChild(0).getChild(0);
  assertThat(n.getMaxLocalVariableTableSize()).isEqualTo(1);
  assertThat(((LetValueNode)n.getChild(0)).getVar().localVariableIndex()).isEqualTo(0);
}
Program: 29511
Project: 29511
Buggy source:
public void testMultiplLocalsAndScopesNumbering(){
  SoyFileSetNode soyTree=SoyFileSetParserBuilder.forFileContents(constructTemplateSource("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str")).parse().fileSet();
  createResolveNamesVisitorForMaxSyntaxVersion().exec(soyTree);
  TemplateNode n=soyTree.getChild(0).getChild(0);
  assertThat(n.getMaxLocalVariableTableSize()).isEqualTo(6);
  assertThat(n.getParams().get(0).localVariableIndex()).isEqualTo(0);
  assertThat(n.getParams().get(1).localVariableIndex()).isEqualTo(1);
  assertThat(((LetValueNode)n.getChild(0)).getVar().localVariableIndex()).isEqualTo(2);
  ForeachNonemptyNode foreachNonEmptyNode=(ForeachNonemptyNode)((ForeachNode)n.getChild(1)).getChild(0);
  assertThat(foreachNonEmptyNode.getVar().currentLoopIndexIndex()).isEqualTo(3);
  assertThat(foreachNonEmptyNode.getVar().isLastIteratorIndex()).isEqualTo(4);
  assertThat(foreachNonEmptyNode.getVar().localVariableIndex()).isEqualTo(5);
  assertThat(((LetValueNode)n.getChild(2)).getVar().localVariableIndex()).isEqualTo(3);
}

Fixed version (ground truth):
public void testMultiplLocalsAndScopesNumbering(){
  SoyFileSetNode soyTree=SoyFileSetParserBuilder.forFileContents(constructTemplateSource("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str")).parse().fileSet();
  new ResolveNamesVisitor(ExplodingErrorReporter.get()).exec(soyTree);
  TemplateNode n=soyTree.getChild(0).getChild(0);
  assertThat(n.getMaxLocalVariableTableSize()).isEqualTo(6);
  assertThat(n.getParams().get(0).localVariableIndex()).isEqualTo(0);
  assertThat(n.getParams().get(1).localVariableIndex()).isEqualTo(1);
  assertThat(((LetValueNode)n.getChild(0)).getVar().localVariableIndex()).isEqualTo(2);
  ForeachNonemptyNode foreachNonEmptyNode=(ForeachNonemptyNode)((ForeachNode)n.getChild(1)).getChild(0);
  assertThat(foreachNonEmptyNode.getVar().currentLoopIndexIndex()).isEqualTo(3);
  assertThat(foreachNonEmptyNode.getVar().isLastIteratorIndex()).isEqualTo(4);
  assertThat(foreachNonEmptyNode.getVar().localVariableIndex()).isEqualTo(5);
  assertThat(((LetValueNode)n.getChild(2)).getVar().localVariableIndex()).isEqualTo(3);
}
Program: 29512
Project: 29512
Buggy source:
public void testMultipleLocals(){
  SoyFileSetNode soyTree=SoyFileSetParserBuilder.forFileContents(constructTemplateSource("String_Node_Str","String_Node_Str","String_Node_Str")).parse().fileSet();
  createResolveNamesVisitorForMaxSyntaxVersion().exec(soyTree);
  TemplateNode n=soyTree.getChild(0).getChild(0);
  assertThat(n.getMaxLocalVariableTableSize()).isEqualTo(3);
  LetValueNode firstLet=(LetValueNode)n.getChild(0);
  LetValueNode secondLet=(LetValueNode)n.getChild(1);
  LetValueNode thirdLet=(LetValueNode)n.getChild(2);
  assertThat(firstLet.getVar().localVariableIndex()).isEqualTo(0);
  assertThat(secondLet.getVar().localVariableIndex()).isEqualTo(1);
  assertThat(thirdLet.getVar().localVariableIndex()).isEqualTo(2);
  assertThat(((VarRefNode)secondLet.getValueExpr().getRoot()).getDefnDecl()).isEqualTo(firstLet.getVar());
  assertThat(((VarRefNode)thirdLet.getValueExpr().getRoot()).getDefnDecl()).isEqualTo(secondLet.getVar());
}

Fixed version (ground truth):
public void testMultipleLocals(){
  SoyFileSetNode soyTree=SoyFileSetParserBuilder.forFileContents(constructTemplateSource("String_Node_Str","String_Node_Str","String_Node_Str")).parse().fileSet();
  new ResolveNamesVisitor(ExplodingErrorReporter.get()).exec(soyTree);
  TemplateNode n=soyTree.getChild(0).getChild(0);
  assertThat(n.getMaxLocalVariableTableSize()).isEqualTo(3);
  LetValueNode firstLet=(LetValueNode)n.getChild(0);
  LetValueNode secondLet=(LetValueNode)n.getChild(1);
  LetValueNode thirdLet=(LetValueNode)n.getChild(2);
  assertThat(firstLet.getVar().localVariableIndex()).isEqualTo(0);
  assertThat(secondLet.getVar().localVariableIndex()).isEqualTo(1);
  assertThat(thirdLet.getVar().localVariableIndex()).isEqualTo(2);
  assertThat(((VarRefNode)secondLet.getValueExpr().getRoot()).getDefnDecl()).isEqualTo(firstLet.getVar());
  assertThat(((VarRefNode)thirdLet.getValueExpr().getRoot()).getDefnDecl()).isEqualTo(secondLet.getVar());
}
Program: 29513
Project: 29513
Buggy source:
/** 
 * Assertions function that checks to make sure that name resolution fails with the expected exception.
 * @param fileContent The template source.
 * @param expectedError The expected failure message (a substring).
 */
private void assertResolveNamesFails(String expectedError,String fileContent){
  try {
    SoyFileSetParserBuilder.forFileContents(fileContent).declaredSyntaxVersion(SyntaxVersion.V2_0).typeRegistry(typeRegistry).parse();
    fail("String_Node_Str");
  }
 catch (  SoySyntaxException e) {
    String message=e.getMessage();
    assertWithMessage("String_Node_Str" + message + "String_Node_Str"+ expectedError+ "String_Node_Str").that(message.contains(expectedError)).isTrue();
  }
}

Fixed version (ground truth):
private void assertResolveNamesFails(String expectedError,String fileContent){
  FormattingErrorReporter errorReporter=new FormattingErrorReporter();
  SoyFileSetParserBuilder.forFileContents(fileContent).declaredSyntaxVersion(SyntaxVersion.V2_0).errorReporter(errorReporter).typeRegistry(typeRegistry).parse();
  assertThat(errorReporter.getErrorMessages()).hasSize(1);
  assertThat(errorReporter.getErrorMessages().get(0)).isEqualTo(expectedError);
}
Program: 29514
Project: 29514
Buggy source:
public void testLetContentSlotLifetime(){
  SoyFileSetNode soyTree=SoyFileSetParserBuilder.forFileContents(constructTemplateSource("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str")).parse().fileSet();
  createResolveNamesVisitorForMaxSyntaxVersion().exec(soyTree);
  TemplateNode n=soyTree.getChild(0).getChild(0);
  assertThat(n.getMaxLocalVariableTableSize()).isEqualTo(2);
  LetContentNode aLetNode=(LetContentNode)n.getChild(0);
  assertThat(aLetNode.getVar().localVariableIndex()).isEqualTo(1);
  LetValueNode bLetNode=(LetValueNode)((IfCondNode)((IfNode)aLetNode.getChild(0)).getChild(0)).getChild(0);
  assertThat(bLetNode.getVar().localVariableIndex()).isEqualTo(0);
}

Fixed version (ground truth):
public void testLetContentSlotLifetime(){
  SoyFileSetNode soyTree=SoyFileSetParserBuilder.forFileContents(constructTemplateSource("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str")).parse().fileSet();
  new ResolveNamesVisitor(ExplodingErrorReporter.get()).exec(soyTree);
  TemplateNode n=soyTree.getChild(0).getChild(0);
  assertThat(n.getMaxLocalVariableTableSize()).isEqualTo(2);
  LetContentNode aLetNode=(LetContentNode)n.getChild(0);
  assertThat(aLetNode.getVar().localVariableIndex()).isEqualTo(1);
  LetValueNode bLetNode=(LetValueNode)((IfCondNode)((IfNode)aLetNode.getChild(0)).getChild(0)).getChild(0);
  assertThat(bLetNode.getVar().localVariableIndex()).isEqualTo(0);
}