Split TypeUseGenerator

This prepares the generator to be implemented by the analyzer.

Change-Id: I89bf0ca368308e98846c8ea8b7c765398c48ecf7
Reviewed-on: https://dart-review.googlesource.com/56490
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
diff --git a/pkg/analyzer/lib/src/fasta/ast_building_factory.dart b/pkg/analyzer/lib/src/fasta/ast_building_factory.dart
index ec0747d..931b75c 100644
--- a/pkg/analyzer/lib/src/fasta/ast_building_factory.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_building_factory.dart
@@ -598,6 +598,18 @@
           tryKeyword, body, catchClauses, finallyKeyword, finallyBlock);
 
   @override
+  Generator<Expression, Statement, _Arguments> typeUseGenerator(
+      ExpressionGeneratorHelper<Expression, Statement, _Arguments> helper,
+      Token token,
+      PrefixBuilder prefix,
+      int declarationReferenceOffset,
+      TypeDeclarationBuilder declaration,
+      String plainNameForRead) {
+    // TODO(brianwilkerson) Implement this.
+    throw new UnimplementedError();
+  }
+
+  @override
   VariableDeclarationStatement variablesDeclaration(
       List<VariableDeclaration> declarations, Uri uri) {
     // TODO(brianwilkerson) Implement this.
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 32c48f1..a5d63b8 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -89,7 +89,7 @@
         SuperIndexedAccessGenerator,
         ThisAccessGenerator,
         ThisPropertyAccessGenerator,
-        TypeDeclarationAccessGenerator,
+        TypeUseGenerator,
         UnresolvedNameGenerator,
         VariableUseGenerator,
         buildIsNull;
@@ -1387,9 +1387,8 @@
         deprecated_addCompileTimeError(
             charOffset, "Not a constant expression.");
       }
-      // TODO(ahe): Restore type: TypeDeclarationAccessGenerator.
-      Generator<dynamic, dynamic, dynamic> generator =
-          new TypeDeclarationAccessGenerator(
+      TypeUseGenerator<Expression, Statement, Arguments> generator =
+          new TypeUseGenerator<Expression, Statement, Arguments>(
               this, token, prefix, charOffset, builder, name);
       return (prefix?.deferred == true)
           ? new DeferredAccessGenerator<Expression, Statement, Arguments>(
@@ -2566,7 +2565,7 @@
             prefix.exportScope, identifier.name, identifier.token,
             isQualified: true, prefix: prefix);
         identifier = null;
-      } else if (prefix is TypeDeclarationAccessGenerator) {
+      } else if (prefix is TypeUseGenerator<Expression, Statement, Arguments>) {
         type = prefix;
       } else if (prefix is Generator) {
         String name = suffix == null
@@ -2792,8 +2791,8 @@
       checkOffset = generator.token.charOffset;
     }
 
-    if (type is TypeDeclarationAccessGenerator) {
-      TypeDeclarationAccessGenerator generator = type;
+    if (type is TypeUseGenerator<Expression, Statement, Arguments>) {
+      TypeUseGenerator<Expression, Statement, Arguments> generator = type;
       if (generator.prefix != null) {
         nameToken = nameToken.next.next;
       }
@@ -3658,7 +3657,7 @@
     List<Expression> annotations = pop();
     KernelTypeVariableBuilder variable;
     Object inScope = scopeLookup(scope, name.name, token);
-    if (inScope is TypeDeclarationAccessGenerator) {
+    if (inScope is TypeUseGenerator<Expression, Statement, Arguments>) {
       variable = inScope.declaration;
     } else {
       // Something went wrong when pre-parsing the type variables.
diff --git a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
index 9a20662..719bc04 100644
--- a/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/expression_generator.dart
@@ -7,8 +7,6 @@
 
 import '../../scanner/token.dart' show Token;
 
-import '../builder/builder.dart' show AccessErrorBuilder, Builder;
-
 import '../constant_context.dart' show ConstantContext;
 
 import '../fasta_codes.dart'
@@ -26,7 +24,8 @@
 
 import 'expression_generator_helper.dart' show ExpressionGeneratorHelper;
 
-import 'forest.dart' show Forest, LoadLibraryBuilder, PrefixBuilder;
+import 'forest.dart'
+    show Forest, LoadLibraryBuilder, PrefixBuilder, TypeDeclarationBuilder;
 
 import 'kernel_ast_api.dart'
     show
@@ -36,8 +35,19 @@
         Member,
         Name,
         Procedure,
+        TypeParameterType,
         VariableDeclaration;
 
+import 'kernel_builder.dart'
+    show
+        AccessErrorBuilder,
+        Builder,
+        BuiltinTypeBuilder,
+        FunctionTypeAliasBuilder,
+        KernelClassBuilder,
+        KernelFunctionTypeAliasBuilder,
+        KernelTypeVariableBuilder;
+
 import 'kernel_expression_generator.dart'
     show IncompleteSendGenerator, SendAccessGenerator;
 
@@ -54,7 +64,6 @@
         ReadOnlyAccessGenerator,
         SendAccessGenerator,
         ThisAccessGenerator,
-        TypeDeclarationAccessGenerator,
         UnresolvedNameGenerator,
         buildIsNull;
 
@@ -166,10 +175,10 @@
         offset);
   }
 
-  /* kernel.Expression | Generator | Initializer */ doInvocation(
+  /* Expression | Generator | Initializer */ doInvocation(
       int offset, Arguments arguments);
 
-  /* kernel.Expression | Generator */ buildPropertyAccess(
+  /* Expression | Generator */ buildPropertyAccess(
       IncompleteSendGenerator send, int operatorOffset, bool isNullAware) {
     if (send is SendAccessGenerator) {
       return helper.buildMethodInvocation(
@@ -203,7 +212,7 @@
   }
 
   @override
-  /* kernel.Expression | Generator */ buildThrowNoSuchMethodError(
+  /* Expression | Generator */ buildThrowNoSuchMethodError(
       Expression receiver, Arguments arguments,
       {bool isSuper: false,
       bool isGetter: false,
@@ -557,3 +566,73 @@
     sink.write(generator);
   }
 }
+
+abstract class TypeUseGenerator<Expression, Statement, Arguments>
+    implements Generator<Expression, Statement, Arguments> {
+  factory TypeUseGenerator(
+      ExpressionGeneratorHelper<Expression, Statement, Arguments> helper,
+      Token token,
+      PrefixBuilder prefix,
+      int declarationReferenceOffset,
+      TypeDeclarationBuilder declaration,
+      String plainNameForRead) {
+    return helper.forest.typeUseGenerator(helper, token, prefix,
+        declarationReferenceOffset, declaration, plainNameForRead);
+  }
+
+  PrefixBuilder get prefix;
+
+  TypeDeclarationBuilder get declaration;
+
+  @override
+  String get debugName => "TypeUseGenerator";
+
+  @override
+  DartType buildTypeWithBuiltArguments(List<DartType> arguments,
+      {bool nonInstanceAccessIsError: false}) {
+    if (arguments != null) {
+      int expected = 0;
+      if (declaration is KernelClassBuilder) {
+        expected = declaration.target.typeParameters.length;
+      } else if (declaration is FunctionTypeAliasBuilder) {
+        expected = declaration.target.typeParameters.length;
+      } else if (declaration is KernelTypeVariableBuilder) {
+        // Type arguments on a type variable - error reported elsewhere.
+      } else if (declaration is BuiltinTypeBuilder) {
+        // Type arguments on a built-in type, for example, dynamic or void.
+        expected = 0;
+      } else {
+        return unhandled("${declaration.runtimeType}",
+            "TypeUseGenerator.buildType", offsetForToken(token), helper.uri);
+      }
+      if (arguments.length != expected) {
+        helper.warnTypeArgumentsMismatch(
+            declaration.name, expected, offsetForToken(token));
+        // We ignore the provided arguments, which will in turn return the
+        // raw type below.
+        // TODO(sigmund): change to use an InvalidType and include the raw type
+        // as a recovery node once the IR can represent it (Issue #29840).
+        arguments = null;
+      }
+    }
+
+    DartType type;
+    if (arguments == null) {
+      TypeDeclarationBuilder typeDeclaration = declaration;
+      if (typeDeclaration is KernelClassBuilder) {
+        type = typeDeclaration.buildType(helper.library, null);
+      } else if (typeDeclaration is KernelFunctionTypeAliasBuilder) {
+        type = typeDeclaration.buildType(helper.library, null);
+      }
+    }
+    if (type == null) {
+      type =
+          declaration.buildTypesWithBuiltArguments(helper.library, arguments);
+    }
+    if (type is TypeParameterType) {
+      return helper.validatedTypeVariableUse(
+          type, offsetForToken(token), nonInstanceAccessIsError);
+    }
+    return type;
+  }
+}
diff --git a/pkg/front_end/lib/src/fasta/kernel/fangorn.dart b/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
index 3720045..b3fa099 100644
--- a/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
@@ -55,6 +55,7 @@
         KernelSuperPropertyAccessGenerator,
         KernelThisIndexedAccessGenerator,
         KernelThisPropertyAccessGenerator,
+        KernelTypeUseGenerator,
         KernelVariableUseGenerator;
 
 import 'body_builder.dart' show FormalParameters, OptionalFormals;
@@ -105,7 +106,8 @@
         Forest,
         Generator,
         LoadLibraryBuilder,
-        PrefixBuilder;
+        PrefixBuilder,
+        TypeDeclarationBuilder;
 
 /// A shadow tree factory.
 class Fangorn extends Forest<Expression, Statement, Token, Arguments> {
@@ -721,6 +723,7 @@
     return new KernelStaticAccessGenerator(helper, token, getter, setter);
   }
 
+  @override
   KernelLoadLibraryGenerator loadLibraryGenerator(
       ExpressionGeneratorHelper<Expression, Statement, Arguments> helper,
       Token token,
@@ -728,6 +731,7 @@
     return new KernelLoadLibraryGenerator(helper, token, builder);
   }
 
+  @override
   KernelDeferredAccessGenerator deferredAccessGenerator(
       ExpressionGeneratorHelper<Expression, Statement, Arguments> helper,
       Token token,
@@ -735,6 +739,18 @@
       Generator<Expression, Statement, Arguments> generator) {
     return new KernelDeferredAccessGenerator(helper, token, builder, generator);
   }
+
+  @override
+  KernelTypeUseGenerator typeUseGenerator(
+      ExpressionGeneratorHelper<Expression, Statement, Arguments> helper,
+      Token token,
+      PrefixBuilder prefix,
+      int declarationReferenceOffset,
+      TypeDeclarationBuilder declaration,
+      String plainNameForRead) {
+    return new KernelTypeUseGenerator(helper, token, prefix,
+        declarationReferenceOffset, declaration, plainNameForRead);
+  }
 }
 
 class _VariablesDeclaration extends Statement {
diff --git a/pkg/front_end/lib/src/fasta/kernel/forest.dart b/pkg/front_end/lib/src/fasta/kernel/forest.dart
index 1df4fc0..ecfe7fa 100644
--- a/pkg/front_end/lib/src/fasta/kernel/forest.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/forest.dart
@@ -18,7 +18,8 @@
 
 import 'expression_generator_helper.dart' show ExpressionGeneratorHelper;
 
-import 'kernel_builder.dart' show LoadLibraryBuilder, PrefixBuilder;
+import 'kernel_builder.dart'
+    show LoadLibraryBuilder, PrefixBuilder, TypeDeclarationBuilder;
 
 export 'body_builder.dart' show Identifier, Operator;
 
@@ -26,7 +27,8 @@
 
 export 'expression_generator_helper.dart' show ExpressionGeneratorHelper;
 
-export 'kernel_builder.dart' show LoadLibraryBuilder, PrefixBuilder;
+export 'kernel_builder.dart'
+    show LoadLibraryBuilder, PrefixBuilder, TypeDeclarationBuilder;
 
 /// A tree factory.
 ///
@@ -440,6 +442,14 @@
       PrefixBuilder builder,
       Generator<Expression, Statement, Arguments> generator);
 
+  Generator<Expression, Statement, Arguments> typeUseGenerator(
+      ExpressionGeneratorHelper<Expression, Statement, Arguments> helper,
+      Location location,
+      PrefixBuilder prefix,
+      int declarationReferenceOffset,
+      TypeDeclarationBuilder declaration,
+      String plainNameForRead);
+
   // TODO(ahe): Remove this method when all users are moved here.
   kernel.Arguments castArguments(Arguments arguments) {
     dynamic a = arguments;
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart
index 66e62d3..b72a69d 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart
@@ -59,6 +59,7 @@
         SuperPropertyAccessGenerator,
         ThisIndexedAccessGenerator,
         ThisPropertyAccessGenerator,
+        TypeUseGenerator,
         VariableUseGenerator;
 
 import 'expression_generator_helper.dart' show ExpressionGeneratorHelper;
@@ -101,7 +102,6 @@
         Throw,
         TreeNode,
         TypeParameter,
-        TypeParameterType,
         VariableDeclaration,
         VariableGet,
         VariableSet;
@@ -109,12 +109,8 @@
 import 'kernel_builder.dart'
     show
         Builder,
-        BuiltinTypeBuilder,
-        FunctionTypeAliasBuilder,
         KernelClassBuilder,
-        KernelFunctionTypeAliasBuilder,
         KernelInvalidTypeBuilder,
-        KernelTypeVariableBuilder,
         LoadLibraryBuilder,
         PrefixBuilder,
         TypeDeclarationBuilder;
@@ -1242,6 +1238,112 @@
   }
 }
 
+class KernelTypeUseGenerator extends ReadOnlyAccessGenerator
+    with TypeUseGenerator<Expression, Statement, Arguments> {
+  /// The import prefix preceding the [declaration] reference, or `null` if
+  /// the reference is not prefixed.
+  @override
+  final PrefixBuilder prefix;
+
+  /// The offset at which the [declaration] is referenced by this generator,
+  /// or `-1` if the reference is implicit.
+  final int declarationReferenceOffset;
+
+  @override
+  final TypeDeclarationBuilder declaration;
+
+  KernelTypeUseGenerator(
+      ExpressionGeneratorHelper<dynamic, dynamic, dynamic> helper,
+      Token token,
+      this.prefix,
+      this.declarationReferenceOffset,
+      this.declaration,
+      String plainNameForRead)
+      : super(helper, token, null, plainNameForRead);
+
+  @override
+  Expression get expression {
+    if (super.expression == null) {
+      int offset = offsetForToken(token);
+      if (declaration is KernelInvalidTypeBuilder) {
+        KernelInvalidTypeBuilder declaration = this.declaration;
+        helper.addProblemErrorIfConst(
+            declaration.message.messageObject, offset, token.length);
+        super.expression =
+            new Throw(forest.literalString(declaration.message.message, token))
+              ..fileOffset = offset;
+      } else {
+        super.expression = forest.literalType(
+            buildTypeWithBuiltArguments(null, nonInstanceAccessIsError: true),
+            token);
+      }
+    }
+    return super.expression;
+  }
+
+  @override
+  Expression makeInvalidWrite(Expression value) {
+    return buildThrowNoSuchMethodError(
+        forest.literalNull(token),
+        storeOffset(
+            forest.arguments(<Expression>[value], null), value.fileOffset),
+        isSetter: true);
+  }
+
+  @override
+  buildPropertyAccess(
+      IncompleteSendGenerator send, int operatorOffset, bool isNullAware) {
+    // `SomeType?.toString` is the same as `SomeType.toString`, not
+    // `(SomeType).toString`.
+    isNullAware = false;
+
+    Name name = send.name;
+    Arguments arguments = send.arguments;
+
+    if (declaration is KernelClassBuilder) {
+      KernelClassBuilder declaration = this.declaration;
+      Builder builder = declaration.findStaticBuilder(
+          name.name, offsetForToken(token), uri, helper.library);
+
+      Generator generator;
+      if (builder == null) {
+        // If we find a setter, [builder] is an [AccessErrorBuilder], not null.
+        if (send is IncompletePropertyAccessGenerator) {
+          generator = new UnresolvedNameGenerator(helper, send.token, name);
+        } else {
+          return helper.buildConstructorInvocation(declaration, send.token,
+              arguments, name.name, null, token.charOffset, Constness.implicit);
+        }
+      } else {
+        Builder setter;
+        if (builder.isSetter) {
+          setter = builder;
+        } else if (builder.isGetter) {
+          setter = declaration.findStaticBuilder(
+              name.name, offsetForToken(token), uri, helper.library,
+              isSetter: true);
+        } else if (builder.isField && !builder.isFinal) {
+          setter = builder;
+        }
+        generator = new StaticAccessGenerator<Expression, Statement,
+            Arguments>.fromBuilder(helper, builder, send.token, setter);
+      }
+
+      return arguments == null
+          ? generator
+          : generator.doInvocation(offsetForToken(send.token), arguments);
+    } else {
+      return super.buildPropertyAccess(send, operatorOffset, isNullAware);
+    }
+  }
+
+  @override
+  Expression doInvocation(int offset, Arguments arguments) {
+    return helper.buildConstructorInvocation(declaration, token, arguments, "",
+        null, token.charOffset, Constness.implicit);
+  }
+}
+
 Expression makeLet(VariableDeclaration variable, Expression body) {
   if (variable == null) return body;
   return new Let(variable, body);
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator_impl.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator_impl.dart
index 2ae32a3..9bda17f 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator_impl.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator_impl.dart
@@ -708,162 +708,6 @@
   }
 }
 
-// TODO(ahe): Rename to TypeUseGenerator.
-class TypeDeclarationAccessGenerator extends ReadOnlyAccessGenerator {
-  /// The import prefix preceding the [declaration] reference, or `null` if
-  /// the reference is not prefixed.
-  final PrefixBuilder prefix;
-
-  /// The offset at which the [declaration] is referenced by this generator,
-  /// or `-1` if the reference is implicit.
-  final int declarationReferenceOffset;
-
-  final TypeDeclarationBuilder declaration;
-
-  TypeDeclarationAccessGenerator(
-      ExpressionGeneratorHelper<dynamic, dynamic, dynamic> helper,
-      Token token,
-      this.prefix,
-      this.declarationReferenceOffset,
-      this.declaration,
-      String plainNameForRead)
-      : super(helper, token, null, plainNameForRead);
-
-  String get debugName => "TypeDeclarationAccessGenerator";
-
-  Expression get expression {
-    if (super.expression == null) {
-      int offset = offsetForToken(token);
-      if (declaration is KernelInvalidTypeBuilder) {
-        KernelInvalidTypeBuilder declaration = this.declaration;
-        helper.addProblemErrorIfConst(
-            declaration.message.messageObject, offset, token.length);
-        super.expression =
-            new Throw(forest.literalString(declaration.message.message, token))
-              ..fileOffset = offset;
-      } else {
-        super.expression = forest.literalType(
-            buildTypeWithBuiltArguments(null, nonInstanceAccessIsError: true),
-            token);
-      }
-    }
-    return super.expression;
-  }
-
-  Expression makeInvalidWrite(Expression value) {
-    return buildThrowNoSuchMethodError(
-        forest.literalNull(token),
-        storeOffset(
-            forest.arguments(<Expression>[value], null), value.fileOffset),
-        isSetter: true);
-  }
-
-  @override
-  buildPropertyAccess(
-      IncompleteSendGenerator send, int operatorOffset, bool isNullAware) {
-    // `SomeType?.toString` is the same as `SomeType.toString`, not
-    // `(SomeType).toString`.
-    isNullAware = false;
-
-    Name name = send.name;
-    Arguments arguments = send.arguments;
-
-    if (declaration is KernelClassBuilder) {
-      KernelClassBuilder declaration = this.declaration;
-      Builder builder = declaration.findStaticBuilder(
-          name.name, offsetForToken(token), uri, helper.library);
-
-      Generator generator;
-      if (builder == null) {
-        // If we find a setter, [builder] is an [AccessErrorBuilder], not null.
-        if (send is IncompletePropertyAccessGenerator) {
-          generator = new UnresolvedNameGenerator(helper, send.token, name);
-        } else {
-          return helper.buildConstructorInvocation(declaration, send.token,
-              arguments, name.name, null, token.charOffset, Constness.implicit);
-        }
-      } else {
-        Builder setter;
-        if (builder.isSetter) {
-          setter = builder;
-        } else if (builder.isGetter) {
-          setter = declaration.findStaticBuilder(
-              name.name, offsetForToken(token), uri, helper.library,
-              isSetter: true);
-        } else if (builder.isField && !builder.isFinal) {
-          setter = builder;
-        }
-        generator = new StaticAccessGenerator<Expression, Statement,
-            Arguments>.fromBuilder(helper, builder, send.token, setter);
-      }
-
-      return arguments == null
-          ? generator
-          : generator.doInvocation(offsetForToken(send.token), arguments);
-    } else {
-      return super.buildPropertyAccess(send, operatorOffset, isNullAware);
-    }
-  }
-
-  @override
-  DartType buildTypeWithBuiltArguments(List<DartType> arguments,
-      {bool nonInstanceAccessIsError: false}) {
-    if (arguments != null) {
-      int expected = 0;
-      if (declaration is KernelClassBuilder) {
-        expected = declaration.target.typeParameters.length;
-      } else if (declaration is FunctionTypeAliasBuilder) {
-        expected = declaration.target.typeParameters.length;
-      } else if (declaration is KernelTypeVariableBuilder) {
-        // Type arguments on a type variable - error reported elsewhere.
-      } else if (declaration is BuiltinTypeBuilder) {
-        // Type arguments on a built-in type, for example, dynamic or void.
-        expected = 0;
-      } else {
-        return unhandled(
-            "${declaration.runtimeType}",
-            "TypeDeclarationAccessGenerator.buildType",
-            offsetForToken(token),
-            helper.uri);
-      }
-      if (arguments.length != expected) {
-        helper.warnTypeArgumentsMismatch(
-            declaration.name, expected, offsetForToken(token));
-        // We ignore the provided arguments, which will in turn return the
-        // raw type below.
-        // TODO(sigmund): change to use an InvalidType and include the raw type
-        // as a recovery node once the IR can represent it (Issue #29840).
-        arguments = null;
-      }
-    }
-
-    DartType type;
-    if (arguments == null) {
-      TypeDeclarationBuilder typeDeclaration = declaration;
-      if (typeDeclaration is KernelClassBuilder) {
-        type = typeDeclaration.buildType(helper.library, null);
-      } else if (typeDeclaration is KernelFunctionTypeAliasBuilder) {
-        type = typeDeclaration.buildType(helper.library, null);
-      }
-    }
-    if (type == null) {
-      type =
-          declaration.buildTypesWithBuiltArguments(helper.library, arguments);
-    }
-    if (type is TypeParameterType) {
-      return helper.validatedTypeVariableUse(
-          type, offsetForToken(token), nonInstanceAccessIsError);
-    }
-    return type;
-  }
-
-  @override
-  Expression doInvocation(int offset, Arguments arguments) {
-    return helper.buildConstructorInvocation(declaration, token, arguments, "",
-        null, token.charOffset, Constness.implicit);
-  }
-}
-
 abstract class ContextAwareGenerator
     extends Generator<Expression, Statement, Arguments> {
   final Generator generator;
diff --git a/pkg/front_end/test/fasta/generator_to_string_test.dart b/pkg/front_end/test/fasta/generator_to_string_test.dart
index 311a56d..925fb30 100644
--- a/pkg/front_end/test/fasta/generator_to_string_test.dart
+++ b/pkg/front_end/test/fasta/generator_to_string_test.dart
@@ -67,13 +67,13 @@
         KernelSuperPropertyAccessGenerator,
         KernelThisIndexedAccessGenerator,
         KernelThisPropertyAccessGenerator,
+        KernelTypeUseGenerator,
         KernelVariableUseGenerator,
         LargeIntAccessGenerator,
         ParenthesizedExpressionGenerator,
         ReadOnlyAccessGenerator,
         SendAccessGenerator,
         ThisAccessGenerator,
-        TypeDeclarationAccessGenerator,
         UnresolvedNameGenerator;
 
 import 'package:front_end/src/fasta/scanner.dart' show Token, scanString;
@@ -223,9 +223,9 @@
         " plainNameForRead: null, value: null)",
         new ParenthesizedExpressionGenerator(helper, token, expression));
     check(
-        "TypeDeclarationAccessGenerator(offset: 4, expression: T,"
+        "TypeUseGenerator(offset: 4, expression: T,"
         " plainNameForRead: foo, value: null)",
-        new TypeDeclarationAccessGenerator(
+        new KernelTypeUseGenerator(
             helper, token, prefixBuilder, -1, declaration, "foo"));
     check("UnresolvedNameGenerator(offset: 4, name: bar)",
         new UnresolvedNameGenerator(helper, token, name));