Version 2.17.0-106.0.dev

Merge commit 'e05620f51c51c6e85163385157d027b5e0013cce' into 'dev'
diff --git a/DEPS b/DEPS
index 7827868..64f875b 100644
--- a/DEPS
+++ b/DEPS
@@ -44,7 +44,7 @@
   # co19 is a cipd package. Use update.sh in tests/co19[_2] to update these
   # hashes. It requires access to the dart-build-access group, which EngProd
   # has.
-  "co19_rev": "0d38c8081e4da585262ed08ddde3dd85dc779dba",
+  "co19_rev": "a38d7c5685e64499cfbdbfe6548fbd5b63b57f15",
   # This line prevents conflicts when both packages are rolled simultaneously.
   "co19_2_rev": "995745937abffe9fc3a6441f9f0db27b2d706e4c",
 
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/executor.dart b/pkg/_fe_analyzer_shared/lib/src/macros/executor.dart
index 94b8930..67190b0 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/executor.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/executor.dart
@@ -232,9 +232,12 @@
 class ResolvedIdentifier extends Identifier {
   /// The import URI for the library that defines the member that is referenced
   /// by this identifier.
-  final Uri uri;
+  ///
+  /// If this identifier is an instance member or a built-in type, like
+  /// `void`, [uri] is `null`.
+  final Uri? uri;
 
-  /// Type type of identifier this is (instance, static, top level).
+  /// Type of identifier this is (instance, static, top level).
   final IdentifierKind kind;
 
   /// The unqualified name of this identifier.
diff --git a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/augmentation_library.dart b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/augmentation_library.dart
index 56e4fb7a..d15e22b 100644
--- a/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/augmentation_library.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/macros/executor_shared/augmentation_library.dart
@@ -31,17 +31,20 @@
           buildCode(part);
         } else if (part is Identifier) {
           ResolvedIdentifier resolved = resolveIdentifier(part);
-          String prefix = importPrefixes.putIfAbsent(resolved.uri, () {
-            String prefix = 'i${nextPrefix++}';
-            importsBuffer.writeln("import '${resolved.uri}' as $prefix;");
-            return prefix;
-          });
+          String? prefix;
+          if (resolved.uri != null) {
+            prefix = importPrefixes.putIfAbsent(resolved.uri!, () {
+              String prefix = 'i${nextPrefix++}';
+              importsBuffer.writeln("import '${resolved.uri}' as $prefix;");
+              return prefix;
+            });
+          }
           if (resolved.kind == IdentifierKind.instanceMember) {
             // Qualify with `this.` if we don't have a receiver.
             if (!lastDirectivePart.trimRight().endsWith('.')) {
               writeDirectivePart('this.');
             }
-          } else {
+          } else if (prefix != null) {
             writeDirectivePart('${prefix}.');
           }
           if (resolved.kind == IdentifierKind.staticInstanceMember) {
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index aa458b7..7952b4b 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -227,9 +227,11 @@
   Uri? translateUri(Uri uri) => uriTranslator.translate(uri);
 
   /// Returns a reference to the constructor of
-  /// [AbstractClassInstantiationError] error.  The constructor is expected to
+  /// `AbstractClassInstantiationError` error.  The constructor is expected to
   /// accept a single argument of type String, which is the name of the
   /// abstract class.
+  // TODO: Use some other error before `AbstractClassInstantiationError`
+  // is removed.
   MemberBuilder getAbstractClassInstantiationError(Loader loader) {
     return _cachedAbstractClassInstantiationError ??=
         loader.coreLibrary.getConstructor("AbstractClassInstantiationError");
diff --git a/pkg/front_end/lib/src/fasta/kernel/macro.dart b/pkg/front_end/lib/src/fasta/kernel/macro.dart
index bec7d02..1faf2da 100644
--- a/pkg/front_end/lib/src/fasta/kernel/macro.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/macro.dart
@@ -21,7 +21,9 @@
 import '../builder/member_builder.dart';
 import '../builder/named_type_builder.dart';
 import '../builder/nullability_builder.dart';
+import '../builder/type_alias_builder.dart';
 import '../builder/type_builder.dart';
+import '../builder/type_declaration_builder.dart';
 import '../identifiers.dart';
 import '../source/source_class_builder.dart';
 import '../source/source_constructor_builder.dart';
@@ -76,13 +78,12 @@
 
 class MacroApplicationDataForTesting {
   Map<SourceLibraryBuilder, LibraryMacroApplicationData> libraryData = {};
-  Map<SourceClassBuilder, List<macro.MacroExecutionResult>> classTypesResults =
-      {};
+  Map<SourceClassBuilder, String> classTypesResults = {};
   Map<SourceClassBuilder, List<macro.MacroExecutionResult>>
       classDeclarationsResults = {};
   Map<SourceClassBuilder, List<macro.MacroExecutionResult>>
       classDefinitionsResults = {};
-  Map<MemberBuilder, List<macro.MacroExecutionResult>> memberTypesResults = {};
+  Map<MemberBuilder, String> memberTypesResults = {};
   Map<MemberBuilder, List<macro.MacroExecutionResult>>
       memberDeclarationsResults = {};
   Map<MemberBuilder, List<macro.MacroExecutionResult>>
@@ -198,7 +199,54 @@
       // TODO(johnniwinther): Throw when all members are supported.
       throw new UnimplementedError(
           'Unsupported member ${memberBuilder} (${memberBuilder.runtimeType})');
-      //return null;
+    }
+  }
+
+  macro.ResolvedIdentifier _resolveIdentifier(macro.Identifier identifier) {
+    if (identifier is _IdentifierImpl) {
+      MemberBuilder? memberBuilder = identifier.memberBuilder;
+      if (memberBuilder != null) {
+        Uri? uri;
+        String? staticScope;
+        macro.IdentifierKind kind;
+        if (memberBuilder.isStatic || memberBuilder.isConstructor) {
+          ClassBuilder classBuilder = memberBuilder.classBuilder!;
+          staticScope = classBuilder.name;
+          uri = classBuilder.library.importUri;
+          kind = macro.IdentifierKind.staticInstanceMember;
+        } else if (memberBuilder.isTopLevel) {
+          uri = memberBuilder.library.importUri;
+          kind = macro.IdentifierKind.topLevelMember;
+        } else {
+          kind = macro.IdentifierKind.instanceMember;
+        }
+        return new macro.ResolvedIdentifier(
+            kind: kind,
+            name: identifier.name,
+            staticScope: staticScope,
+            uri: uri);
+      } else {
+        TypeDeclarationBuilder typeDeclarationBuilder =
+            identifier.typeBuilder!.declaration!;
+        Uri? uri;
+        if (typeDeclarationBuilder is ClassBuilder) {
+          uri = typeDeclarationBuilder.library.importUri;
+        } else if (typeDeclarationBuilder is TypeAliasBuilder) {
+          uri = typeDeclarationBuilder.library.importUri;
+        }
+        return new macro.ResolvedIdentifier(
+            kind: macro.IdentifierKind.topLevelMember,
+            name: identifier.name,
+            staticScope: null,
+            uri: uri);
+      }
+    } else {
+      // TODO(johnniwinther): Use [_IdentifierImpl] for all identifiers.
+      return new macro.ResolvedIdentifier(
+          kind: macro.IdentifierKind.topLevelMember,
+          name: identifier.name,
+          staticScope: null,
+          uri: null);
     }
   }
 
@@ -253,11 +301,13 @@
         results.add(result);
       }
     }
+    String result =
+        _macroExecutor.buildAugmentationLibrary(results, _resolveIdentifier);
     if (retainDataForTesting) {
       if (builder is SourceClassBuilder) {
-        dataForTesting?.classTypesResults[builder] = results;
+        dataForTesting?.classTypesResults[builder] = result;
       } else {
-        dataForTesting?.memberTypesResults[builder as MemberBuilder] = results;
+        dataForTesting?.memberTypesResults[builder as MemberBuilder] = result;
       }
     }
     return results;
@@ -352,8 +402,11 @@
   macro.ClassDeclaration _createClassDeclaration(SourceClassBuilder builder) {
     macro.ClassDeclaration declaration = new macro.ClassDeclarationImpl(
         id: macro.RemoteInstance.uniqueId,
-        identifier: new macro.IdentifierImpl(
-            id: macro.RemoteInstance.uniqueId, name: builder.name),
+        identifier: new _IdentifierImpl.forTypeDeclarationBuilder(
+            typeDeclarationBuilder: builder,
+            libraryBuilder: builder.library,
+            id: macro.RemoteInstance.uniqueId,
+            name: builder.name),
         // TODO(johnniwinther): Support typeParameters
         typeParameters: [],
         // TODO(johnniwinther): Support interfaces
@@ -417,8 +470,10 @@
         _getClassDeclaration(builder.classBuilder as SourceClassBuilder);
     return new macro.ConstructorDeclarationImpl(
       id: macro.RemoteInstance.uniqueId,
-      identifier: new macro.IdentifierImpl(
-          id: macro.RemoteInstance.uniqueId, name: builder.name),
+      identifier: new _IdentifierImpl.forMemberBuilder(
+          memberBuilder: builder,
+          id: macro.RemoteInstance.uniqueId,
+          name: builder.name),
       definingClass: definingClass.identifier as macro.IdentifierImpl,
       isFactory: builder.isFactory,
       isAbstract: builder.isAbstract,
@@ -444,8 +499,10 @@
 
     return new macro.ConstructorDeclarationImpl(
       id: macro.RemoteInstance.uniqueId,
-      identifier: new macro.IdentifierImpl(
-          id: macro.RemoteInstance.uniqueId, name: builder.name),
+      identifier: new _IdentifierImpl.forMemberBuilder(
+          memberBuilder: builder,
+          id: macro.RemoteInstance.uniqueId,
+          name: builder.name),
       definingClass: definingClass.identifier as macro.IdentifierImpl,
       isFactory: builder.isFactory,
       isAbstract: builder.isAbstract,
@@ -477,8 +534,10 @@
       //  declarations?
       return new macro.MethodDeclarationImpl(
           id: macro.RemoteInstance.uniqueId,
-          identifier: new macro.IdentifierImpl(
-              id: macro.RemoteInstance.uniqueId, name: builder.name),
+          identifier: new _IdentifierImpl.forMemberBuilder(
+              memberBuilder: builder,
+              id: macro.RemoteInstance.uniqueId,
+              name: builder.name),
           definingClass: definingClass.identifier as macro.IdentifierImpl,
           isAbstract: builder.isAbstract,
           isExternal: builder.isExternal,
@@ -494,8 +553,10 @@
     } else {
       return new macro.FunctionDeclarationImpl(
           id: macro.RemoteInstance.uniqueId,
-          identifier: new macro.IdentifierImpl(
-              id: macro.RemoteInstance.uniqueId, name: builder.name),
+          identifier: new _IdentifierImpl.forMemberBuilder(
+              memberBuilder: builder,
+              id: macro.RemoteInstance.uniqueId,
+              name: builder.name),
           isAbstract: builder.isAbstract,
           isExternal: builder.isExternal,
           isGetter: builder.isGetter,
@@ -561,7 +622,7 @@
         if (name is String) {
           return new macro.NamedTypeAnnotationImpl(
               id: macro.RemoteInstance.uniqueId,
-              identifier: new _IdentifierImpl(
+              identifier: new _IdentifierImpl.forTypeBuilder(
                   typeBuilder: typeBuilder,
                   libraryBuilder: libraryBuilder,
                   id: macro.RemoteInstance.uniqueId,
@@ -572,7 +633,7 @@
           assert(name.qualifier is String);
           return new macro.NamedTypeAnnotationImpl(
               id: macro.RemoteInstance.uniqueId,
-              identifier: new _IdentifierImpl(
+              identifier: new _IdentifierImpl.forTypeBuilder(
                   typeBuilder: typeBuilder,
                   libraryBuilder: libraryBuilder,
                   id: macro.RemoteInstance.uniqueId,
@@ -611,13 +672,23 @@
 
     if (typeAnnotation is macro.NamedTypeAnnotationCode) {
       _IdentifierImpl typeIdentifier = typeAnnotation.name as _IdentifierImpl;
-      TypeBuilder? originalTypeBuilder = typeIdentifier.typeBuilder;
-      if (originalTypeBuilder == null) {
-        throw new StateError('No type builder for $typeIdentifier');
-      }
-      if (originalTypeBuilder is! NamedTypeBuilder) {
-        throw new StateError(
-            'Type $typeIdentifier was not a named type as expected!');
+      TypeDeclarationBuilder? typeDeclarationBuilder =
+          typeIdentifier.typeDeclarationBuilder;
+      InstanceTypeVariableAccessState instanceTypeVariableAccessState =
+          InstanceTypeVariableAccessState.Unexpected;
+      if (typeDeclarationBuilder == null) {
+        TypeBuilder? originalTypeBuilder = typeIdentifier.typeBuilder;
+
+        if (originalTypeBuilder == null) {
+          throw new StateError('No type builder for $typeIdentifier');
+        }
+        if (originalTypeBuilder is! NamedTypeBuilder) {
+          throw new StateError(
+              'Type $typeIdentifier was not a named type as expected!');
+        }
+        typeDeclarationBuilder = originalTypeBuilder.declaration!;
+        instanceTypeVariableAccessState =
+            originalTypeBuilder.instanceTypeVariableAccess;
       }
       List<TypeBuilder> arguments = [
         for (macro.TypeAnnotationCode argumentCode
@@ -626,9 +697,8 @@
       ];
 
       return new NamedTypeBuilder.fromTypeDeclarationBuilder(
-          originalTypeBuilder.declaration!, nullabilityBuilder,
-          instanceTypeVariableAccess:
-              originalTypeBuilder.instanceTypeVariableAccess,
+          typeDeclarationBuilder, nullabilityBuilder,
+          instanceTypeVariableAccess: instanceTypeVariableAccessState,
           arguments: arguments);
     }
     // TODO: Implement support for function types.
@@ -654,15 +724,37 @@
 }
 
 class _IdentifierImpl extends macro.IdentifierImpl {
+  final TypeDeclarationBuilder? typeDeclarationBuilder;
+  final MemberBuilder? memberBuilder;
   final TypeBuilder? typeBuilder;
   final LibraryBuilder libraryBuilder;
 
-  _IdentifierImpl({
-    required this.typeBuilder,
+  _IdentifierImpl.forTypeBuilder({
+    required TypeBuilder this.typeBuilder,
     required this.libraryBuilder,
     required int id,
     required String name,
-  }) : super(id: id, name: name);
+  })  : typeDeclarationBuilder = null,
+        memberBuilder = null,
+        super(id: id, name: name);
+
+  _IdentifierImpl.forTypeDeclarationBuilder({
+    required TypeDeclarationBuilder this.typeDeclarationBuilder,
+    required this.libraryBuilder,
+    required int id,
+    required String name,
+  })  : typeBuilder = null,
+        memberBuilder = null,
+        super(id: id, name: name);
+
+  _IdentifierImpl.forMemberBuilder(
+      {required MemberBuilder this.memberBuilder,
+      required int id,
+      required String name})
+      : typeBuilder = null,
+        typeDeclarationBuilder = null,
+        libraryBuilder = memberBuilder.library,
+        super(id: id, name: name);
 }
 
 class _StaticTypeImpl extends macro.StaticType {
diff --git a/pkg/front_end/test/macro_application/data/pkgs/macro/lib/macro.dart b/pkg/front_end/test/macro_application/data/pkgs/macro/lib/macro.dart
index a6dbe4e..a394202 100644
--- a/pkg/front_end/test/macro_application/data/pkgs/macro/lib/macro.dart
+++ b/pkg/front_end/test/macro_application/data/pkgs/macro/lib/macro.dart
@@ -47,7 +47,9 @@
   FutureOr<void> buildTypesForFunction(FunctionDeclaration function,
       TypeBuilder builder) {
     var name = '${function.identifier.name}GeneratedClass';
-    builder.declareType(name, new DeclarationCode.fromString('class $name {}'));
+    builder.declareType(
+        name, new DeclarationCode.fromParts(['class $name<T extends ',
+      function.returnType.code, '> {}']));
   }
 }
 
diff --git a/pkg/front_end/test/macro_application/data/tests/declarations.dart b/pkg/front_end/test/macro_application/data/tests/declarations.dart
index c4584d6..0f95ed9 100644
--- a/pkg/front_end/test/macro_application/data/tests/declarations.dart
+++ b/pkg/front_end/test/macro_application/data/tests/declarations.dart
@@ -5,54 +5,63 @@
 import 'package:macro/macro.dart';
 
 /*member: topLevelFunction1:
+
 void topLevelFunction1GeneratedMethod_() {}
 */
 @FunctionDeclarationsMacro1()
 void topLevelFunction1() {}
 
 /*member: topLevelFunction2:
+
 void topLevelFunction2GeneratedMethod_e() {}
 */
 @FunctionDeclarationsMacro1()
 external void topLevelFunction2();
 
 /*member: topLevelField1:
+
 void topLevelField1GeneratedMethod_() {}
 */
 @VariableDeclarationsMacro1()
 int? topLevelField1;
 
 /*member: topLevelField2:
+
 void topLevelField2GeneratedMethod_e() {}
 */
 @VariableDeclarationsMacro1()
 external int? topLevelField2;
 
 /*member: topLevelField3:
+
 void topLevelField3GeneratedMethod_f() {}
 */
 @VariableDeclarationsMacro1()
 final int? topLevelField3 = null;
 
 /*member: topLevelField4:
+
 void topLevelField4GeneratedMethod_l() {}
 */
 @VariableDeclarationsMacro1()
 late int? topLevelField4;
 
 /*member: topLevelGetter1:
+
 void topLevelGetter1GeneratedMethod_g() {}
 */
 @FunctionDeclarationsMacro1()
 int? get topLevelGetter1 => null;
 
 /*member: topLevelSetter1=:
+
 void topLevelSetter1GeneratedMethod_s() {}
 */
 @FunctionDeclarationsMacro1()
 void set topLevelSetter1(int? value) {}
 
 /*class: Class1:
+
 void Class1GeneratedMethod_() {}
 
 void Class1Introspection() {
@@ -65,6 +74,7 @@
 @ClassDeclarationsMacro2()
 class Class1 {
   /*member: Class1.:
+
 augment class Class1 {
 void Class1_GeneratedMethod_() {}
 
@@ -73,6 +83,7 @@
   Class1();
 
   /*member: Class1.redirect:
+
 augment class Class1 {
 void Class1_redirectGeneratedMethod_f() {}
 
@@ -81,6 +92,7 @@
   factory Class1.redirect() = Class1;
 
   /*member: Class1.fact:
+
 augment class Class1 {
 void Class1_factGeneratedMethod_f() {}
 
@@ -89,42 +101,49 @@
   factory Class1.fact() => new Class1();
 
   /*member: Class1.instanceMethod1:
+
 void Class1_instanceMethod1GeneratedMethod_() {}
 */
   @MethodDeclarationsMacro1()
   void instanceMethod1() {}
 
   /*member: Class1.instanceGetter1:
+
 void Class1_instanceGetter1GeneratedMethod_g() {}
 */
   @MethodDeclarationsMacro1()
   int? get instanceGetter1 => null;
 
   /*member: Class1.instanceSetter1=:
+
 void Class1_instanceSetter1GeneratedMethod_s() {}
 */
   @MethodDeclarationsMacro1()
   void set instanceSetter1(int? value) {}
 
   /*member: Class1.[]:
+
 void Class1_[]GeneratedMethod_o() {}
 */
   @MethodDeclarationsMacro1()
   int operator [](int i) => i;
 
   /*member: Class1.instanceField1:
+
 void Class1_instanceField1GeneratedMethod_() {}
 */
   @FieldDeclarationsMacro1()
   int? instanceField1;
 
   /*member: Class1.instanceField2:
+
 void Class1_instanceField2GeneratedMethod_f() {}
 */
   @FieldDeclarationsMacro1()
   final int? instanceField2 = null;
 
   /*member: Class1.instanceField3:
+
 void Class1_instanceField3GeneratedMethod_fl() {}
 */
   @FieldDeclarationsMacro1()
@@ -132,6 +151,7 @@
 }
 
 /*class: Class2:
+
 void Class2GeneratedMethod_a() {}
 
 void Class2Introspection() {
@@ -144,12 +164,14 @@
 @ClassDeclarationsMacro2()
 abstract class Class2 {
   /*member: Class2.instanceMethod1:
+
 void Class2_instanceMethod1GeneratedMethod_a() {}
 */
   @MethodDeclarationsMacro1()
   void instanceMethod1();
 
   /*member: Class2.instanceField1:
+
 void Class2_instanceField1GeneratedMethod_() {}
 */
   @FieldDeclarationsMacro1()
diff --git a/pkg/front_end/test/macro_application/data/tests/parameters.dart b/pkg/front_end/test/macro_application/data/tests/parameters.dart
index bb606bb..132979a 100644
--- a/pkg/front_end/test/macro_application/data/tests/parameters.dart
+++ b/pkg/front_end/test/macro_application/data/tests/parameters.dart
@@ -5,6 +5,7 @@
 import 'package:macro/macro.dart';
 
 /*member: topLevelFunction1:
+
 augment void topLevelFunction1(int a, ) {
   return 42;
 }*/
@@ -12,6 +13,7 @@
 external void topLevelFunction1(int a);
 
 /*member: topLevelFunction2:
+
 augment void topLevelFunction2(int a, int b, ) {
   return 42;
 }*/
@@ -19,6 +21,7 @@
 external void topLevelFunction2(int a, int b);
 
 /*member: topLevelFunction3:
+
 augment void topLevelFunction3(int a, [int? b, ]) {
   return 42;
 }*/
@@ -26,6 +29,7 @@
 external void topLevelFunction3(int a, [int? b]);
 
 /*member: topLevelFunction4:
+
 augment void topLevelFunction4(int a, {int? b, int? c, }) {
   return 42;
 }*/
diff --git a/pkg/front_end/test/macro_application/data/tests/subtypes.dart b/pkg/front_end/test/macro_application/data/tests/subtypes.dart
index 4340fc2..aae13edd 100644
--- a/pkg/front_end/test/macro_application/data/tests/subtypes.dart
+++ b/pkg/front_end/test/macro_application/data/tests/subtypes.dart
@@ -19,6 +19,7 @@
 class D2 {}
 
 /*member: topLevelFunction1:
+
 void topLevelFunction1GeneratedMethod_es() {}
 
 augment A topLevelFunction1(A a, ) {
@@ -30,6 +31,7 @@
 external A topLevelFunction1(A a);
 
 /*member: topLevelFunction2:
+
 void topLevelFunction2GeneratedMethod_s() {}
 
 augment B2 topLevelFunction2(B1 a, ) {
@@ -41,6 +43,7 @@
 external B2 topLevelFunction2(B1 a);
 
 /*member: topLevelFunction3:
+
 void topLevelFunction3GeneratedMethod_() {}
 
 augment C2 topLevelFunction3(C1 a, ) {
@@ -52,6 +55,7 @@
 external C2 topLevelFunction3(C1 a);
 
 /*member: topLevelFunction4:
+
 void topLevelFunction4GeneratedMethod_() {}
 
 augment D2 topLevelFunction4(D1 a, ) {
diff --git a/pkg/front_end/test/macro_application/data/tests/type_annotations.dart b/pkg/front_end/test/macro_application/data/tests/type_annotations.dart
index b6a4cd8..35867d9 100644
--- a/pkg/front_end/test/macro_application/data/tests/type_annotations.dart
+++ b/pkg/front_end/test/macro_application/data/tests/type_annotations.dart
@@ -7,6 +7,7 @@
 import 'package:macro/macro.dart';
 
 /*member: topLevelFunction1:
+
 augment void topLevelFunction1() {
   return 42;
 }*/
@@ -14,6 +15,7 @@
 external void topLevelFunction1();
 
 /*member: topLevelFunction2:
+
 augment dynamic topLevelFunction2() {
   return 42;
 }*/
@@ -21,6 +23,7 @@
 external dynamic topLevelFunction2();
 
 /*member: topLevelFunction3:
+
 augment int topLevelFunction3() {
   return 42;
 }*/
@@ -28,6 +31,7 @@
 external int topLevelFunction3();
 
 /*member: topLevelFunction4:
+
 augment dynamic topLevelFunction4() {
   return 42;
 }*/
@@ -35,6 +39,7 @@
 external topLevelFunction4();
 
 /*member: topLevelFunction5:
+
 augment math.Random topLevelFunction5() {
   return 42;
 }*/
@@ -42,6 +47,7 @@
 external math.Random topLevelFunction5();
 
 /*member: topLevelFunction6:
+
 augment List<int> topLevelFunction6() {
   return 42;
 }*/
@@ -49,6 +55,7 @@
 external List<int> topLevelFunction6();
 
 /*member: topLevelFunction7:
+
 augment Map<math.Random, List<int>> topLevelFunction7() {
   return 42;
 }*/
@@ -56,6 +63,7 @@
 external Map<math.Random, List<int>> topLevelFunction7();
 
 /*member: topLevelFunction8:
+
 augment Map<int?, String>? topLevelFunction8() {
   return 42;
 }*/
diff --git a/pkg/front_end/test/macro_application/data/tests/types.dart b/pkg/front_end/test/macro_application/data/tests/types.dart
index 1d8ce17..2dbb05d 100644
--- a/pkg/front_end/test/macro_application/data/tests/types.dart
+++ b/pkg/front_end/test/macro_application/data/tests/types.dart
@@ -4,12 +4,33 @@
 
 import 'package:macro/macro.dart';
 
-@FunctionTypesMacro1()
 /*member: topLevelFunction1:
-class topLevelFunction1GeneratedClass {}*/
+class topLevelFunction1GeneratedClass<T extends void> {}*/
+@FunctionTypesMacro1()
 void topLevelFunction1() {}
 
-@FunctionTypesMacro1()
 /*member: topLevelFunction2:
-class topLevelFunction2GeneratedClass {}*/
-void topLevelFunction2() {}
+class topLevelFunction2GeneratedClass<T extends dynamic> {}*/
+@FunctionTypesMacro1()
+dynamic topLevelFunction2() {}
+
+/*member: topLevelFunction3:
+import 'dart:core' as i0;
+
+
+class topLevelFunction3GeneratedClass<T extends i0.int> {}*/
+@FunctionTypesMacro1()
+int topLevelFunction3() => 0;
+
+/*member: topLevelFunction4:
+import 'package:macro/macro.dart' as i0;
+
+
+class topLevelFunction4GeneratedClass<T extends i0.FunctionTypesMacro1?> {}*/
+@FunctionTypesMacro1()
+FunctionTypesMacro1? topLevelFunction4() => null;
+
+/*member: topLevelFunction5:
+class topLevelFunction5GeneratedClass<T extends dynamic> {}*/
+@FunctionTypesMacro1()
+topLevelFunction5() {}
diff --git a/pkg/front_end/test/macro_application/macro_application_test.dart b/pkg/front_end/test/macro_application/macro_application_test.dart
index a32cae5..a6b4a4f 100644
--- a/pkg/front_end/test/macro_application/macro_application_test.dart
+++ b/pkg/front_end/test/macro_application/macro_application_test.dart
@@ -104,12 +104,10 @@
         .dataForTesting!
         .macroApplicationData;
     StringBuffer sb = new StringBuffer();
-    for (MapEntry<SourceClassBuilder, List<MacroExecutionResult>> entry
+    for (MapEntry<SourceClassBuilder, String> entry
         in macroApplicationData.classTypesResults.entries) {
       if (entry.key.cls == cls) {
-        for (MacroExecutionResult result in entry.value) {
-          sb.write('\n${codeToString(result.augmentations.first)}');
-        }
+        sb.write('\n${entry.value.trim()}');
       }
     }
     for (MapEntry<SourceClassBuilder, List<MacroExecutionResult>> entry
@@ -148,12 +146,10 @@
         .dataForTesting!
         .macroApplicationData;
     StringBuffer sb = new StringBuffer();
-    for (MapEntry<MemberBuilder, List<MacroExecutionResult>> entry
+    for (MapEntry<MemberBuilder, String> entry
         in macroApplicationData.memberTypesResults.entries) {
       if (_isMember(entry.key, member)) {
-        for (MacroExecutionResult result in entry.value) {
-          sb.write('\n${codeToString(result.augmentations.first)}');
-        }
+        sb.write('\n${entry.value.trim()}');
       }
     }
     for (MapEntry<MemberBuilder, List<MacroExecutionResult>> entry
diff --git a/pkg/front_end/test/macros/macro_test.dart b/pkg/front_end/test/macros/macro_test.dart
index 910c3e1..514d77b 100644
--- a/pkg/front_end/test/macros/macro_test.dart
+++ b/pkg/front_end/test/macros/macro_test.dart
@@ -283,8 +283,7 @@
   @override
   String buildAugmentationLibrary(Iterable<MacroExecutionResult> macroResults,
       ResolvedIdentifier Function(Identifier) resolveIdentifier) {
-    // TODO: implement buildAugmentationLibrary
-    throw UnimplementedError();
+    return '';
   }
 
   @override
diff --git a/sdk/lib/core/errors.dart b/sdk/lib/core/errors.dart
index 00d69ce..d009f9a 100644
--- a/sdk/lib/core/errors.dart
+++ b/sdk/lib/core/errors.dart
@@ -462,6 +462,7 @@
 ///
 /// No longer used in Dart 2 where it has become a compile-time error
 /// to call the constructor of an abstract class.
+@Deprecated("No longer relevant in Dart 2.0")
 class AbstractClassInstantiationError extends Error {
   final String _className;
   AbstractClassInstantiationError(String className) : _className = className;
diff --git a/sdk/lib/mirrors/mirrors.dart b/sdk/lib/mirrors/mirrors.dart
index a10dd80..6e19487 100644
--- a/sdk/lib/mirrors/mirrors.dart
+++ b/sdk/lib/mirrors/mirrors.dart
@@ -56,9 +56,13 @@
  */
 library dart.mirrors;
 
+import "dart:core";
 import 'dart:async' show Future;
 import "dart:_internal" show Since;
 
+// TODO: Move AbstractClassInstantiationError here when removed from dart:core.
+export "dart:core" show AbstractClassInstantiationError;
+
 /**
  * A [MirrorSystem] is the main interface used to reflect on a set of
  * associated libraries.
diff --git a/tools/VERSION b/tools/VERSION
index a6e48bd..4400c24 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 17
 PATCH 0
-PRERELEASE 105
+PRERELEASE 106
 PRERELEASE_PATCH 0
\ No newline at end of file