Move the class TypeTestProvider from the test directory into the lib directory so that other tools can use the class and other tools such as the ElementFactory which require a TypeProvider

R=scheglov@google.com

Review URL: https://codereview.chromium.org//853553005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42855 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart b/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart
new file mode 100644
index 0000000..a176816
--- /dev/null
+++ b/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart
@@ -0,0 +1,482 @@
+// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This code was auto-generated, is not intended to be edited, and is subject to
+// significant change. Please see the README file for more information.
+
+library engine.testing.test_type_provider;
+
+import 'package:analyzer/src/generated/element.dart';
+import 'package:analyzer/src/generated/resolver.dart';
+import 'package:analyzer/src/generated/testing/element_factory.dart';
+
+/**
+ * Instances of the class `TestTypeProvider` implement a type provider that can be used by
+ * tests without creating the element model for the core library.
+ */
+class TestTypeProvider implements TypeProvider {
+  /**
+   * The type representing the built-in type 'bool'.
+   */
+  InterfaceType _boolType;
+
+  /**
+   * The type representing the type 'bottom'.
+   */
+  DartType _bottomType;
+
+  /**
+   * The type representing the built-in type 'double'.
+   */
+  InterfaceType _doubleType;
+
+  /**
+   * The type representing the built-in type 'deprecated'.
+   */
+  InterfaceType _deprecatedType;
+
+  /**
+   * The type representing the built-in type 'dynamic'.
+   */
+  DartType _dynamicType;
+
+  /**
+   * The type representing the built-in type 'Function'.
+   */
+  InterfaceType _functionType;
+
+  /**
+   * The type representing the built-in type 'int'.
+   */
+  InterfaceType _intType;
+
+  /**
+   * The type representing the built-in type 'Iterable'.
+   */
+  InterfaceType _iterableType;
+
+  /**
+   * The type representing the built-in type 'Iterator'.
+   */
+  InterfaceType _iteratorType;
+
+  /**
+   * The type representing the built-in type 'List'.
+   */
+  InterfaceType _listType;
+
+  /**
+   * The type representing the built-in type 'Map'.
+   */
+  InterfaceType _mapType;
+
+  /**
+   * The type representing the built-in type 'Null'.
+   */
+  InterfaceType _nullType;
+
+  /**
+   * The type representing the built-in type 'num'.
+   */
+  InterfaceType _numType;
+
+  /**
+   * The type representing the built-in type 'Object'.
+   */
+  InterfaceType _objectType;
+
+  /**
+   * The type representing the built-in type 'StackTrace'.
+   */
+  InterfaceType _stackTraceType;
+
+  /**
+   * The type representing the built-in type 'String'.
+   */
+  InterfaceType _stringType;
+
+  /**
+   * The type representing the built-in type 'Symbol'.
+   */
+  InterfaceType _symbolType;
+
+  /**
+   * The type representing the built-in type 'Type'.
+   */
+  InterfaceType _typeType;
+
+  /**
+   * The type representing typenames that can't be resolved.
+   */
+  DartType _undefinedType;
+
+  @override
+  InterfaceType get boolType {
+    if (_boolType == null) {
+      ClassElementImpl boolElement = ElementFactory.classElement2("bool");
+      _boolType = boolElement.type;
+      ConstructorElementImpl fromEnvironment =
+          ElementFactory.constructorElement(boolElement, "fromEnvironment", true);
+      fromEnvironment.parameters = <ParameterElement>[
+          ElementFactory.requiredParameter2("name", stringType),
+          ElementFactory.namedParameter2("defaultValue", _boolType)];
+      fromEnvironment.factory = true;
+      boolElement.constructors = <ConstructorElement>[fromEnvironment];
+    }
+    return _boolType;
+  }
+
+  @override
+  DartType get bottomType {
+    if (_bottomType == null) {
+      _bottomType = BottomTypeImpl.instance;
+    }
+    return _bottomType;
+  }
+
+  @override
+  InterfaceType get deprecatedType {
+    if (_deprecatedType == null) {
+      ClassElementImpl deprecatedElement =
+          ElementFactory.classElement2("Deprecated");
+      deprecatedElement.constructors = <ConstructorElement>[
+          ElementFactory.constructorElement(deprecatedElement, null, true, [stringType])];
+      _deprecatedType = deprecatedElement.type;
+    }
+    return _deprecatedType;
+  }
+
+  @override
+  InterfaceType get doubleType {
+    if (_doubleType == null) {
+      _initializeNumericTypes();
+    }
+    return _doubleType;
+  }
+
+  @override
+  DartType get dynamicType {
+    if (_dynamicType == null) {
+      _dynamicType = DynamicTypeImpl.instance;
+    }
+    return _dynamicType;
+  }
+
+  @override
+  InterfaceType get functionType {
+    if (_functionType == null) {
+      _functionType = ElementFactory.classElement2("Function").type;
+    }
+    return _functionType;
+  }
+
+  @override
+  InterfaceType get intType {
+    if (_intType == null) {
+      _initializeNumericTypes();
+    }
+    return _intType;
+  }
+
+  InterfaceType get iterableType {
+    if (_iterableType == null) {
+      ClassElementImpl iterableElement =
+          ElementFactory.classElement2("Iterable", ["E"]);
+      _iterableType = iterableElement.type;
+      DartType eType = iterableElement.typeParameters[0].type;
+      iterableElement.accessors = <PropertyAccessorElement>[
+          ElementFactory.getterElement(
+              "iterator",
+              false,
+              iteratorType.substitute4(<DartType>[eType])),
+          ElementFactory.getterElement("last", false, eType)];
+      _propagateTypeArguments(iterableElement);
+    }
+    return _iterableType;
+  }
+
+  InterfaceType get iteratorType {
+    if (_iteratorType == null) {
+      ClassElementImpl iteratorElement =
+          ElementFactory.classElement2("Iterator", ["E"]);
+      _iteratorType = iteratorElement.type;
+      DartType eType = iteratorElement.typeParameters[0].type;
+      iteratorElement.accessors = <PropertyAccessorElement>[
+          ElementFactory.getterElement("current", false, eType)];
+      _propagateTypeArguments(iteratorElement);
+    }
+    return _iteratorType;
+  }
+
+  @override
+  InterfaceType get listType {
+    if (_listType == null) {
+      ClassElementImpl listElement =
+          ElementFactory.classElement2("List", ["E"]);
+      listElement.constructors =
+          <ConstructorElement>[ElementFactory.constructorElement2(listElement, null)];
+      _listType = listElement.type;
+      DartType eType = listElement.typeParameters[0].type;
+      InterfaceType iterableType =
+          this.iterableType.substitute4(<DartType>[eType]);
+      listElement.interfaces = <InterfaceType>[iterableType];
+      listElement.accessors = <PropertyAccessorElement>[
+          ElementFactory.getterElement("length", false, intType)];
+      listElement.methods = <MethodElement>[
+          ElementFactory.methodElement("[]", eType, [intType]),
+          ElementFactory.methodElement("[]=", VoidTypeImpl.instance, [intType, eType]),
+          ElementFactory.methodElement("add", VoidTypeImpl.instance, [eType])];
+      _propagateTypeArguments(listElement);
+    }
+    return _listType;
+  }
+
+  @override
+  InterfaceType get mapType {
+    if (_mapType == null) {
+      ClassElementImpl mapElement =
+          ElementFactory.classElement2("Map", ["K", "V"]);
+      _mapType = mapElement.type;
+      DartType kType = mapElement.typeParameters[0].type;
+      DartType vType = mapElement.typeParameters[1].type;
+      mapElement.accessors = <PropertyAccessorElement>[
+          ElementFactory.getterElement("length", false, intType)];
+      mapElement.methods = <MethodElement>[
+          ElementFactory.methodElement("[]", vType, [objectType]),
+          ElementFactory.methodElement("[]=", VoidTypeImpl.instance, [kType, vType])];
+      _propagateTypeArguments(mapElement);
+    }
+    return _mapType;
+  }
+
+  @override
+  InterfaceType get nullType {
+    if (_nullType == null) {
+      _nullType = ElementFactory.classElement2("Null").type;
+    }
+    return _nullType;
+  }
+
+  @override
+  InterfaceType get numType {
+    if (_numType == null) {
+      _initializeNumericTypes();
+    }
+    return _numType;
+  }
+
+  @override
+  InterfaceType get objectType {
+    if (_objectType == null) {
+      ClassElementImpl objectElement = ElementFactory.object;
+      _objectType = objectElement.type;
+      objectElement.constructors =
+          <ConstructorElement>[ElementFactory.constructorElement2(objectElement, null)];
+      objectElement.methods = <MethodElement>[
+          ElementFactory.methodElement("toString", stringType),
+          ElementFactory.methodElement("==", boolType, [_objectType]),
+          ElementFactory.methodElement("noSuchMethod", dynamicType, [dynamicType])];
+      objectElement.accessors = <PropertyAccessorElement>[
+          ElementFactory.getterElement("hashCode", false, intType),
+          ElementFactory.getterElement("runtimeType", false, typeType)];
+    }
+    return _objectType;
+  }
+
+  @override
+  InterfaceType get stackTraceType {
+    if (_stackTraceType == null) {
+      _stackTraceType = ElementFactory.classElement2("StackTrace").type;
+    }
+    return _stackTraceType;
+  }
+
+  @override
+  InterfaceType get stringType {
+    if (_stringType == null) {
+      _stringType = ElementFactory.classElement2("String").type;
+      ClassElementImpl stringElement = _stringType.element as ClassElementImpl;
+      stringElement.accessors = <PropertyAccessorElement>[
+          ElementFactory.getterElement("isEmpty", false, boolType),
+          ElementFactory.getterElement("length", false, intType),
+          ElementFactory.getterElement(
+              "codeUnits",
+              false,
+              listType.substitute4(<DartType>[intType]))];
+      stringElement.methods = <MethodElement>[
+          ElementFactory.methodElement("+", _stringType, [_stringType]),
+          ElementFactory.methodElement("toLowerCase", _stringType),
+          ElementFactory.methodElement("toUpperCase", _stringType)];
+      ConstructorElementImpl fromEnvironment =
+          ElementFactory.constructorElement(stringElement, "fromEnvironment", true);
+      fromEnvironment.parameters = <ParameterElement>[
+          ElementFactory.requiredParameter2("name", stringType),
+          ElementFactory.namedParameter2("defaultValue", _stringType)];
+      fromEnvironment.factory = true;
+      stringElement.constructors = <ConstructorElement>[fromEnvironment];
+    }
+    return _stringType;
+  }
+
+  @override
+  InterfaceType get symbolType {
+    if (_symbolType == null) {
+      ClassElementImpl symbolClass = ElementFactory.classElement2("Symbol");
+      ConstructorElementImpl constructor =
+          ElementFactory.constructorElement(symbolClass, null, true, [stringType]);
+      constructor.factory = true;
+      symbolClass.constructors = <ConstructorElement>[constructor];
+      _symbolType = symbolClass.type;
+    }
+    return _symbolType;
+  }
+
+  @override
+  InterfaceType get typeType {
+    if (_typeType == null) {
+      _typeType = ElementFactory.classElement2("Type").type;
+    }
+    return _typeType;
+  }
+
+  @override
+  DartType get undefinedType {
+    if (_undefinedType == null) {
+      _undefinedType = UndefinedTypeImpl.instance;
+    }
+    return _undefinedType;
+  }
+
+  /**
+   * Initialize the numeric types. They are created as a group so that we can (a) create the right
+   * hierarchy and (b) add members to them.
+   */
+  void _initializeNumericTypes() {
+    //
+    // Create the type hierarchy.
+    //
+    ClassElementImpl numElement = ElementFactory.classElement2("num");
+    _numType = numElement.type;
+    ClassElementImpl intElement = ElementFactory.classElement("int", _numType);
+    _intType = intElement.type;
+    ClassElementImpl doubleElement =
+        ElementFactory.classElement("double", _numType);
+    _doubleType = doubleElement.type;
+    //
+    // Force the referenced types to be cached.
+    //
+    objectType;
+    boolType;
+    stringType;
+    //
+    // Add the methods.
+    //
+    numElement.methods = <MethodElement>[
+        ElementFactory.methodElement("+", _numType, [_numType]),
+        ElementFactory.methodElement("-", _numType, [_numType]),
+        ElementFactory.methodElement("*", _numType, [_numType]),
+        ElementFactory.methodElement("%", _numType, [_numType]),
+        ElementFactory.methodElement("/", _doubleType, [_numType]),
+        ElementFactory.methodElement("~/", _numType, [_numType]),
+        ElementFactory.methodElement("-", _numType),
+        ElementFactory.methodElement("remainder", _numType, [_numType]),
+        ElementFactory.methodElement("<", _boolType, [_numType]),
+        ElementFactory.methodElement("<=", _boolType, [_numType]),
+        ElementFactory.methodElement(">", _boolType, [_numType]),
+        ElementFactory.methodElement(">=", _boolType, [_numType]),
+        ElementFactory.methodElement("==", _boolType, [_objectType]),
+        ElementFactory.methodElement("isNaN", _boolType),
+        ElementFactory.methodElement("isNegative", _boolType),
+        ElementFactory.methodElement("isInfinite", _boolType),
+        ElementFactory.methodElement("abs", _numType),
+        ElementFactory.methodElement("floor", _numType),
+        ElementFactory.methodElement("ceil", _numType),
+        ElementFactory.methodElement("round", _numType),
+        ElementFactory.methodElement("truncate", _numType),
+        ElementFactory.methodElement("toInt", _intType),
+        ElementFactory.methodElement("toDouble", _doubleType),
+        ElementFactory.methodElement("toStringAsFixed", _stringType, [_intType]),
+        ElementFactory.methodElement("toStringAsExponential", _stringType, [_intType]),
+        ElementFactory.methodElement("toStringAsPrecision", _stringType, [_intType]),
+        ElementFactory.methodElement("toRadixString", _stringType, [_intType])];
+    intElement.methods = <MethodElement>[
+        ElementFactory.methodElement("&", _intType, [_intType]),
+        ElementFactory.methodElement("|", _intType, [_intType]),
+        ElementFactory.methodElement("^", _intType, [_intType]),
+        ElementFactory.methodElement("~", _intType),
+        ElementFactory.methodElement("<<", _intType, [_intType]),
+        ElementFactory.methodElement(">>", _intType, [_intType]),
+        ElementFactory.methodElement("-", _intType),
+        ElementFactory.methodElement("abs", _intType),
+        ElementFactory.methodElement("round", _intType),
+        ElementFactory.methodElement("floor", _intType),
+        ElementFactory.methodElement("ceil", _intType),
+        ElementFactory.methodElement("truncate", _intType),
+        ElementFactory.methodElement("toString", _stringType)];
+    ConstructorElementImpl fromEnvironment =
+        ElementFactory.constructorElement(intElement, "fromEnvironment", true);
+    fromEnvironment.parameters = <ParameterElement>[
+        ElementFactory.requiredParameter2("name", stringType),
+        ElementFactory.namedParameter2("defaultValue", _intType)];
+    fromEnvironment.factory = true;
+    intElement.constructors = <ConstructorElement>[fromEnvironment];
+    List<FieldElement> fields = <FieldElement>[
+        ElementFactory.fieldElement("NAN", true, false, true, _doubleType),
+        ElementFactory.fieldElement("INFINITY", true, false, true, _doubleType),
+        ElementFactory.fieldElement(
+            "NEGATIVE_INFINITY",
+            true,
+            false,
+            true,
+            _doubleType),
+        ElementFactory.fieldElement("MIN_POSITIVE", true, false, true, _doubleType),
+        ElementFactory.fieldElement("MAX_FINITE", true, false, true, _doubleType)];
+    doubleElement.fields = fields;
+    int fieldCount = fields.length;
+    List<PropertyAccessorElement> accessors =
+        new List<PropertyAccessorElement>(fieldCount);
+    for (int i = 0; i < fieldCount; i++) {
+      accessors[i] = fields[i].getter;
+    }
+    doubleElement.accessors = accessors;
+    doubleElement.methods = <MethodElement>[
+        ElementFactory.methodElement("remainder", _doubleType, [_numType]),
+        ElementFactory.methodElement("+", _doubleType, [_numType]),
+        ElementFactory.methodElement("-", _doubleType, [_numType]),
+        ElementFactory.methodElement("*", _doubleType, [_numType]),
+        ElementFactory.methodElement("%", _doubleType, [_numType]),
+        ElementFactory.methodElement("/", _doubleType, [_numType]),
+        ElementFactory.methodElement("~/", _doubleType, [_numType]),
+        ElementFactory.methodElement("-", _doubleType),
+        ElementFactory.methodElement("abs", _doubleType),
+        ElementFactory.methodElement("round", _doubleType),
+        ElementFactory.methodElement("floor", _doubleType),
+        ElementFactory.methodElement("ceil", _doubleType),
+        ElementFactory.methodElement("truncate", _doubleType),
+        ElementFactory.methodElement("toString", _stringType)];
+  }
+
+  /**
+   * Given a class element representing a class with type parameters, propagate those type
+   * parameters to all of the accessors, methods and constructors defined for the class.
+   *
+   * @param classElement the element representing the class with type parameters
+   */
+  void _propagateTypeArguments(ClassElementImpl classElement) {
+    List<DartType> typeArguments =
+        TypeParameterTypeImpl.getTypes(classElement.typeParameters);
+    for (PropertyAccessorElement accessor in classElement.accessors) {
+      FunctionTypeImpl functionType = accessor.type as FunctionTypeImpl;
+      functionType.typeArguments = typeArguments;
+    }
+    for (MethodElement method in classElement.methods) {
+      FunctionTypeImpl functionType = method.type as FunctionTypeImpl;
+      functionType.typeArguments = typeArguments;
+    }
+    for (ConstructorElement constructor in classElement.constructors) {
+      FunctionTypeImpl functionType = constructor.type as FunctionTypeImpl;
+      functionType.typeArguments = typeArguments;
+    }
+  }
+}
diff --git a/pkg/analyzer/test/generated/all_the_rest_test.dart b/pkg/analyzer/test/generated/all_the_rest_test.dart
index 3d645af..5852a91 100644
--- a/pkg/analyzer/test/generated/all_the_rest_test.dart
+++ b/pkg/analyzer/test/generated/all_the_rest_test.dart
@@ -28,6 +28,7 @@
 import 'package:analyzer/src/generated/testing/ast_factory.dart';
 import 'package:analyzer/src/generated/testing/element_factory.dart';
 import 'package:analyzer/src/generated/testing/html_factory.dart';
+import 'package:analyzer/src/generated/testing/test_type_provider.dart';
 import 'package:analyzer/src/generated/utilities_collection.dart';
 import 'package:analyzer/src/generated/utilities_dart.dart';
 import 'package:unittest/unittest.dart';
diff --git a/pkg/analyzer/test/generated/element_test.dart b/pkg/analyzer/test/generated/element_test.dart
index ff40d69..399d8c4 100644
--- a/pkg/analyzer/test/generated/element_test.dart
+++ b/pkg/analyzer/test/generated/element_test.dart
@@ -15,6 +15,7 @@
 import 'package:analyzer/src/generated/source_io.dart';
 import 'package:analyzer/src/generated/testing/ast_factory.dart';
 import 'package:analyzer/src/generated/testing/element_factory.dart';
+import 'package:analyzer/src/generated/testing/test_type_provider.dart';
 import 'package:unittest/unittest.dart';
 
 import '../reflective_tests.dart';
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 823e527..380829c 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -23,6 +23,7 @@
 import 'package:analyzer/src/generated/source_io.dart';
 import 'package:analyzer/src/generated/static_type_analyzer.dart';
 import 'package:analyzer/src/generated/testing/ast_factory.dart';
+import 'package:analyzer/src/generated/testing/test_type_provider.dart';
 import 'package:analyzer/src/generated/testing/element_factory.dart';
 import 'package:analyzer/src/generated/utilities_dart.dart';
 import 'package:unittest/unittest.dart';
@@ -11115,475 +11116,7 @@
   }
 }
 
-/**
- * Instances of the class `TestTypeProvider` implement a type provider that can be used by
- * tests without creating the element model for the core library.
- */
-class TestTypeProvider implements TypeProvider {
-  /**
-   * The type representing the built-in type 'bool'.
-   */
-  InterfaceType _boolType;
 
-  /**
-   * The type representing the type 'bottom'.
-   */
-  DartType _bottomType;
-
-  /**
-   * The type representing the built-in type 'double'.
-   */
-  InterfaceType _doubleType;
-
-  /**
-   * The type representing the built-in type 'deprecated'.
-   */
-  InterfaceType _deprecatedType;
-
-  /**
-   * The type representing the built-in type 'dynamic'.
-   */
-  DartType _dynamicType;
-
-  /**
-   * The type representing the built-in type 'Function'.
-   */
-  InterfaceType _functionType;
-
-  /**
-   * The type representing the built-in type 'int'.
-   */
-  InterfaceType _intType;
-
-  /**
-   * The type representing the built-in type 'Iterable'.
-   */
-  InterfaceType _iterableType;
-
-  /**
-   * The type representing the built-in type 'Iterator'.
-   */
-  InterfaceType _iteratorType;
-
-  /**
-   * The type representing the built-in type 'List'.
-   */
-  InterfaceType _listType;
-
-  /**
-   * The type representing the built-in type 'Map'.
-   */
-  InterfaceType _mapType;
-
-  /**
-   * The type representing the built-in type 'Null'.
-   */
-  InterfaceType _nullType;
-
-  /**
-   * The type representing the built-in type 'num'.
-   */
-  InterfaceType _numType;
-
-  /**
-   * The type representing the built-in type 'Object'.
-   */
-  InterfaceType _objectType;
-
-  /**
-   * The type representing the built-in type 'StackTrace'.
-   */
-  InterfaceType _stackTraceType;
-
-  /**
-   * The type representing the built-in type 'String'.
-   */
-  InterfaceType _stringType;
-
-  /**
-   * The type representing the built-in type 'Symbol'.
-   */
-  InterfaceType _symbolType;
-
-  /**
-   * The type representing the built-in type 'Type'.
-   */
-  InterfaceType _typeType;
-
-  /**
-   * The type representing typenames that can't be resolved.
-   */
-  DartType _undefinedType;
-
-  @override
-  InterfaceType get boolType {
-    if (_boolType == null) {
-      ClassElementImpl boolElement = ElementFactory.classElement2("bool");
-      _boolType = boolElement.type;
-      ConstructorElementImpl fromEnvironment =
-          ElementFactory.constructorElement(boolElement, "fromEnvironment", true);
-      fromEnvironment.parameters = <ParameterElement>[
-          ElementFactory.requiredParameter2("name", stringType),
-          ElementFactory.namedParameter2("defaultValue", _boolType)];
-      fromEnvironment.factory = true;
-      boolElement.constructors = <ConstructorElement>[fromEnvironment];
-    }
-    return _boolType;
-  }
-
-  @override
-  DartType get bottomType {
-    if (_bottomType == null) {
-      _bottomType = BottomTypeImpl.instance;
-    }
-    return _bottomType;
-  }
-
-  @override
-  InterfaceType get deprecatedType {
-    if (_deprecatedType == null) {
-      ClassElementImpl deprecatedElement =
-          ElementFactory.classElement2("Deprecated");
-      deprecatedElement.constructors = <ConstructorElement>[
-          ElementFactory.constructorElement(deprecatedElement, null, true, [stringType])];
-      _deprecatedType = deprecatedElement.type;
-    }
-    return _deprecatedType;
-  }
-
-  @override
-  InterfaceType get doubleType {
-    if (_doubleType == null) {
-      _initializeNumericTypes();
-    }
-    return _doubleType;
-  }
-
-  @override
-  DartType get dynamicType {
-    if (_dynamicType == null) {
-      _dynamicType = DynamicTypeImpl.instance;
-    }
-    return _dynamicType;
-  }
-
-  @override
-  InterfaceType get functionType {
-    if (_functionType == null) {
-      _functionType = ElementFactory.classElement2("Function").type;
-    }
-    return _functionType;
-  }
-
-  @override
-  InterfaceType get intType {
-    if (_intType == null) {
-      _initializeNumericTypes();
-    }
-    return _intType;
-  }
-
-  InterfaceType get iterableType {
-    if (_iterableType == null) {
-      ClassElementImpl iterableElement =
-          ElementFactory.classElement2("Iterable", ["E"]);
-      _iterableType = iterableElement.type;
-      DartType eType = iterableElement.typeParameters[0].type;
-      iterableElement.accessors = <PropertyAccessorElement>[
-          ElementFactory.getterElement(
-              "iterator",
-              false,
-              iteratorType.substitute4(<DartType>[eType])),
-          ElementFactory.getterElement("last", false, eType)];
-      _propagateTypeArguments(iterableElement);
-    }
-    return _iterableType;
-  }
-
-  InterfaceType get iteratorType {
-    if (_iteratorType == null) {
-      ClassElementImpl iteratorElement =
-          ElementFactory.classElement2("Iterator", ["E"]);
-      _iteratorType = iteratorElement.type;
-      DartType eType = iteratorElement.typeParameters[0].type;
-      iteratorElement.accessors = <PropertyAccessorElement>[
-          ElementFactory.getterElement("current", false, eType)];
-      _propagateTypeArguments(iteratorElement);
-    }
-    return _iteratorType;
-  }
-
-  @override
-  InterfaceType get listType {
-    if (_listType == null) {
-      ClassElementImpl listElement =
-          ElementFactory.classElement2("List", ["E"]);
-      listElement.constructors =
-          <ConstructorElement>[ElementFactory.constructorElement2(listElement, null)];
-      _listType = listElement.type;
-      DartType eType = listElement.typeParameters[0].type;
-      InterfaceType iterableType =
-          this.iterableType.substitute4(<DartType>[eType]);
-      listElement.interfaces = <InterfaceType>[iterableType];
-      listElement.accessors = <PropertyAccessorElement>[
-          ElementFactory.getterElement("length", false, intType)];
-      listElement.methods = <MethodElement>[
-          ElementFactory.methodElement("[]", eType, [intType]),
-          ElementFactory.methodElement("[]=", VoidTypeImpl.instance, [intType, eType]),
-          ElementFactory.methodElement("add", VoidTypeImpl.instance, [eType])];
-      _propagateTypeArguments(listElement);
-    }
-    return _listType;
-  }
-
-  @override
-  InterfaceType get mapType {
-    if (_mapType == null) {
-      ClassElementImpl mapElement =
-          ElementFactory.classElement2("Map", ["K", "V"]);
-      _mapType = mapElement.type;
-      DartType kType = mapElement.typeParameters[0].type;
-      DartType vType = mapElement.typeParameters[1].type;
-      mapElement.accessors = <PropertyAccessorElement>[
-          ElementFactory.getterElement("length", false, intType)];
-      mapElement.methods = <MethodElement>[
-          ElementFactory.methodElement("[]", vType, [objectType]),
-          ElementFactory.methodElement("[]=", VoidTypeImpl.instance, [kType, vType])];
-      _propagateTypeArguments(mapElement);
-    }
-    return _mapType;
-  }
-
-  @override
-  InterfaceType get nullType {
-    if (_nullType == null) {
-      _nullType = ElementFactory.classElement2("Null").type;
-    }
-    return _nullType;
-  }
-
-  @override
-  InterfaceType get numType {
-    if (_numType == null) {
-      _initializeNumericTypes();
-    }
-    return _numType;
-  }
-
-  @override
-  InterfaceType get objectType {
-    if (_objectType == null) {
-      ClassElementImpl objectElement = ElementFactory.object;
-      _objectType = objectElement.type;
-      objectElement.constructors =
-          <ConstructorElement>[ElementFactory.constructorElement2(objectElement, null)];
-      objectElement.methods = <MethodElement>[
-          ElementFactory.methodElement("toString", stringType),
-          ElementFactory.methodElement("==", boolType, [_objectType]),
-          ElementFactory.methodElement("noSuchMethod", dynamicType, [dynamicType])];
-      objectElement.accessors = <PropertyAccessorElement>[
-          ElementFactory.getterElement("hashCode", false, intType),
-          ElementFactory.getterElement("runtimeType", false, typeType)];
-    }
-    return _objectType;
-  }
-
-  @override
-  InterfaceType get stackTraceType {
-    if (_stackTraceType == null) {
-      _stackTraceType = ElementFactory.classElement2("StackTrace").type;
-    }
-    return _stackTraceType;
-  }
-
-  @override
-  InterfaceType get stringType {
-    if (_stringType == null) {
-      _stringType = ElementFactory.classElement2("String").type;
-      ClassElementImpl stringElement = _stringType.element as ClassElementImpl;
-      stringElement.accessors = <PropertyAccessorElement>[
-          ElementFactory.getterElement("isEmpty", false, boolType),
-          ElementFactory.getterElement("length", false, intType),
-          ElementFactory.getterElement(
-              "codeUnits",
-              false,
-              listType.substitute4(<DartType>[intType]))];
-      stringElement.methods = <MethodElement>[
-          ElementFactory.methodElement("+", _stringType, [_stringType]),
-          ElementFactory.methodElement("toLowerCase", _stringType),
-          ElementFactory.methodElement("toUpperCase", _stringType)];
-      ConstructorElementImpl fromEnvironment =
-          ElementFactory.constructorElement(stringElement, "fromEnvironment", true);
-      fromEnvironment.parameters = <ParameterElement>[
-          ElementFactory.requiredParameter2("name", stringType),
-          ElementFactory.namedParameter2("defaultValue", _stringType)];
-      fromEnvironment.factory = true;
-      stringElement.constructors = <ConstructorElement>[fromEnvironment];
-    }
-    return _stringType;
-  }
-
-  @override
-  InterfaceType get symbolType {
-    if (_symbolType == null) {
-      ClassElementImpl symbolClass = ElementFactory.classElement2("Symbol");
-      ConstructorElementImpl constructor =
-          ElementFactory.constructorElement(symbolClass, null, true, [stringType]);
-      constructor.factory = true;
-      symbolClass.constructors = <ConstructorElement>[constructor];
-      _symbolType = symbolClass.type;
-    }
-    return _symbolType;
-  }
-
-  @override
-  InterfaceType get typeType {
-    if (_typeType == null) {
-      _typeType = ElementFactory.classElement2("Type").type;
-    }
-    return _typeType;
-  }
-
-  @override
-  DartType get undefinedType {
-    if (_undefinedType == null) {
-      _undefinedType = UndefinedTypeImpl.instance;
-    }
-    return _undefinedType;
-  }
-
-  /**
-   * Initialize the numeric types. They are created as a group so that we can (a) create the right
-   * hierarchy and (b) add members to them.
-   */
-  void _initializeNumericTypes() {
-    //
-    // Create the type hierarchy.
-    //
-    ClassElementImpl numElement = ElementFactory.classElement2("num");
-    _numType = numElement.type;
-    ClassElementImpl intElement = ElementFactory.classElement("int", _numType);
-    _intType = intElement.type;
-    ClassElementImpl doubleElement =
-        ElementFactory.classElement("double", _numType);
-    _doubleType = doubleElement.type;
-    //
-    // Force the referenced types to be cached.
-    //
-    objectType;
-    boolType;
-    stringType;
-    //
-    // Add the methods.
-    //
-    numElement.methods = <MethodElement>[
-        ElementFactory.methodElement("+", _numType, [_numType]),
-        ElementFactory.methodElement("-", _numType, [_numType]),
-        ElementFactory.methodElement("*", _numType, [_numType]),
-        ElementFactory.methodElement("%", _numType, [_numType]),
-        ElementFactory.methodElement("/", _doubleType, [_numType]),
-        ElementFactory.methodElement("~/", _numType, [_numType]),
-        ElementFactory.methodElement("-", _numType),
-        ElementFactory.methodElement("remainder", _numType, [_numType]),
-        ElementFactory.methodElement("<", _boolType, [_numType]),
-        ElementFactory.methodElement("<=", _boolType, [_numType]),
-        ElementFactory.methodElement(">", _boolType, [_numType]),
-        ElementFactory.methodElement(">=", _boolType, [_numType]),
-        ElementFactory.methodElement("==", _boolType, [_objectType]),
-        ElementFactory.methodElement("isNaN", _boolType),
-        ElementFactory.methodElement("isNegative", _boolType),
-        ElementFactory.methodElement("isInfinite", _boolType),
-        ElementFactory.methodElement("abs", _numType),
-        ElementFactory.methodElement("floor", _numType),
-        ElementFactory.methodElement("ceil", _numType),
-        ElementFactory.methodElement("round", _numType),
-        ElementFactory.methodElement("truncate", _numType),
-        ElementFactory.methodElement("toInt", _intType),
-        ElementFactory.methodElement("toDouble", _doubleType),
-        ElementFactory.methodElement("toStringAsFixed", _stringType, [_intType]),
-        ElementFactory.methodElement("toStringAsExponential", _stringType, [_intType]),
-        ElementFactory.methodElement("toStringAsPrecision", _stringType, [_intType]),
-        ElementFactory.methodElement("toRadixString", _stringType, [_intType])];
-    intElement.methods = <MethodElement>[
-        ElementFactory.methodElement("&", _intType, [_intType]),
-        ElementFactory.methodElement("|", _intType, [_intType]),
-        ElementFactory.methodElement("^", _intType, [_intType]),
-        ElementFactory.methodElement("~", _intType),
-        ElementFactory.methodElement("<<", _intType, [_intType]),
-        ElementFactory.methodElement(">>", _intType, [_intType]),
-        ElementFactory.methodElement("-", _intType),
-        ElementFactory.methodElement("abs", _intType),
-        ElementFactory.methodElement("round", _intType),
-        ElementFactory.methodElement("floor", _intType),
-        ElementFactory.methodElement("ceil", _intType),
-        ElementFactory.methodElement("truncate", _intType),
-        ElementFactory.methodElement("toString", _stringType)];
-    ConstructorElementImpl fromEnvironment =
-        ElementFactory.constructorElement(intElement, "fromEnvironment", true);
-    fromEnvironment.parameters = <ParameterElement>[
-        ElementFactory.requiredParameter2("name", stringType),
-        ElementFactory.namedParameter2("defaultValue", _intType)];
-    fromEnvironment.factory = true;
-    intElement.constructors = <ConstructorElement>[fromEnvironment];
-    List<FieldElement> fields = <FieldElement>[
-        ElementFactory.fieldElement("NAN", true, false, true, _doubleType),
-        ElementFactory.fieldElement("INFINITY", true, false, true, _doubleType),
-        ElementFactory.fieldElement(
-            "NEGATIVE_INFINITY",
-            true,
-            false,
-            true,
-            _doubleType),
-        ElementFactory.fieldElement("MIN_POSITIVE", true, false, true, _doubleType),
-        ElementFactory.fieldElement("MAX_FINITE", true, false, true, _doubleType)];
-    doubleElement.fields = fields;
-    int fieldCount = fields.length;
-    List<PropertyAccessorElement> accessors =
-        new List<PropertyAccessorElement>(fieldCount);
-    for (int i = 0; i < fieldCount; i++) {
-      accessors[i] = fields[i].getter;
-    }
-    doubleElement.accessors = accessors;
-    doubleElement.methods = <MethodElement>[
-        ElementFactory.methodElement("remainder", _doubleType, [_numType]),
-        ElementFactory.methodElement("+", _doubleType, [_numType]),
-        ElementFactory.methodElement("-", _doubleType, [_numType]),
-        ElementFactory.methodElement("*", _doubleType, [_numType]),
-        ElementFactory.methodElement("%", _doubleType, [_numType]),
-        ElementFactory.methodElement("/", _doubleType, [_numType]),
-        ElementFactory.methodElement("~/", _doubleType, [_numType]),
-        ElementFactory.methodElement("-", _doubleType),
-        ElementFactory.methodElement("abs", _doubleType),
-        ElementFactory.methodElement("round", _doubleType),
-        ElementFactory.methodElement("floor", _doubleType),
-        ElementFactory.methodElement("ceil", _doubleType),
-        ElementFactory.methodElement("truncate", _doubleType),
-        ElementFactory.methodElement("toString", _stringType)];
-  }
-
-  /**
-   * Given a class element representing a class with type parameters, propagate those type
-   * parameters to all of the accessors, methods and constructors defined for the class.
-   *
-   * @param classElement the element representing the class with type parameters
-   */
-  void _propagateTypeArguments(ClassElementImpl classElement) {
-    List<DartType> typeArguments =
-        TypeParameterTypeImpl.getTypes(classElement.typeParameters);
-    for (PropertyAccessorElement accessor in classElement.accessors) {
-      FunctionTypeImpl functionType = accessor.type as FunctionTypeImpl;
-      functionType.typeArguments = typeArguments;
-    }
-    for (MethodElement method in classElement.methods) {
-      FunctionTypeImpl functionType = method.type as FunctionTypeImpl;
-      functionType.typeArguments = typeArguments;
-    }
-    for (ConstructorElement constructor in classElement.constructors) {
-      FunctionTypeImpl functionType = constructor.type as FunctionTypeImpl;
-      functionType.typeArguments = typeArguments;
-    }
-  }
-}
 
 @reflectiveTest
 class TypeOverrideManagerTest extends EngineTestCase {