Program: 27966
Project: 27966
Buggy source:
/** 
 * Tests the behavior of the null type.
 */
public void testNullType() throws Exception {
  assertFalse(NULL_TYPE.isArrayType());
  assertFalse(NULL_TYPE.isBooleanValueType());
  assertFalse(NULL_TYPE.isDateType());
  assertFalse(NULL_TYPE.isEnumElementType());
  assertFalse(NULL_TYPE.isNamedType());
  assertTrue(NULL_TYPE.isNullType());
  assertFalse(NULL_TYPE.isNumber());
  assertFalse(NULL_TYPE.isNumberObjectType());
  assertFalse(NULL_TYPE.isNumberValueType());
  assertFalse(NULL_TYPE.isFunctionPrototypeType());
  assertFalse(NULL_TYPE.isRegexpType());
  assertFalse(NULL_TYPE.isString());
  assertFalse(NULL_TYPE.isStringObjectType());
  assertFalse(NULL_TYPE.isStringValueType());
  assertFalse(NULL_TYPE.isEnumType());
  assertFalse(NULL_TYPE.isUnionType());
  assertFalse(NULL_TYPE.isStruct());
  assertFalse(NULL_TYPE.isDict());
  assertFalse(NULL_TYPE.isAllType());
  assertFalse(NULL_TYPE.isVoidType());
  assertFalse(NULL_TYPE.isConstructor());
  assertFalse(NULL_TYPE.isInstanceType());
  assertNull(NULL_TYPE.autoboxesTo());
  assertFalse(NULL_TYPE.isSubtype(NO_OBJECT_TYPE));
  assertFalse(NULL_TYPE.isSubtype(NO_TYPE));
  assertTrue(NULL_TYPE.isSubtype(NULL_TYPE));
  assertTrue(NULL_TYPE.isSubtype(ALL_TYPE));
  assertFalse(NULL_TYPE.isSubtype(STRING_OBJECT_TYPE));
  assertFalse(NULL_TYPE.isSubtype(NUMBER_TYPE));
  assertFalse(NULL_TYPE.isSubtype(functionType));
  assertFalse(NULL_TYPE.isSubtype(OBJECT_TYPE));
  assertFalse(NULL_TYPE.isSubtype(DATE_TYPE));
  assertFalse(NULL_TYPE.isSubtype(REGEXP_TYPE));
  assertFalse(NULL_TYPE.isSubtype(ARRAY_TYPE));
  assertTrue(NULL_TYPE.isSubtype(UNKNOWN_TYPE));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(NO_OBJECT_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(NO_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(NULL_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(ALL_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(STRING_OBJECT_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(NUMBER_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(functionType)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(OBJECT_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(DATE_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(REGEXP_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(ARRAY_TYPE)));
  assertFalse(NULL_TYPE.canBeCalled());
  assertCanTestForEqualityWith(NULL_TYPE,NO_TYPE);
  assertCanTestForEqualityWith(NULL_TYPE,NO_OBJECT_TYPE);
  assertCanTestForEqualityWith(NULL_TYPE,ALL_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,ARRAY_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,BOOLEAN_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,BOOLEAN_OBJECT_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,DATE_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,ERROR_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,EVAL_ERROR_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,functionType);
  assertCannotTestForEqualityWith(NULL_TYPE,NULL_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,NUMBER_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,NUMBER_OBJECT_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,OBJECT_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,URI_ERROR_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,RANGE_ERROR_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,REFERENCE_ERROR_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,REGEXP_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,STRING_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,STRING_OBJECT_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,SYNTAX_ERROR_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,TYPE_ERROR_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,VOID_TYPE);
  assertTrue(NULL_TYPE.canTestForShallowEqualityWith(NO_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(NO_OBJECT_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(ARRAY_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(BOOLEAN_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(BOOLEAN_OBJECT_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(DATE_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(ERROR_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(EVAL_ERROR_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(functionType));
  assertTrue(NULL_TYPE.canTestForShallowEqualityWith(NULL_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(NUMBER_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(NUMBER_OBJECT_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(OBJECT_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(URI_ERROR_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(RANGE_ERROR_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(REFERENCE_ERROR_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(REGEXP_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(STRING_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(STRING_OBJECT_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(SYNTAX_ERROR_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(TYPE_ERROR_TYPE));
  assertTrue(NULL_TYPE.canTestForShallowEqualityWith(ALL_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(VOID_TYPE));
  assertTrue(NULL_TYPE.canTestForShallowEqualityWith(createNullableType(STRING_OBJECT_TYPE)));
  assertTypeEquals(NULL_TYPE,NULL_TYPE.getLeastSupertype(NULL_TYPE));
  assertTypeEquals(ALL_TYPE,NULL_TYPE.getLeastSupertype(ALL_TYPE));
  assertTypeEquals(createNullableType(STRING_OBJECT_TYPE),NULL_TYPE.getLeastSupertype(STRING_OBJECT_TYPE));
  assertTypeEquals(createNullableType(NUMBER_TYPE),NULL_TYPE.getLeastSupertype(NUMBER_TYPE));
  assertTypeEquals(createNullableType(functionType),NULL_TYPE.getLeastSupertype(functionType));
  assertTypeEquals(createNullableType(OBJECT_TYPE),NULL_TYPE.getLeastSupertype(OBJECT_TYPE));
  assertTypeEquals(createNullableType(DATE_TYPE),NULL_TYPE.getLeastSupertype(DATE_TYPE));
  assertTypeEquals(createNullableType(REGEXP_TYPE),NULL_TYPE.getLeastSupertype(REGEXP_TYPE));
  assertTrue(NULL_TYPE.matchesInt32Context());
  assertTrue(NULL_TYPE.matchesNumberContext());
  assertFalse(NULL_TYPE.matchesObjectContext());
  assertTrue(NULL_TYPE.matchesStringContext());
  assertTrue(NULL_TYPE.matchesUint32Context());
  assertFalse(NULL_TYPE.matchesObjectContext());
  assertEquals("String_Node_Str",NULL_TYPE.toString());
  assertTrue(NULL_TYPE.hasDisplayName());
  assertEquals("String_Node_Str",NULL_TYPE.getDisplayName());
  Asserts.assertResolvesToSame(NULL_TYPE);
  assertTrue(NULL_TYPE.isSubtype(createUnionType(forwardDeclaredNamedType,NULL_TYPE)));
  assertTypeEquals(NULL_TYPE,NULL_TYPE.getGreatestSubtype(createUnionType(forwardDeclaredNamedType,NULL_TYPE)));
  assertFalse(NULL_TYPE.isNominalConstructor());
  assertTrue(NULL_TYPE.differsFrom(UNKNOWN_TYPE));
}

Fixed version (ground truth):
/** 
 * Tests the behavior of the null type.
 */
public void testNullType() throws Exception {
  assertFalse(NULL_TYPE.isArrayType());
  assertFalse(NULL_TYPE.isBooleanValueType());
  assertFalse(NULL_TYPE.isDateType());
  assertFalse(NULL_TYPE.isEnumElementType());
  assertFalse(NULL_TYPE.isNamedType());
  assertTrue(NULL_TYPE.isNullType());
  assertFalse(NULL_TYPE.isNumber());
  assertFalse(NULL_TYPE.isNumberObjectType());
  assertFalse(NULL_TYPE.isNumberValueType());
  assertFalse(NULL_TYPE.isFunctionPrototypeType());
  assertFalse(NULL_TYPE.isRegexpType());
  assertFalse(NULL_TYPE.isString());
  assertFalse(NULL_TYPE.isStringObjectType());
  assertFalse(NULL_TYPE.isStringValueType());
  assertFalse(NULL_TYPE.isEnumType());
  assertFalse(NULL_TYPE.isUnionType());
  assertFalse(NULL_TYPE.isStruct());
  assertFalse(NULL_TYPE.isDict());
  assertFalse(NULL_TYPE.isAllType());
  assertFalse(NULL_TYPE.isVoidType());
  assertFalse(NULL_TYPE.isConstructor());
  assertFalse(NULL_TYPE.isInstanceType());
  assertNull(NULL_TYPE.autoboxesTo());
  assertFalse(NULL_TYPE.isSubtype(NO_OBJECT_TYPE));
  assertFalse(NULL_TYPE.isSubtype(NO_TYPE));
  assertTrue(NULL_TYPE.isSubtype(NULL_TYPE));
  assertTrue(NULL_TYPE.isSubtype(ALL_TYPE));
  assertFalse(NULL_TYPE.isSubtype(STRING_OBJECT_TYPE));
  assertFalse(NULL_TYPE.isSubtype(NUMBER_TYPE));
  assertFalse(NULL_TYPE.isSubtype(functionType));
  assertFalse(NULL_TYPE.isSubtype(OBJECT_TYPE));
  assertFalse(NULL_TYPE.isSubtype(DATE_TYPE));
  assertFalse(NULL_TYPE.isSubtype(REGEXP_TYPE));
  assertFalse(NULL_TYPE.isSubtype(ARRAY_TYPE));
  assertTrue(NULL_TYPE.isSubtype(UNKNOWN_TYPE));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(NO_OBJECT_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(NO_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(NULL_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(ALL_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(STRING_OBJECT_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(NUMBER_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(functionType)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(OBJECT_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(DATE_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(REGEXP_TYPE)));
  assertTrue(NULL_TYPE.isSubtype(createNullableType(ARRAY_TYPE)));
  assertFalse(NULL_TYPE.canBeCalled());
  assertCanTestForEqualityWith(NULL_TYPE,NO_TYPE);
  assertCanTestForEqualityWith(NULL_TYPE,NO_OBJECT_TYPE);
  assertCanTestForEqualityWith(NULL_TYPE,ALL_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,ARRAY_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,BOOLEAN_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,BOOLEAN_OBJECT_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,DATE_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,ERROR_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,EVAL_ERROR_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,functionType);
  assertCannotTestForEqualityWith(NULL_TYPE,NULL_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,NUMBER_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,NUMBER_OBJECT_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,OBJECT_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,URI_ERROR_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,RANGE_ERROR_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,REFERENCE_ERROR_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,REGEXP_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,STRING_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,STRING_OBJECT_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,SYNTAX_ERROR_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,TYPE_ERROR_TYPE);
  assertCannotTestForEqualityWith(NULL_TYPE,VOID_TYPE);
  assertTrue(NULL_TYPE.canTestForShallowEqualityWith(NO_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(NO_OBJECT_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(ARRAY_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(BOOLEAN_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(BOOLEAN_OBJECT_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(DATE_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(ERROR_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(EVAL_ERROR_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(functionType));
  assertTrue(NULL_TYPE.canTestForShallowEqualityWith(NULL_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(NUMBER_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(NUMBER_OBJECT_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(OBJECT_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(URI_ERROR_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(RANGE_ERROR_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(REFERENCE_ERROR_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(REGEXP_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(STRING_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(STRING_OBJECT_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(SYNTAX_ERROR_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(TYPE_ERROR_TYPE));
  assertTrue(NULL_TYPE.canTestForShallowEqualityWith(ALL_TYPE));
  assertFalse(NULL_TYPE.canTestForShallowEqualityWith(VOID_TYPE));
  assertTrue(NULL_TYPE.canTestForShallowEqualityWith(createNullableType(STRING_OBJECT_TYPE)));
  assertTypeEquals(NULL_TYPE,NULL_TYPE.getLeastSupertype(NULL_TYPE));
  assertTypeEquals(ALL_TYPE,NULL_TYPE.getLeastSupertype(ALL_TYPE));
  assertTypeEquals(createNullableType(STRING_OBJECT_TYPE),NULL_TYPE.getLeastSupertype(STRING_OBJECT_TYPE));
  assertTypeEquals(createNullableType(NUMBER_TYPE),NULL_TYPE.getLeastSupertype(NUMBER_TYPE));
  assertTypeEquals(createNullableType(functionType),NULL_TYPE.getLeastSupertype(functionType));
  assertTypeEquals(createNullableType(OBJECT_TYPE),NULL_TYPE.getLeastSupertype(OBJECT_TYPE));
  assertTypeEquals(createNullableType(DATE_TYPE),NULL_TYPE.getLeastSupertype(DATE_TYPE));
  assertTypeEquals(createNullableType(REGEXP_TYPE),NULL_TYPE.getLeastSupertype(REGEXP_TYPE));
  assertTrue(NULL_TYPE.matchesInt32Context());
  assertTrue(NULL_TYPE.matchesNumberContext());
  assertFalse(NULL_TYPE.matchesObjectContext());
  assertTrue(NULL_TYPE.matchesStringContext());
  assertTrue(NULL_TYPE.matchesUint32Context());
  assertFalse(NULL_TYPE.matchesObjectContext());
  assertEquals("String_Node_Str",NULL_TYPE.toString());
  assertTrue(NULL_TYPE.hasDisplayName());
  assertEquals("String_Node_Str",NULL_TYPE.getDisplayName());
  Asserts.assertResolvesToSame(NULL_TYPE);
  assertTrue(NULL_TYPE.isSubtype(createUnionType(forwardDeclaredNamedType,NULL_TYPE)));
  assertTypeEquals(createUnionType(forwardDeclaredNamedType,NULL_TYPE),NULL_TYPE.getGreatestSubtype(createUnionType(forwardDeclaredNamedType,NULL_TYPE)));
  assertFalse(NULL_TYPE.isNominalConstructor());
  assertTrue(NULL_TYPE.differsFrom(UNKNOWN_TYPE));
}