anchor.diff:        assert(node.enclosingClass.typeParameters.length ==
             node.function.typeParameters.length);
         // Factories can have function type parameters as long as they correspond
  -      // exactly to those on the enclosing class.
  -      // Skip the visitFunctionNode but traverse body for local functions.
  +      // exactly to those on the enclosing class. However, these type parameters
  +      // may still not be in a constant.
  +      for (var parameter in node.function.typeParameters) {
  +        constantSubstitution[parameter] = const DynamicType();
  +      }
  +      // Skip the visitFunctionNode but traverse body.
         node.function.transformChildren(this);
  +      node.function.typeParameters.forEach(constantSubstitution.remove);
       } else {
         node.transformChildren(this);
       }
  
positive.code:     if (node.target.kind != ProcedureKind.Factory) {
        node.arguments.types.clear();
      }
      node.transformChildren(this);
      return node;
    }
  
  
negative.code: import '../ast.dart';
  import '../type_algebra.dart';
  
  /// This pass is a temporary measure to run strong mode code in the VM, which
  /// does not yet have the necessary runtime support.
  ///
  /// Function type parameter lists are cleared and all uses of a function type
  /// parameter are replaced by its upper bound.
  ///
  /// All uses of type parameters in constants are replaced by 'dynamic'.
  ///
  /// This does not preserve dynamic type safety.
  class Erasure extends Transformer {
    final Map<TypeParameter, DartType> substitution = <TypeParameter, DartType>{};
    final Map<TypeParameter, DartType> constantSubstitution =
        <TypeParameter, DartType>{};
  
    int constantContexts = 0;
  
    void transform(Program program) {
      program.accept(this);
    }
  
    void pushConstantContext() {
      ++constantContexts;
    }
  
    void popConstantContext() {
      --constantContexts;
    }
  
    bool get isInConstantContext => constantContexts > 0;
  
    @override
    visitDartType(DartType type) {
      type = substitute(type, substitution);
      if (isInConstantContext) {
        type = substitute(type, constantSubstitution);
      }
      return type;
    }
  
    @override
    visitClass(Class node) {
      for (var parameter in node.typeParameters) {
        constantSubstitution[parameter] = const DynamicType();
      }
      node.transformChildren(this);
      constantSubstitution.clear();
      return node;
    }
  
    @override
    visitProcedure(Procedure node) {
  