anchor.diff:          return buildClosedTypeFromDartType(functionType.type);
   
         case ElementKind.TYPE_PARAMETER:
  -        return new ast.TypeParameterType(
  -            scope.getTypeParameterReference(element));
  +        var typeParameter = scope.getTypeParameterReference(element);
  +        if (!scope.allowClassTypeParameters &&
  +            typeParameter.parent is ast.Class) {
  +          return const ast.InvalidType();
  +        }
  +        return new ast.TypeParameterType(typeParameter);
   
         case ElementKind.COMPILATION_UNIT:
         case ElementKind.CONSTRUCTOR:
  
positive.code:   }
  
    void addAnnotations(List<Annotation> annotations) {
      for (var annotation in annotations) {
        currentClass.addAnnotation(scope.buildAnnotation(annotation));
      }
    }
  
  
negative.code:       ConstructorElement element, ast.Arguments arguments) {
      ConstructorElement anchor = null;
      int anchorLifetime = 1;
      // Ensure class parameters are considered in scope when following
      // redirecting factories.
      var classScope = new ClassScope(scope.loader, scope.currentLibrary);
      while (true) {
        if (!element.isConst) {
          return scope
  