anchor.diff:      _checkLattice(top, left, right, bottom);
     }
   
  -  void test_isSubtypeOf_void_functions() {
  -    FunctionType top = TypeBuilder.functionType(<DartType>[intType], voidType);
  -    FunctionType bottom =
  -        TypeBuilder.functionType(<DartType>[objectType], intType);
  -
  -    _checkIsStrictSubtypeOf(bottom, top);
  +  void test_isSubtypeOf_generics() {
  +    ClassElementImpl LClass = ElementFactory.classElement2('L', ["T"]);
  +    InterfaceType LType = LClass.type;
  +    ClassElementImpl MClass = ElementFactory.classElement2('M', ["T"]);
  +    DartType typeParam = MClass.typeParameters[0].type;
  +    InterfaceType superType = LType.substitute4(<DartType>[typeParam]);
  +    MClass.interfaces = <InterfaceType>[superType];
  +    InterfaceType MType = MClass.type;
  +
  +    InterfaceType top = LType.substitute4(<DartType>[dynamicType]);
  +    InterfaceType left = MType.substitute4(<DartType>[dynamicType]);
  +    InterfaceType right = LType.substitute4(<DartType>[intType]);
  +    InterfaceType bottom = MType.substitute4(<DartType>[intType]);
  +
  +    _checkLattice(top, left, right, bottom);
  +  }
  +
  +  void test_isSubtypeOf_int() {
  +    List<DartType> equivalents = <DartType>[intType];
  +    List<DartType> supertypes = <DartType>[numType];
  +    List<DartType> unrelated = <DartType>[doubleType];
  +    _checkGroups(intType,
  +        equivalents: equivalents, supertypes: supertypes, unrelated: unrelated);
     }
   
     void test_isSubtypeOf_named_optional() {
  
positive.code:         equivalents: [nnn], subtypes: [], unrelated: [r, o, rr, ro, rn, oo]);
    }
  
    void test_isSubtypeOf_generics() {
      ClassElementImpl LClass = ElementFactory.classElement2('L', ["T"]);
      InterfaceType LType = LClass.type;
      ClassElementImpl MClass = ElementFactory.classElement2('M', ["T"]);
      DartType typeParam = MClass.typeParameters[0].type;
      InterfaceType superType = LType.substitute4(<DartType>[typeParam]);
      MClass.interfaces = <InterfaceType>[superType];
      InterfaceType MType = MClass.type;
  
      InterfaceType top = LType.substitute4(<DartType>[dynamicType]);
      InterfaceType left = MType.substitute4(<DartType>[dynamicType]);
      InterfaceType right = LType.substitute4(<DartType>[intType]);
      InterfaceType bottom = MType.substitute4(<DartType>[intType]);
  
      _checkLattice(top, left, right, bottom);
    }
  
    void _checkLattice(
        DartType top, DartType left, DartType right, DartType bottom) {
      _checkGroups(top,
          equivalents: <DartType>[top],
          subtypes: <DartType>[left, right, bottom]);
      _checkGroups(left,
          equivalents: <DartType>[left],
          subtypes: <DartType>[bottom],
          unrelated: <DartType>[right],
          supertypes: <DartType>[top]);
      _checkGroups(right,
          equivalents: <DartType>[right],
          subtypes: <DartType>[bottom],
          unrelated: <DartType>[left],
          supertypes: <DartType>[top]);
      _checkGroups(bottom,
          equivalents: <DartType>[bottom],
          supertypes: <DartType>[top, left, right]);
    }
  
    void _checkGroups(DartType t1,
  
negative.code:     }
    }
  
    void _checkIsNotSubtypeOf(DartType type1, DartType type2) {
      expect(typeSystem.isSubtypeOf(type1, type2), false);
    }
  
    void _checkIsStrictSubtypeOf(DartType type1, DartType type2) {
      _checkIsSubtypeOf(type1, type2);
      _checkIsNotSubtypeOf(type2, type1);
    }
  
    void _checkIsSubtypeOf(DartType type1, DartType type2) {
      expect(typeSystem.isSubtypeOf(type1, type2), true);
    }
  
    void _checkLattice(
        DartType top, DartType left, DartType right, DartType bottom) {
      _checkGroups(top,
          equivalents: <DartType>[top],
          subtypes: <DartType>[left, right, bottom]);
      _checkGroups(left,
          equivalents: <DartType>[left],
          subtypes: <DartType>[bottom],
          unrelated: <DartType>[right],
          supertypes: <DartType>[top]);
      _checkGroups(right,
          equivalents: <DartType>[right],
          subtypes: <DartType>[bottom],
          unrelated: <DartType>[left],
          supertypes: <DartType>[top]);
      _checkGroups(bottom,
          equivalents: <DartType>[bottom],
          supertypes: <DartType>[top, left, right]);
    }
  
    void _checkUnrelated(DartType type1, DartType type2) {
      _checkIsNotSubtypeOf(type1, type2);
      _checkIsNotSubtypeOf(type2, type1);
    }
  }
  
  class TypeBuilder {
    static FunctionType functionType(
        List<DartType> parameters, DartType returnType,
        {List<DartType> optional, Map<String, DartType> named}) {
      return ElementFactory
          .functionElement8(parameters, returnType,
              optional: optional, named: named)
          .type;
    }
  }
  
  @reflectiveTest
  class TypeSystemTest {
    TypeProvider typeProvider;
    TypeSystem typeSystem;
    FunctionType simpleFunctionType;
  
    DartType get bottomType => typeProvider.bottomType;
    InterfaceType get doubleType => typeProvider.doubleType;
  