Program: 19203
Project: 19203
Buggy source:
public void verifySubtypeChain(List<JSType> typeChain,boolean checkSubtyping) throws Exception {
  for (int i=0; i < typeChain.size(); i++) {
    for (int j=0; j < typeChain.size(); j++) {
      JSType typeI=typeChain.get(i);
      JSType typeJ=typeChain.get(j);
      JSType namedTypeI=getNamedWrapper("String_Node_Str",typeI);
      JSType namedTypeJ=getNamedWrapper("String_Node_Str",typeJ);
      JSType proxyTypeI=new ProxyObjectType(registry,typeI);
      JSType proxyTypeJ=new ProxyObjectType(registry,typeJ);
      if (i == j) {
        assertTrue(typeI + "String_Node_Str",typeI.isEquivalentTo(typeI));
        assertTrue("String_Node_Str" + typeI + "String_Node_Str",namedTypeI.isEquivalentTo(namedTypeI));
        assertTrue("String_Node_Str" + typeI + "String_Node_Str",proxyTypeI.isEquivalentTo(proxyTypeI));
      }
 else {
        boolean shouldCheck=true;
        ObjectType objectI=typeI.toObjectType();
        ObjectType objectJ=typeJ.toObjectType();
        if (objectI != null && objectJ != null) {
          FunctionType constructorI=objectI.getConstructor();
          FunctionType constructorJ=objectJ.getConstructor();
          if (constructorI != null && constructorJ != null && constructorI.isStructuralInterface() && constructorJ.isStructuralInterface()) {
            if (constructorI.checkEquivalenceHelper(constructorJ,EquivalenceMethod.IDENTITY)) {
              shouldCheck=false;
            }
          }
        }
        if (shouldCheck) {
          assertFalse(typeI + "String_Node_Str" + typeJ,typeI.isEquivalentTo(typeJ));
          assertFalse("String_Node_Str" + typeI + "String_Node_Str"+ typeJ,namedTypeI.isEquivalentTo(namedTypeJ));
          assertFalse("String_Node_Str" + typeI + "String_Node_Str"+ typeJ,proxyTypeI.isEquivalentTo(proxyTypeJ));
        }
      }
      assertTrue(typeJ + "String_Node_Str" + typeI,typeJ.canCastTo(typeI));
      assertTrue(typeJ + "String_Node_Str" + namedTypeI,typeJ.canCastTo(namedTypeI));
      assertTrue(typeJ + "String_Node_Str" + proxyTypeI,typeJ.canCastTo(proxyTypeI));
      assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,namedTypeJ.canCastTo(typeI));
      assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,namedTypeJ.canCastTo(namedTypeI));
      assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,namedTypeJ.canCastTo(proxyTypeI));
      assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,proxyTypeJ.canCastTo(typeI));
      assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,proxyTypeJ.canCastTo(namedTypeI));
      assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,proxyTypeJ.canCastTo(proxyTypeI));
      if (typeI.isSubtypeOf(typeJ) && typeJ.isSubtypeOf(typeI)) {
        continue;
      }
      if (checkSubtyping) {
        if (i <= j) {
          assertTrue(typeJ + "String_Node_Str" + typeI,typeJ.isSubtypeOf(typeI));
          assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,namedTypeJ.isSubtypeOf(namedTypeI));
          assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,proxyTypeJ.isSubtypeOf(proxyTypeI));
        }
 else {
          assertFalse(typeJ + "String_Node_Str" + typeI,typeJ.isSubtypeOf(typeI));
          assertFalse("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,namedTypeJ.isSubtypeOf(namedTypeI));
          assertFalse("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,proxyTypeJ.isSubtypeOf(proxyTypeI));
        }
        JSType expectedSupremum=i < j ? typeI : typeJ;
        JSType expectedInfimum=i > j ? typeI : typeJ;
        assertTypeEquals(expectedSupremum + "String_Node_Str" + typeI+ "String_Node_Str"+ typeJ,expectedSupremum,typeI.getLeastSupertype(typeJ));
        assertTypeEquals(expectedInfimum + "String_Node_Str" + typeI+ "String_Node_Str"+ typeJ,expectedInfimum,typeI.getGreatestSubtype(typeJ));
      }
    }
  }
}

Fixed version (ground truth):
public void verifySubtypeChain(List<JSType> typeChain,boolean checkSubtyping) throws Exception {
  for (int i=0; i < typeChain.size(); i++) {
    for (int j=0; j < typeChain.size(); j++) {
      JSType typeI=typeChain.get(i);
      JSType typeJ=typeChain.get(j);
      JSType namedTypeI=getNamedWrapper("String_Node_Str",typeI);
      JSType namedTypeJ=getNamedWrapper("String_Node_Str",typeJ);
      JSType proxyTypeI=new ProxyObjectType(registry,typeI);
      JSType proxyTypeJ=new ProxyObjectType(registry,typeJ);
      if (i == j) {
        assertTrue(typeI + "String_Node_Str",typeI.isEquivalentTo(typeI));
        assertTrue("String_Node_Str" + typeI + "String_Node_Str",namedTypeI.isEquivalentTo(namedTypeI));
        assertTrue("String_Node_Str" + typeI + "String_Node_Str",proxyTypeI.isEquivalentTo(proxyTypeI));
      }
 else {
        boolean shouldCheck=true;
        ObjectType objectI=typeI.toObjectType();
        ObjectType objectJ=typeJ.toObjectType();
        if (objectI != null && objectJ != null) {
          FunctionType constructorI=objectI.getConstructor();
          FunctionType constructorJ=objectJ.getConstructor();
          if (constructorI != null && constructorJ != null && constructorI.isStructuralInterface() && constructorJ.isStructuralInterface()) {
            if (constructorI.isEquivalentTo(constructorJ)) {
              shouldCheck=false;
            }
          }
        }
        if (shouldCheck) {
          assertFalse(typeI + "String_Node_Str" + typeJ,typeI.isEquivalentTo(typeJ));
          assertFalse("String_Node_Str" + typeI + "String_Node_Str"+ typeJ,namedTypeI.isEquivalentTo(namedTypeJ));
          assertFalse("String_Node_Str" + typeI + "String_Node_Str"+ typeJ,proxyTypeI.isEquivalentTo(proxyTypeJ));
        }
      }
      assertTrue(typeJ + "String_Node_Str" + typeI,typeJ.canCastTo(typeI));
      assertTrue(typeJ + "String_Node_Str" + namedTypeI,typeJ.canCastTo(namedTypeI));
      assertTrue(typeJ + "String_Node_Str" + proxyTypeI,typeJ.canCastTo(proxyTypeI));
      assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,namedTypeJ.canCastTo(typeI));
      assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,namedTypeJ.canCastTo(namedTypeI));
      assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,namedTypeJ.canCastTo(proxyTypeI));
      assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,proxyTypeJ.canCastTo(typeI));
      assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,proxyTypeJ.canCastTo(namedTypeI));
      assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,proxyTypeJ.canCastTo(proxyTypeI));
      if (typeI.isSubtypeOf(typeJ) && typeJ.isSubtypeOf(typeI)) {
        continue;
      }
      if (checkSubtyping) {
        if (i <= j) {
          assertTrue(typeJ + "String_Node_Str" + typeI,typeJ.isSubtypeOf(typeI));
          assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,namedTypeJ.isSubtypeOf(namedTypeI));
          assertTrue("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,proxyTypeJ.isSubtypeOf(proxyTypeI));
        }
 else {
          assertFalse(typeJ + "String_Node_Str" + typeI,typeJ.isSubtypeOf(typeI));
          assertFalse("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,namedTypeJ.isSubtypeOf(namedTypeI));
          assertFalse("String_Node_Str" + typeJ + "String_Node_Str"+ typeI,proxyTypeJ.isSubtypeOf(proxyTypeI));
        }
        JSType expectedSupremum=i < j ? typeI : typeJ;
        JSType expectedInfimum=i > j ? typeI : typeJ;
        assertTypeEquals(expectedSupremum + "String_Node_Str" + typeI+ "String_Node_Str"+ typeJ,expectedSupremum,typeI.getLeastSupertype(typeJ));
        assertTypeEquals(expectedInfimum + "String_Node_Str" + typeI+ "String_Node_Str"+ typeJ,expectedInfimum,typeI.getGreatestSubtype(typeJ));
      }
    }
  }
}