[parser] Handle invalid extension type header in error recovery

This expands the existing recovery for class headers to handle
invalid, out-of-order, and duplicate clauses in extension type
declaration headers.

Change-Id: I7b33b91cc718e4c0673137121b8d083fa0ef1562
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321900
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index 46a19e8..f8642f1 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -4268,6 +4268,30 @@
         r"""The issue arises via this extension type declaration.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeExtensionTypeExtends = messageExtensionTypeExtends;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageExtensionTypeExtends = const MessageCode(
+    "ExtensionTypeExtends",
+    index: 164,
+    problemMessage:
+        r"""An extension type declaration can't have an 'extends' clause.""",
+    correctionMessage:
+        r"""Try removing the 'extends' clause or replacing the 'extends' with 'implements'.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeExtensionTypeWith = messageExtensionTypeWith;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageExtensionTypeWith = const MessageCode(
+    "ExtensionTypeWith",
+    index: 165,
+    problemMessage:
+        r"""An extension type declaration can't have a 'with' clause.""",
+    correctionMessage:
+        r"""Try removing the 'with' clause or replacing the 'with' with 'implements'.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const Code<Null> codeExternalClass = messageExternalClass;
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/declaration_kind.dart b/pkg/_fe_analyzer_shared/lib/src/parser/declaration_kind.dart
index d3547eb..3e3ab68 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/declaration_kind.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/declaration_kind.dart
@@ -21,3 +21,18 @@
   /// An enum.
   Enum,
 }
+
+/// Enum to specify in which declaration a header occurs.
+enum DeclarationHeaderKind {
+  /// Class declaration header, for instance `extends S with M implements I` in
+  ///
+  ///     class C extends S with M implements I {}
+  ///
+  Class,
+
+  /// Extension type declaration header, for instance `implements I` in
+  ///
+  ///     extension type E(T t) implements I {}
+  ///
+  ExtensionType,
+}
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart
index db12cf7..4cb37c7 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart
@@ -1918,8 +1918,8 @@
   }
 
   @override
-  void handleRecoverClassHeader() {
-    listener?.handleRecoverClassHeader();
+  void handleRecoverDeclarationHeader(DeclarationHeaderKind kind) {
+    listener?.handleRecoverDeclarationHeader(kind);
   }
 
   @override
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
index 621b2f2..1d95ffb 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
@@ -22,7 +22,7 @@
 
 import 'identifier_context.dart' show IdentifierContext;
 
-import 'declaration_kind.dart' show DeclarationKind;
+import 'declaration_kind.dart' show DeclarationHeaderKind, DeclarationKind;
 
 import 'member_kind.dart' show MemberKind;
 
@@ -174,7 +174,7 @@
     logEvent("ClassHeader");
   }
 
-  /// Handle recovery associated with a class header.
+  /// Handle recovery associated with a class or extension type header.
   /// This may be called multiple times after [handleClassHeader]
   /// to recover information about the previous class header.
   /// The substructures are a subset of
@@ -182,8 +182,8 @@
   /// - supertype
   /// - with clause
   /// - implemented types
-  void handleRecoverClassHeader() {
-    logEvent("RecoverClassHeader");
+  void handleRecoverDeclarationHeader(DeclarationHeaderKind kind) {
+    logEvent("RecoverDeclarationHeader");
   }
 
   /// Handle the end of a class declaration.  Substructures:
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/parser.dart b/pkg/_fe_analyzer_shared/lib/src/parser/parser.dart
index 3ed93de..57299d4 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/parser.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser.dart
@@ -29,7 +29,7 @@
 
 export 'listener.dart' show Listener;
 
-export 'declaration_kind.dart' show DeclarationKind;
+export 'declaration_kind.dart' show DeclarationHeaderKind, DeclarationKind;
 
 export 'directive_context.dart' show DirectiveContext;
 
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
index 6109ee9..1eb940d 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
@@ -4,8 +4,6 @@
 
 library _fe_analyzer_shared.parser.parser;
 
-import 'package:_fe_analyzer_shared/src/parser/type_info_impl.dart';
-
 import '../experiments/flags.dart';
 
 import '../messages/codes.dart' as codes;
@@ -63,7 +61,7 @@
 
 import 'constructor_reference_context.dart' show ConstructorReferenceContext;
 
-import 'declaration_kind.dart' show DeclarationKind;
+import 'declaration_kind.dart' show DeclarationHeaderKind, DeclarationKind;
 
 import 'directive_context.dart';
 
@@ -99,7 +97,7 @@
 
 import 'recovery_listeners.dart'
     show
-        ClassHeaderRecoveryListener,
+        DeclarationHeaderRecoveryListener,
         ImportRecoveryListener,
         MixinHeaderRecoveryListener;
 
@@ -122,6 +120,8 @@
         noType,
         noTypeParamOrArg;
 
+import 'type_info_impl.dart';
+
 import 'util.dart'
     show
         findNonZeroLengthToken,
@@ -2667,7 +2667,7 @@
   }
 
   Token parseClassHeaderOpt(Token token, Token begin, Token classKeyword) {
-    token = parseClassExtendsOpt(token);
+    token = parseClassExtendsOpt(token, DeclarationHeaderKind.Class);
     token = parseClassWithClauseOpt(token);
     token = parseClassOrMixinOrEnumImplementsOpt(token);
     Token? nativeToken;
@@ -2681,14 +2681,33 @@
 
   /// Recover given out-of-order clauses in a class header.
   Token parseClassHeaderRecovery(Token token, Token begin, Token classKeyword) {
+    return parseDeclarationHeaderRecoveryInternal(
+        token, begin, classKeyword, DeclarationHeaderKind.Class);
+  }
+
+  /// Recover given out-of-order clauses in an extension type header.
+  Token parseExtensionTypeHeaderRecovery(Token token, Token extensionKeyword) {
+    return parseDeclarationHeaderRecoveryInternal(token, extensionKeyword,
+        extensionKeyword, DeclarationHeaderKind.ExtensionType);
+  }
+
+  /// Recover given out-of-order clauses in a class, enum, mixin, extension, or
+  /// extension type header.
+  Token parseDeclarationHeaderRecoveryInternal(Token token, Token begin,
+      Token declarationKeyword, DeclarationHeaderKind kind) {
     final Listener primaryListener = listener;
-    final ClassHeaderRecoveryListener recoveryListener =
-        new ClassHeaderRecoveryListener();
+    final DeclarationHeaderRecoveryListener recoveryListener =
+        new DeclarationHeaderRecoveryListener();
 
     // Reparse to determine which clauses have already been parsed
     // but intercept the events so they are not sent to the primary listener.
     listener = recoveryListener;
-    token = parseClassHeaderOpt(token, begin, classKeyword);
+    switch (kind) {
+      case DeclarationHeaderKind.Class:
+        token = parseClassHeaderOpt(token, begin, declarationKeyword);
+      case DeclarationHeaderKind.ExtensionType:
+        token = parseClassOrMixinOrEnumImplementsOpt(token);
+    }
     bool hasExtends = recoveryListener.extendsKeyword != null;
     bool hasImplements = recoveryListener.implementsKeyword != null;
     bool hasWith = recoveryListener.withKeyword != null;
@@ -2702,7 +2721,7 @@
     do {
       start = token;
 
-      // Check for extraneous token in the middle of a class header.
+      // Check for extraneous token in the middle of a declaration header.
       token = skipUnexpectedTokenOpt(
           token, const <String>['extends', 'with', 'implements', '{']);
 
@@ -2714,39 +2733,51 @@
           const ['extend', 'on'].contains(token.next!.lexeme)) {
         reportRecoverableError(token.next!,
             codes.templateExpectedInstead.withArguments('extends'));
-        token = parseClassExtendsSeenExtendsClause(token.next!, token);
+        token = parseClassExtendsSeenExtendsClause(token.next!, token, kind);
       } else {
-        token = parseClassExtendsOpt(token);
+        token = parseClassExtendsOpt(token, kind);
       }
 
       if (recoveryListener.extendsKeyword != null) {
-        if (hasExtends) {
-          reportRecoverableError(
-              recoveryListener.extendsKeyword!, codes.messageMultipleExtends);
-        } else {
-          if (hasWith) {
+        switch (kind) {
+          case DeclarationHeaderKind.Class:
+            if (hasExtends) {
+              reportRecoverableError(recoveryListener.extendsKeyword!,
+                  codes.messageMultipleExtends);
+            } else {
+              if (hasWith) {
+                reportRecoverableError(recoveryListener.extendsKeyword!,
+                    codes.messageWithBeforeExtends);
+              } else if (hasImplements) {
+                reportRecoverableError(recoveryListener.extendsKeyword!,
+                    codes.messageImplementsBeforeExtends);
+              }
+              hasExtends = true;
+            }
+          case DeclarationHeaderKind.ExtensionType:
             reportRecoverableError(recoveryListener.extendsKeyword!,
-                codes.messageWithBeforeExtends);
-          } else if (hasImplements) {
-            reportRecoverableError(recoveryListener.extendsKeyword!,
-                codes.messageImplementsBeforeExtends);
-          }
-          hasExtends = true;
+                codes.messageExtensionTypeExtends);
         }
       }
 
       token = parseClassWithClauseOpt(token);
 
       if (recoveryListener.withKeyword != null) {
-        if (hasWith) {
-          reportRecoverableError(
-              recoveryListener.withKeyword!, codes.messageMultipleWith);
-        } else {
-          if (hasImplements) {
-            reportRecoverableError(recoveryListener.withKeyword!,
-                codes.messageImplementsBeforeWith);
-          }
-          hasWith = true;
+        switch (kind) {
+          case DeclarationHeaderKind.Class:
+            if (hasWith) {
+              reportRecoverableError(
+                  recoveryListener.withKeyword!, codes.messageMultipleWith);
+            } else {
+              if (hasImplements) {
+                reportRecoverableError(recoveryListener.withKeyword!,
+                    codes.messageImplementsBeforeWith);
+              }
+              hasWith = true;
+            }
+          case DeclarationHeaderKind.ExtensionType:
+            reportRecoverableError(
+                recoveryListener.withKeyword!, codes.messageExtensionTypeWith);
         }
       }
 
@@ -2761,20 +2792,20 @@
         }
       }
 
-      listener.handleRecoverClassHeader();
+      listener.handleRecoverDeclarationHeader(kind);
 
-      // Exit if a class body is detected, or if no progress has been made
+      // Exit if a declaration body is detected, or if no progress has been made
     } while (!optional('{', token.next!) && start != token);
 
     listener = primaryListener;
     return token;
   }
 
-  Token parseClassExtendsOpt(Token token) {
+  Token parseClassExtendsOpt(Token token, DeclarationHeaderKind kind) {
     // extends <typeNotVoid>
     Token next = token.next!;
     if (optional('extends', next)) {
-      token = parseClassExtendsSeenExtendsClause(next, token);
+      token = parseClassExtendsSeenExtendsClause(next, token, kind);
     } else {
       listener.handleNoType(token);
       listener.handleClassExtends(
@@ -2785,7 +2816,8 @@
     return token;
   }
 
-  Token parseClassExtendsSeenExtendsClause(Token extendsKeyword, Token token) {
+  Token parseClassExtendsSeenExtendsClause(
+      Token extendsKeyword, Token token, DeclarationHeaderKind kind) {
     Token next = extendsKeyword;
     token =
         computeType(next, /* required = */ true).ensureTypeNotVoid(next, this);
@@ -2793,7 +2825,14 @@
 
     // Error recovery: extends <typeNotVoid>, <typeNotVoid> [...]
     if (optional(',', token.next!)) {
-      reportRecoverableError(token.next!, codes.messageMultipleExtends);
+      switch (kind) {
+        case DeclarationHeaderKind.Class:
+          reportRecoverableError(token.next!, codes.messageMultipleExtends);
+          break;
+        case DeclarationHeaderKind.ExtensionType:
+          // This is an error case. The error is reported elsewhere.
+          break;
+      }
 
       while (optional(',', token.next!)) {
         next = token.next!;
@@ -3117,10 +3156,10 @@
       reportRecoverableError(token, codes.messageMissingPrimaryConstructor);
       listener.handleNoPrimaryConstructor(token, constKeyword);
     }
+    Token start = token;
     token = parseClassOrMixinOrEnumImplementsOpt(token);
     if (!optional('{', token.next!)) {
-      // TODO(johnniwinther): Reuse logic from [parseClassHeaderRecovery] to
-      // handle `extends`, `with` and out-of-order/duplicate clauses.
+      token = parseExtensionTypeHeaderRecovery(start, extensionKeyword);
 
       // Recovery
       ensureBlock(token, /* template = */ null, 'extension type declaration');
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/recovery_listeners.dart b/pkg/_fe_analyzer_shared/lib/src/parser/recovery_listeners.dart
index ac51a8e..42a5e85 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/recovery_listeners.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/recovery_listeners.dart
@@ -6,7 +6,7 @@
 
 import 'forwarding_listener.dart' show ForwardingListener;
 
-class ClassHeaderRecoveryListener extends ForwardingListener {
+class DeclarationHeaderRecoveryListener extends ForwardingListener {
   Token? extendsKeyword;
   Token? implementsKeyword;
   Token? withKeyword;
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart
index e24829c..66479d6 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/stack_listener.dart
@@ -19,6 +19,7 @@
 
 import '../util/stack_checker.dart';
 import '../util/value_kind.dart';
+import 'declaration_kind.dart';
 import 'identifier_context.dart' show IdentifierContext;
 
 import 'parser.dart' show Listener, MemberKind, lengthOfSpan;
@@ -254,7 +255,7 @@
   }
 
   @override
-  void handleRecoverClassHeader() {
+  void handleRecoverDeclarationHeader(DeclarationHeaderKind kind) {
     debugEvent("RecoverClassHeader");
   }
 
diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
index 27a6086..7333a84 100644
--- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
+++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
@@ -2716,6 +2716,10 @@
   status: needsFix
   notes: |-
     Remove the field, or add `static`.
+ParserErrorCode.EXTENSION_TYPE_EXTENDS:
+  status: needsEvaluation
+ParserErrorCode.EXTENSION_TYPE_WITH:
+  status: needsEvaluation
 ParserErrorCode.EXTERNAL_CLASS:
   status: needsFix
   notes: |-
diff --git a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
index 6bd0ffd..e7d573f 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
@@ -182,6 +182,8 @@
   ParserErrorCode.ILLEGAL_PATTERN_IDENTIFIER_NAME,
   ParserErrorCode.MISSING_PRIMARY_CONSTRUCTOR,
   ParserErrorCode.MISSING_PRIMARY_CONSTRUCTOR_PARAMETERS,
+  ParserErrorCode.EXTENSION_TYPE_EXTENDS,
+  ParserErrorCode.EXTENSION_TYPE_WITH,
 ];
 
 class ParserErrorCode extends ErrorCode {
@@ -699,6 +701,22 @@
     hasPublishedDocs: true,
   );
 
+  static const ParserErrorCode EXTENSION_TYPE_EXTENDS = ParserErrorCode(
+    'EXTENSION_TYPE_EXTENDS',
+    "An extension type declaration can't have an 'extends' clause.",
+    correctionMessage:
+        "Try removing the 'extends' clause or replacing the 'extends' with "
+        "'implements'.",
+  );
+
+  static const ParserErrorCode EXTENSION_TYPE_WITH = ParserErrorCode(
+    'EXTENSION_TYPE_WITH',
+    "An extension type declaration can't have a 'with' clause.",
+    correctionMessage:
+        "Try removing the 'with' clause or replacing the 'with' with "
+        "'implements'.",
+  );
+
   static const ParserErrorCode EXTERNAL_CLASS = ParserErrorCode(
     'EXTERNAL_CLASS',
     "Classes can't be declared to be 'external'.",
diff --git a/pkg/analyzer/lib/src/error/error_code_values.g.dart b/pkg/analyzer/lib/src/error/error_code_values.g.dart
index 7505d86..56b29b5 100644
--- a/pkg/analyzer/lib/src/error/error_code_values.g.dart
+++ b/pkg/analyzer/lib/src/error/error_code_values.g.dart
@@ -705,6 +705,8 @@
   ParserErrorCode.EXTENSION_DECLARES_ABSTRACT_MEMBER,
   ParserErrorCode.EXTENSION_DECLARES_CONSTRUCTOR,
   ParserErrorCode.EXTENSION_DECLARES_INSTANCE_FIELD,
+  ParserErrorCode.EXTENSION_TYPE_EXTENDS,
+  ParserErrorCode.EXTENSION_TYPE_WITH,
   ParserErrorCode.EXTERNAL_CLASS,
   ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY,
   ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_INITIALIZER,
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 5ffb58a..9b06600 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -38,6 +38,7 @@
         Assert,
         BlockKind,
         ConstructorReferenceContext,
+        DeclarationHeaderKind,
         DeclarationKind,
         FormalParameterKind,
         IdentifierContext,
@@ -5095,46 +5096,52 @@
   }
 
   @override
-  void handleRecoverClassHeader() {
+  void handleRecoverDeclarationHeader(DeclarationHeaderKind kind) {
     debugEvent("RecoverClassHeader");
 
     var implementsClause =
         pop(NullValues.IdentifierList) as ImplementsClauseImpl?;
     var withClause = pop(NullValues.WithClause) as WithClauseImpl?;
     var extendsClause = pop(NullValues.ExtendsClause) as ExtendsClauseImpl?;
-    var declaration = _classLikeBuilder as _ClassDeclarationBuilder;
-    if (extendsClause != null) {
-      if (declaration.extendsClause?.superclass == null) {
-        declaration.extendsClause = extendsClause;
-      }
-    }
-    if (withClause != null) {
-      final existingClause = declaration.withClause;
-      if (existingClause == null) {
-        declaration.withClause = withClause;
-      } else {
-        declaration.withClause = WithClauseImpl(
-          withKeyword: existingClause.withKeyword,
-          mixinTypes: [
-            ...existingClause.mixinTypes,
-            ...withClause.mixinTypes,
-          ],
-        );
-      }
-    }
-    if (implementsClause != null) {
-      final existingClause = declaration.implementsClause;
-      if (existingClause == null) {
-        declaration.implementsClause = implementsClause;
-      } else {
-        declaration.implementsClause = ImplementsClauseImpl(
-          implementsKeyword: existingClause.implementsKeyword,
-          interfaces: [
-            ...existingClause.interfaces,
-            ...implementsClause.interfaces,
-          ],
-        );
-      }
+    switch (kind) {
+      case DeclarationHeaderKind.Class:
+        var declaration = _classLikeBuilder as _ClassDeclarationBuilder;
+        if (extendsClause != null) {
+          if (declaration.extendsClause?.superclass == null) {
+            declaration.extendsClause = extendsClause;
+          }
+        }
+        if (withClause != null) {
+          final existingClause = declaration.withClause;
+          if (existingClause == null) {
+            declaration.withClause = withClause;
+          } else {
+            declaration.withClause = WithClauseImpl(
+              withKeyword: existingClause.withKeyword,
+              mixinTypes: [
+                ...existingClause.mixinTypes,
+                ...withClause.mixinTypes,
+              ],
+            );
+          }
+        }
+        if (implementsClause != null) {
+          final existingClause = declaration.implementsClause;
+          if (existingClause == null) {
+            declaration.implementsClause = implementsClause;
+          } else {
+            declaration.implementsClause = ImplementsClauseImpl(
+              implementsKeyword: existingClause.implementsKeyword,
+              interfaces: [
+                ...existingClause.interfaces,
+                ...implementsClause.interfaces,
+              ],
+            );
+          }
+        }
+      case DeclarationHeaderKind.ExtensionType:
+      // TODO(scheglov): Support header recovery on extension type
+      //  declaration.
     }
   }
 
diff --git a/pkg/analyzer/test/generated/parser_fasta_listener.dart b/pkg/analyzer/test/generated/parser_fasta_listener.dart
index 3d3e2c3..f09d1a9 100644
--- a/pkg/analyzer/test/generated/parser_fasta_listener.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_listener.dart
@@ -1478,9 +1478,9 @@
   }
 
   @override
-  void handleRecoverClassHeader() {
+  void handleRecoverDeclarationHeader(DeclarationHeaderKind kind) {
     expectIn('ClassDeclaration');
-    listener?.handleRecoverClassHeader();
+    listener?.handleRecoverDeclarationHeader(kind);
   }
 
   @override
diff --git a/pkg/analyzer/tool/summary/mini_ast.dart b/pkg/analyzer/tool/summary/mini_ast.dart
index 6fd56bd..69b1268 100644
--- a/pkg/analyzer/tool/summary/mini_ast.dart
+++ b/pkg/analyzer/tool/summary/mini_ast.dart
@@ -581,7 +581,7 @@
   }
 
   @override
-  void handleRecoverClassHeader() {
+  void handleRecoverDeclarationHeader(DeclarationHeaderKind kind) {
     pop(); // superclass
   }
 
diff --git a/pkg/front_end/lib/src/fasta/kernel/macro/annotation_parser.dart b/pkg/front_end/lib/src/fasta/kernel/macro/annotation_parser.dart
index 0965182..2b45df3 100644
--- a/pkg/front_end/lib/src/fasta/kernel/macro/annotation_parser.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/macro/annotation_parser.dart
@@ -2124,7 +2124,7 @@
   }
 
   @override
-  void handleRecoverClassHeader() {
+  void handleRecoverDeclarationHeader(DeclarationHeaderKind kind) {
     _unexpected();
   }
 
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
index 01386e5..5410993 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -8,11 +8,12 @@
     show
         Assert,
         ConstructorReferenceContext,
+        DeclarationHeaderKind,
         DeclarationKind,
         FormalParameterKind,
         IdentifierContext,
-        lengthOfSpan,
         MemberKind,
+        lengthOfSpan,
         optional;
 import 'package:_fe_analyzer_shared/src/parser/quote.dart' show unescapeString;
 import 'package:_fe_analyzer_shared/src/parser/stack_listener.dart'
@@ -1159,7 +1160,7 @@
   }
 
   @override
-  void handleRecoverClassHeader() {
+  void handleRecoverDeclarationHeader(DeclarationHeaderKind kind) {
     debugEvent("handleRecoverClassHeader");
     assert(checkState(null, [
       /* interfaces */ ValueKinds.TypeBuilderListOrNull,
diff --git a/pkg/front_end/lib/src/fasta/util/parser_ast_helper.dart b/pkg/front_end/lib/src/fasta/util/parser_ast_helper.dart
index 8e1b480..9c27587 100644
--- a/pkg/front_end/lib/src/fasta/util/parser_ast_helper.dart
+++ b/pkg/front_end/lib/src/fasta/util/parser_ast_helper.dart
@@ -223,9 +223,9 @@
   }
 
   @override
-  void handleRecoverClassHeader() {
-    RecoverClassHeaderHandle data =
-        new RecoverClassHeaderHandle(ParserAstType.HANDLE);
+  void handleRecoverDeclarationHeader(DeclarationHeaderKind kind) {
+    RecoverDeclarationHeaderHandle data =
+        new RecoverDeclarationHeaderHandle(ParserAstType.HANDLE, kind: kind);
     seen(data);
   }
 
@@ -3442,12 +3442,16 @@
       };
 }
 
-class RecoverClassHeaderHandle extends ParserAstNode {
-  RecoverClassHeaderHandle(ParserAstType type)
-      : super("RecoverClassHeader", type);
+class RecoverDeclarationHeaderHandle extends ParserAstNode {
+  final DeclarationHeaderKind kind;
+
+  RecoverDeclarationHeaderHandle(ParserAstType type, {required this.kind})
+      : super("RecoverDeclarationHeader", type);
 
   @override
-  Map<String, Object?> get deprecatedArguments => {};
+  Map<String, Object?> get deprecatedArguments => {
+        "kind": kind,
+      };
 }
 
 class ClassDeclarationEnd extends ParserAstNode {
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index d7d4091..2f5a9e2 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -7116,3 +7116,23 @@
   experiments: inline-class
   script: |
     extension type E.name {}
+
+ExtensionTypeExtends:
+  problemMessage: "An extension type declaration can't have an 'extends' clause."
+  correctionMessage: "Try removing the 'extends' clause or replacing the 'extends' with 'implements'."
+  index: 164
+  analyzerCode: ParserErrorCode.EXTENSION_TYPE_EXTENDS
+  experiments: inline-class
+  script: |
+    extension type F(int i) {}
+    extension type E(int i) extends F {}
+
+ExtensionTypeWith:
+  problemMessage: "An extension type declaration can't have a 'with' clause."
+  correctionMessage: "Try removing the 'with' clause or replacing the 'with' with 'implements'."
+  index: 165
+  analyzerCode: ParserErrorCode.EXTENSION_TYPE_WITH
+  experiments: inline-class
+  script: |
+    extension type F(int i) {}
+    extension type E(int i) with F {}
diff --git a/pkg/front_end/parser_testcases/augmentation/augment_super.dart.intertwined.expect b/pkg/front_end/parser_testcases/augmentation/augment_super.dart.intertwined.expect
index 127f94a..3951b88 100644
--- a/pkg/front_end/parser_testcases/augmentation/augment_super.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/augmentation/augment_super.dart.intertwined.expect
@@ -420,7 +420,7 @@
         listener: beginClassDeclaration(augment, null, null, null, null, null, null, augment, null, Class)
         parseClass(Class, augment, class, Class)
           parseClassHeaderOpt(Class, augment, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
diff --git a/pkg/front_end/parser_testcases/augmentation/member_declarations.dart.intertwined.expect b/pkg/front_end/parser_testcases/augmentation/member_declarations.dart.intertwined.expect
index d645e04..5095301 100644
--- a/pkg/front_end/parser_testcases/augmentation/member_declarations.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/augmentation/member_declarations.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Class)
         parseClass(Class, class, class, Class)
           parseClassHeaderOpt(Class, class, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
diff --git a/pkg/front_end/parser_testcases/augmentation/member_errors.dart.intertwined.expect b/pkg/front_end/parser_testcases/augmentation/member_errors.dart.intertwined.expect
index 0c866b1..6b33a12 100644
--- a/pkg/front_end/parser_testcases/augmentation/member_errors.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/augmentation/member_errors.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Class)
         parseClass(Class, class, class, Class)
           parseClassHeaderOpt(Class, class, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
diff --git a/pkg/front_end/parser_testcases/augmentation/top_level_declarations.dart.intertwined.expect b/pkg/front_end/parser_testcases/augmentation/top_level_declarations.dart.intertwined.expect
index df950d7..a437e9e 100644
--- a/pkg/front_end/parser_testcases/augmentation/top_level_declarations.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/augmentation/top_level_declarations.dart.intertwined.expect
@@ -343,7 +343,7 @@
         listener: beginClassDeclaration(augment, null, null, null, null, null, null, augment, null, Class)
         parseClass(Class, augment, class, Class)
           parseClassHeaderOpt(Class, augment, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
@@ -370,7 +370,7 @@
         listener: beginClassDeclaration(abstract, abstract, null, null, null, null, null, augment, null, Class)
         parseClass(Class, abstract, class, Class)
           parseClassHeaderOpt(Class, abstract, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
diff --git a/pkg/front_end/parser_testcases/augmentation/top_level_errors.dart.intertwined.expect b/pkg/front_end/parser_testcases/augmentation/top_level_errors.dart.intertwined.expect
index 34771c4..8393a7e 100644
--- a/pkg/front_end/parser_testcases/augmentation/top_level_errors.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/augmentation/top_level_errors.dart.intertwined.expect
@@ -707,7 +707,7 @@
         listener: beginClassDeclaration(augment, null, null, null, null, null, null, augment, null, Class)
         parseClass(Class, augment, class, Class)
           parseClassHeaderOpt(Class, augment, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
@@ -736,7 +736,7 @@
         listener: beginClassDeclaration(abstract, abstract, null, null, null, null, null, augment, null, Class)
         parseClass(Class, abstract, class, Class)
           parseClassHeaderOpt(Class, abstract, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
diff --git a/pkg/front_end/parser_testcases/class_modifiers/base/base_class_declaration.dart.intertwined.expect b/pkg/front_end/parser_testcases/class_modifiers/base/base_class_declaration.dart.intertwined.expect
index 730403f..440f100 100644
--- a/pkg/front_end/parser_testcases/class_modifiers/base/base_class_declaration.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/class_modifiers/base/base_class_declaration.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(base, null, null, null, base, null, null, null, null, A)
         parseClass(A, base, class, A)
           parseClassHeaderOpt(A, base, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -42,7 +42,7 @@
         listener: beginClassDeclaration(abstract, abstract, null, null, base, null, null, null, null, B)
         parseClass(B, abstract, class, B)
           parseClassHeaderOpt(B, abstract, class)
-            parseClassExtendsOpt(B)
+            parseClassExtendsOpt(B, DeclarationHeaderKind.Class)
               listener: handleNoType(B)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(B)
diff --git a/pkg/front_end/parser_testcases/class_modifiers/final/final_class_declaration.dart.intertwined.expect b/pkg/front_end/parser_testcases/class_modifiers/final/final_class_declaration.dart.intertwined.expect
index e913ca3..33887d8 100644
--- a/pkg/front_end/parser_testcases/class_modifiers/final/final_class_declaration.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/class_modifiers/final/final_class_declaration.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(final, null, null, null, null, null, final, null, null, A)
         parseClass(A, final, class, A)
           parseClassHeaderOpt(A, final, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -42,7 +42,7 @@
         listener: beginClassDeclaration(abstract, abstract, null, null, null, null, final, null, null, B)
         parseClass(B, abstract, class, B)
           parseClassHeaderOpt(B, abstract, class)
-            parseClassExtendsOpt(B)
+            parseClassExtendsOpt(B, DeclarationHeaderKind.Class)
               listener: handleNoType(B)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(B)
diff --git a/pkg/front_end/parser_testcases/class_modifiers/interface/interface_class_declaration.dart.intertwined.expect b/pkg/front_end/parser_testcases/class_modifiers/interface/interface_class_declaration.dart.intertwined.expect
index 4b9b030..667d1e8 100644
--- a/pkg/front_end/parser_testcases/class_modifiers/interface/interface_class_declaration.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/class_modifiers/interface/interface_class_declaration.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(interface, null, null, null, null, interface, null, null, null, A)
         parseClass(A, interface, class, A)
           parseClassHeaderOpt(A, interface, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -42,7 +42,7 @@
         listener: beginClassDeclaration(abstract, abstract, null, null, null, interface, null, null, null, B)
         parseClass(B, abstract, class, B)
           parseClassHeaderOpt(B, abstract, class)
-            parseClassExtendsOpt(B)
+            parseClassExtendsOpt(B, DeclarationHeaderKind.Class)
               listener: handleNoType(B)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(B)
diff --git a/pkg/front_end/parser_testcases/class_modifiers/mixin/mixin_class.dart.intertwined.expect b/pkg/front_end/parser_testcases/class_modifiers/mixin/mixin_class.dart.intertwined.expect
index 9a6d483..7611f95 100644
--- a/pkg/front_end/parser_testcases/class_modifiers/mixin/mixin_class.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/class_modifiers/mixin/mixin_class.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(mixin, null, null, null, null, null, null, null, mixin, A)
         parseClass(A, mixin, class, A)
           parseClassHeaderOpt(A, mixin, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -42,7 +42,7 @@
         listener: beginClassDeclaration(abstract, abstract, null, null, null, null, null, null, mixin, B)
         parseClass(B, abstract, class, B)
           parseClassHeaderOpt(B, abstract, class)
-            parseClassExtendsOpt(B)
+            parseClassExtendsOpt(B, DeclarationHeaderKind.Class)
               listener: handleNoType(B)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(B)
diff --git a/pkg/front_end/parser_testcases/error_recovery/bracket_mismatch_01.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/bracket_mismatch_01.dart.intertwined.expect
index 7f6be11..2e2b678 100644
--- a/pkg/front_end/parser_testcases/error_recovery/bracket_mismatch_01.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/bracket_mismatch_01.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
@@ -266,7 +266,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, D)
         parseClass(D, class, class, D)
           parseClassHeaderOpt(D, class, class)
-            parseClassExtendsOpt(D)
+            parseClassExtendsOpt(D, DeclarationHeaderKind.Class)
               listener: handleNoType(D)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(D)
diff --git a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_general.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_general.crash_dart.intertwined.expect
index 663b95b..303ba2b 100644
--- a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_general.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_general.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_get.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_get.crash_dart.intertwined.expect
index 3f3a75d..4748cdb 100644
--- a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_get.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_get.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_return_type.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_return_type.crash_dart.intertwined.expect
index 164c6a9..b3e7030 100644
--- a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_return_type.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_return_type.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_set.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_set.crash_dart.intertwined.expect
index f40d535..caf277a 100644
--- a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_set.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_bad_name_set.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_get.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_get.dart.intertwined.expect
index 6741ec9..83bc2d4 100644
--- a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_get.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_get.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_ok.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_ok.dart.intertwined.expect
index 8d7bc37..292e36b 100644
--- a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_ok.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_ok.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_operator.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_operator.crash_dart.intertwined.expect
index e44a226..9ab4077 100644
--- a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_operator.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_operator.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_return_type.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_return_type.dart.intertwined.expect
index 3d00f62..b66c092 100644
--- a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_return_type.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_return_type.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_set.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_set.dart.intertwined.expect
index d8cbdeb..5618949 100644
--- a/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_set.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/constructor_recovery_set.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_000032.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_000032.dart.intertwined.expect
index 133cc8a..9cfd6d9 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_000032.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_000032.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_22313.dart.expect b/pkg/front_end/parser_testcases/error_recovery/issue_22313.dart.expect
index 0da3683..e6f4758 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_22313.dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_22313.dart.expect
@@ -109,7 +109,7 @@
       handleClassExtends(extend, 2)
       handleClassNoWithClause()
       handleImplements(null, 0)
-      handleRecoverClassHeader()
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.Class)
       beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
         beginMetadataStar(Bar)
         endMetadataStar(0)
@@ -151,7 +151,7 @@
       handleClassExtends(on, 2)
       handleClassNoWithClause()
       handleImplements(null, 0)
-      handleRecoverClassHeader()
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.Class)
       beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
         beginMetadataStar(Baz)
         endMetadataStar(0)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_22313.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_22313.dart.intertwined.expect
index 78d4026..5311b11 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_22313.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_22313.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -42,7 +42,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, B)
         parseClass(B, class, class, B)
           parseClassHeaderOpt(B, class, class)
-            parseClassExtendsOpt(B)
+            parseClassExtendsOpt(B, DeclarationHeaderKind.Class)
               listener: handleNoType(B)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(B)
@@ -69,8 +69,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
-              parseClassExtendsSeenExtendsClause(extends, Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, Foo, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments(,)
                 listener: handleType(A, null)
@@ -136,7 +136,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Bar)
         parseClass(Bar, class, class, Bar)
           parseClassHeaderOpt(Bar, class, class)
-            parseClassExtendsOpt(Bar)
+            parseClassExtendsOpt(Bar, DeclarationHeaderKind.Class)
               listener: handleNoType(Bar)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Bar)
@@ -145,28 +145,29 @@
               listener: handleImplements(null, 0)
             listener: handleClassHeader(class, class, null)
           parseClassHeaderRecovery(Bar, class, class)
-            parseClassHeaderOpt(Bar, class, class)
-              parseClassExtendsOpt(Bar)
-              parseClassWithClauseOpt(Bar)
-              parseClassOrMixinOrEnumImplementsOpt(Bar)
-            skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
-            reportRecoverableError(extend, Message[ExpectedInstead, Expected 'extends' instead of this., null, {string: extends}])
-              listener: handleRecoverableError(Message[ExpectedInstead, Expected 'extends' instead of this., null, {string: extends}], extend, extend)
-            parseClassExtendsSeenExtendsClause(extend, Bar)
-              listener: handleIdentifier(A, typeReference)
-              listener: handleNoTypeArguments(,)
-              listener: handleType(A, null)
-              reportRecoverableError(,, MultipleExtends)
-                listener: handleRecoverableError(MultipleExtends, ,, ,)
-              listener: handleIdentifier(B, typeReference)
-              listener: handleNoTypeArguments({)
-              listener: handleType(B, null)
-              listener: handleClassExtends(extend, 2)
-            parseClassWithClauseOpt(B)
-              listener: handleClassNoWithClause()
-            parseClassOrMixinOrEnumImplementsOpt(B)
-              listener: handleImplements(null, 0)
-            listener: handleRecoverClassHeader()
+            parseDeclarationHeaderRecoveryInternal(Bar, class, class, DeclarationHeaderKind.Class)
+              parseClassHeaderOpt(Bar, class, class)
+                parseClassExtendsOpt(Bar, DeclarationHeaderKind.Class)
+                parseClassWithClauseOpt(Bar)
+                parseClassOrMixinOrEnumImplementsOpt(Bar)
+              skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
+              reportRecoverableError(extend, Message[ExpectedInstead, Expected 'extends' instead of this., null, {string: extends}])
+                listener: handleRecoverableError(Message[ExpectedInstead, Expected 'extends' instead of this., null, {string: extends}], extend, extend)
+              parseClassExtendsSeenExtendsClause(extend, Bar, DeclarationHeaderKind.Class)
+                listener: handleIdentifier(A, typeReference)
+                listener: handleNoTypeArguments(,)
+                listener: handleType(A, null)
+                reportRecoverableError(,, MultipleExtends)
+                  listener: handleRecoverableError(MultipleExtends, ,, ,)
+                listener: handleIdentifier(B, typeReference)
+                listener: handleNoTypeArguments({)
+                listener: handleType(B, null)
+                listener: handleClassExtends(extend, 2)
+              parseClassWithClauseOpt(B)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(B)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.Class)
           ensureBlock(B, null, class declaration)
           parseClassOrMixinOrExtensionBody(B, DeclarationKind.Class, Bar)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
@@ -219,7 +220,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Baz)
         parseClass(Baz, class, class, Baz)
           parseClassHeaderOpt(Baz, class, class)
-            parseClassExtendsOpt(Baz)
+            parseClassExtendsOpt(Baz, DeclarationHeaderKind.Class)
               listener: handleNoType(Baz)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Baz)
@@ -228,28 +229,29 @@
               listener: handleImplements(null, 0)
             listener: handleClassHeader(class, class, null)
           parseClassHeaderRecovery(Baz, class, class)
-            parseClassHeaderOpt(Baz, class, class)
-              parseClassExtendsOpt(Baz)
-              parseClassWithClauseOpt(Baz)
-              parseClassOrMixinOrEnumImplementsOpt(Baz)
-            skipUnexpectedTokenOpt(Baz, [extends, with, implements, {])
-            reportRecoverableError(on, Message[ExpectedInstead, Expected 'extends' instead of this., null, {string: extends}])
-              listener: handleRecoverableError(Message[ExpectedInstead, Expected 'extends' instead of this., null, {string: extends}], on, on)
-            parseClassExtendsSeenExtendsClause(on, Baz)
-              listener: handleIdentifier(A, typeReference)
-              listener: handleNoTypeArguments(,)
-              listener: handleType(A, null)
-              reportRecoverableError(,, MultipleExtends)
-                listener: handleRecoverableError(MultipleExtends, ,, ,)
-              listener: handleIdentifier(B, typeReference)
-              listener: handleNoTypeArguments({)
-              listener: handleType(B, null)
-              listener: handleClassExtends(on, 2)
-            parseClassWithClauseOpt(B)
-              listener: handleClassNoWithClause()
-            parseClassOrMixinOrEnumImplementsOpt(B)
-              listener: handleImplements(null, 0)
-            listener: handleRecoverClassHeader()
+            parseDeclarationHeaderRecoveryInternal(Baz, class, class, DeclarationHeaderKind.Class)
+              parseClassHeaderOpt(Baz, class, class)
+                parseClassExtendsOpt(Baz, DeclarationHeaderKind.Class)
+                parseClassWithClauseOpt(Baz)
+                parseClassOrMixinOrEnumImplementsOpt(Baz)
+              skipUnexpectedTokenOpt(Baz, [extends, with, implements, {])
+              reportRecoverableError(on, Message[ExpectedInstead, Expected 'extends' instead of this., null, {string: extends}])
+                listener: handleRecoverableError(Message[ExpectedInstead, Expected 'extends' instead of this., null, {string: extends}], on, on)
+              parseClassExtendsSeenExtendsClause(on, Baz, DeclarationHeaderKind.Class)
+                listener: handleIdentifier(A, typeReference)
+                listener: handleNoTypeArguments(,)
+                listener: handleType(A, null)
+                reportRecoverableError(,, MultipleExtends)
+                  listener: handleRecoverableError(MultipleExtends, ,, ,)
+                listener: handleIdentifier(B, typeReference)
+                listener: handleNoTypeArguments({)
+                listener: handleType(B, null)
+                listener: handleClassExtends(on, 2)
+              parseClassWithClauseOpt(B)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(B)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.Class)
           ensureBlock(B, null, class declaration)
           parseClassOrMixinOrExtensionBody(B, DeclarationKind.Class, Baz)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_22314.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_22314.dart.intertwined.expect
index 90c7a40..c903737 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_22314.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_22314.dart.intertwined.expect
@@ -39,7 +39,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Annotation)
         parseClass(Annotation, class, class, Annotation)
           parseClassHeaderOpt(Annotation, class, class)
-            parseClassExtendsOpt(Annotation)
+            parseClassExtendsOpt(Annotation, DeclarationHeaderKind.Class)
               listener: handleNoType(Annotation)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Annotation)
@@ -134,7 +134,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(>, class, class, A)
           parseClassHeaderOpt(>, class, class)
-            parseClassExtendsOpt(>)
+            parseClassExtendsOpt(>, DeclarationHeaderKind.Class)
               listener: handleNoType(>)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(>)
@@ -161,7 +161,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_26810.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_26810.dart.intertwined.expect
index dc0bbe4..a6c99d6 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_26810.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_26810.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(abstract, abstract, null, null, null, null, null, null, null, Key)
         parseClass(Key, abstract, class, Key)
           parseClassHeaderOpt(Key, abstract, class)
-            parseClassExtendsOpt(Key)
+            parseClassExtendsOpt(Key, DeclarationHeaderKind.Class)
               listener: handleNoType(Key)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Key)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_26810_and.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_26810_and.dart.intertwined.expect
index d610536..3192d3b 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_26810_and.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_26810_and.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(abstract, abstract, null, null, null, null, null, null, null, Key)
         parseClass(Key, abstract, class, Key)
           parseClassHeaderOpt(Key, abstract, class)
-            parseClassExtendsOpt(Key)
+            parseClassExtendsOpt(Key, DeclarationHeaderKind.Class)
               listener: handleNoType(Key)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Key)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_26810_or.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_26810_or.dart.intertwined.expect
index bd2e439..53fd925 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_26810_or.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_26810_or.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(abstract, abstract, null, null, null, null, null, null, null, Key)
         parseClass(Key, abstract, class, Key)
           parseClassHeaderOpt(Key, abstract, class)
-            parseClassExtendsOpt(Key)
+            parseClassExtendsOpt(Key, DeclarationHeaderKind.Class)
               listener: handleNoType(Key)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Key)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_39026.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_39026.crash_dart.intertwined.expect
index 874536a..a935555 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_39026.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_39026.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_39026_prime.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_39026_prime.crash_dart.intertwined.expect
index 74945e4..a80a75c 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_39026_prime.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_39026_prime.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_39230.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_39230.crash_dart.intertwined.expect
index 81d0e5a..c6afe05 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_39230.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_39230.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_41265.crash_dart.expect b/pkg/front_end/parser_testcases/error_recovery/issue_41265.crash_dart.expect
index ffae38b..ef0390e 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_41265.crash_dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_41265.crash_dart.expect
@@ -81,7 +81,7 @@
       handleClassExtends(null, 1)
       handleClassNoWithClause()
       handleImplements(null, 0)
-      handleRecoverClassHeader()
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.Class)
       beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.Class, 0, {, })
     endClassDeclaration(class, })
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_41265.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_41265.crash_dart.intertwined.expect
index d1934ab..39fd41c 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_41265.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_41265.crash_dart.intertwined.expect
@@ -23,7 +23,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(>, class, class, A)
           parseClassHeaderOpt(>, class, class)
-            parseClassExtendsOpt(>)
+            parseClassExtendsOpt(>, DeclarationHeaderKind.Class)
               listener: handleNoType(>)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(>)
@@ -81,8 +81,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, DND1)
         parseClass(DND1, class, class, DND1)
           parseClassHeaderOpt(DND1, class, class)
-            parseClassExtendsOpt(DND1)
-              parseClassExtendsSeenExtendsClause(extends, DND1)
+            parseClassExtendsOpt(DND1, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, DND1, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(Object, typeReference)
                 listener: handleNoTypeArguments(with)
                 listener: handleType(Object, null)
@@ -111,26 +111,27 @@
               listener: handleImplements(null, 0)
             listener: handleClassHeader(class, class, null)
           parseClassHeaderRecovery(DND1, class, class)
-            parseClassHeaderOpt(DND1, class, class)
-              parseClassExtendsOpt(DND1)
-                parseClassExtendsSeenExtendsClause(extends, DND1)
-              parseClassWithClauseOpt(Object)
-                parseTypeList(with)
-                  ensureIdentifier(with, typeReference)
-                  parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
-                    parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
-              parseClassOrMixinOrEnumImplementsOpt())
-            skipUnexpectedTokenOpt(), [extends, with, implements, {])
-              reportRecoverableErrorWithToken(>, Instance of 'Template<(Token) => Message>')
-                listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token '>'., null, {lexeme: >}], >, >)
-            parseClassExtendsOpt(>)
-              listener: handleNoType(>)
-              listener: handleClassExtends(null, 1)
-            parseClassWithClauseOpt(>)
-              listener: handleClassNoWithClause()
-            parseClassOrMixinOrEnumImplementsOpt(>)
-              listener: handleImplements(null, 0)
-            listener: handleRecoverClassHeader()
+            parseDeclarationHeaderRecoveryInternal(DND1, class, class, DeclarationHeaderKind.Class)
+              parseClassHeaderOpt(DND1, class, class)
+                parseClassExtendsOpt(DND1, DeclarationHeaderKind.Class)
+                  parseClassExtendsSeenExtendsClause(extends, DND1, DeclarationHeaderKind.Class)
+                parseClassWithClauseOpt(Object)
+                  parseTypeList(with)
+                    ensureIdentifier(with, typeReference)
+                    parseFormalParametersRequiredOpt(Function, MemberKind.GeneralizedFunctionType)
+                      parseFormalParametersRest((, MemberKind.GeneralizedFunctionType)
+                parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(), [extends, with, implements, {])
+                reportRecoverableErrorWithToken(>, Instance of 'Template<(Token) => Message>')
+                  listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token '>'., null, {lexeme: >}], >, >)
+              parseClassExtendsOpt(>, DeclarationHeaderKind.Class)
+                listener: handleNoType(>)
+                listener: handleClassExtends(null, 1)
+              parseClassWithClauseOpt(>)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(>)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.Class)
           ensureBlock(>, null, class declaration)
           parseClassOrMixinOrExtensionBody(>, DeclarationKind.Class, DND1)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251.dart.intertwined.expect
index 51b2a67..41a48c8 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, F)
         parseClass(F, class, class, F)
           parseClassHeaderOpt(F, class, class)
-            parseClassExtendsOpt(F)
+            parseClassExtendsOpt(F, DeclarationHeaderKind.Class)
               listener: handleNoType(F)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(F)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_const.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_const.dart.intertwined.expect
index 04005bb..35ae31ab 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_const.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_const.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, F)
         parseClass(F, class, class, F)
           parseClassHeaderOpt(F, class, class)
-            parseClassExtendsOpt(F)
+            parseClassExtendsOpt(F, DeclarationHeaderKind.Class)
               listener: handleNoType(F)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(F)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list.dart.intertwined.expect
index f416af2..41b7add 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, F)
         parseClass(F, class, class, F)
           parseClassHeaderOpt(F, class, class)
-            parseClassExtendsOpt(F)
+            parseClassExtendsOpt(F, DeclarationHeaderKind.Class)
               listener: handleNoType(F)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(F)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_const.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_const.dart.intertwined.expect
index b407dbf..18bbd47 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_const.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_const.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, F)
         parseClass(F, class, class, F)
           parseClassHeaderOpt(F, class, class)
-            parseClassExtendsOpt(F)
+            parseClassExtendsOpt(F, DeclarationHeaderKind.Class)
               listener: handleNoType(F)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(F)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_new.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_new.dart.intertwined.expect
index e358c14..32999ff 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_new.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_list_new.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, F)
         parseClass(F, class, class, F)
           parseClassHeaderOpt(F, class, class)
-            parseClassExtendsOpt(F)
+            parseClassExtendsOpt(F, DeclarationHeaderKind.Class)
               listener: handleNoType(F)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(F)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_new.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_new.dart.intertwined.expect
index c45440b..f091dc9 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_new.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_new.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, F)
         parseClass(F, class, class, F)
           parseClassHeaderOpt(F, class, class)
-            parseClassExtendsOpt(F)
+            parseClassExtendsOpt(F, DeclarationHeaderKind.Class)
               listener: handleNoType(F)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(F)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set.dart.intertwined.expect
index d6ac11e..c2f744f 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, F)
         parseClass(F, class, class, F)
           parseClassHeaderOpt(F, class, class)
-            parseClassExtendsOpt(F)
+            parseClassExtendsOpt(F, DeclarationHeaderKind.Class)
               listener: handleNoType(F)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(F)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_const.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_const.dart.intertwined.expect
index 6346394..39e4179 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_const.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_const.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, F)
         parseClass(F, class, class, F)
           parseClassHeaderOpt(F, class, class)
-            parseClassExtendsOpt(F)
+            parseClassExtendsOpt(F, DeclarationHeaderKind.Class)
               listener: handleNoType(F)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(F)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_new.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_new.dart.intertwined.expect
index 1213a9d..23c8c9b 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_new.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45251_set_new.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, F)
         parseClass(F, class, class, F)
           parseClassHeaderOpt(F, class, class)
-            parseClassExtendsOpt(F)
+            parseClassExtendsOpt(F, DeclarationHeaderKind.Class)
               listener: handleNoType(F)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(F)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45327_prime_1.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45327_prime_1.crash_dart.intertwined.expect
index 4459b34..2185533 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45327_prime_1.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45327_prime_1.crash_dart.intertwined.expect
@@ -23,7 +23,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(>, class, class, Foo)
           parseClassHeaderOpt(>, class, class)
-            parseClassExtendsOpt(>)
+            parseClassExtendsOpt(>, DeclarationHeaderKind.Class)
               listener: handleNoType(>)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(>)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45662.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45662.crash_dart.intertwined.expect
index cb5a306..3ffd5ba 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45662.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45662.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45662_gt_gt.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45662_gt_gt.crash_dart.intertwined.expect
index 2ea29ff..31593cc 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45662_gt_gt.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45662_gt_gt.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45662_gt_gt_prime.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45662_gt_gt_prime.crash_dart.intertwined.expect
index 3e17a66..1626780 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45662_gt_gt_prime.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45662_gt_gt_prime.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_45662_prime.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_45662_prime.crash_dart.intertwined.expect
index 07bd365..fb52e16 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_45662_prime.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_45662_prime.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_46346.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_46346.dart.intertwined.expect
index 1429c49..ea04cc7 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_46346.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_46346.dart.intertwined.expect
@@ -17,7 +17,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, abstract)
         parseClass(abstract, class, class, abstract)
           parseClassHeaderOpt(abstract, class, class)
-            parseClassExtendsOpt(abstract)
+            parseClassExtendsOpt(abstract, DeclarationHeaderKind.Class)
               listener: handleNoType(abstract)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(abstract)
@@ -46,7 +46,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, as)
         parseClass(as, class, class, as)
           parseClassHeaderOpt(as, class, class)
-            parseClassExtendsOpt(as)
+            parseClassExtendsOpt(as, DeclarationHeaderKind.Class)
               listener: handleNoType(as)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(as)
@@ -75,7 +75,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, assert)
         parseClass(assert, class, class, assert)
           parseClassHeaderOpt(assert, class, class)
-            parseClassExtendsOpt(assert)
+            parseClassExtendsOpt(assert, DeclarationHeaderKind.Class)
               listener: handleNoType(assert)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(assert)
@@ -102,7 +102,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, async)
         parseClass(async, class, class, async)
           parseClassHeaderOpt(async, class, class)
-            parseClassExtendsOpt(async)
+            parseClassExtendsOpt(async, DeclarationHeaderKind.Class)
               listener: handleNoType(async)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(async)
@@ -129,7 +129,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, await)
         parseClass(await, class, class, await)
           parseClassHeaderOpt(await, class, class)
-            parseClassExtendsOpt(await)
+            parseClassExtendsOpt(await, DeclarationHeaderKind.Class)
               listener: handleNoType(await)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(await)
@@ -158,7 +158,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, break)
         parseClass(break, class, class, break)
           parseClassHeaderOpt(break, class, class)
-            parseClassExtendsOpt(break)
+            parseClassExtendsOpt(break, DeclarationHeaderKind.Class)
               listener: handleNoType(break)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(break)
@@ -187,7 +187,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, case)
         parseClass(case, class, class, case)
           parseClassHeaderOpt(case, class, class)
-            parseClassExtendsOpt(case)
+            parseClassExtendsOpt(case, DeclarationHeaderKind.Class)
               listener: handleNoType(case)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(case)
@@ -216,7 +216,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, catch)
         parseClass(catch, class, class, catch)
           parseClassHeaderOpt(catch, class, class)
-            parseClassExtendsOpt(catch)
+            parseClassExtendsOpt(catch, DeclarationHeaderKind.Class)
               listener: handleNoType(catch)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(catch)
@@ -245,7 +245,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, class)
         parseClass(class, class, class, class)
           parseClassHeaderOpt(class, class, class)
-            parseClassExtendsOpt(class)
+            parseClassExtendsOpt(class, DeclarationHeaderKind.Class)
               listener: handleNoType(class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(class)
@@ -274,7 +274,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, const)
         parseClass(const, class, class, const)
           parseClassHeaderOpt(const, class, class)
-            parseClassExtendsOpt(const)
+            parseClassExtendsOpt(const, DeclarationHeaderKind.Class)
               listener: handleNoType(const)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(const)
@@ -303,7 +303,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, continue)
         parseClass(continue, class, class, continue)
           parseClassHeaderOpt(continue, class, class)
-            parseClassExtendsOpt(continue)
+            parseClassExtendsOpt(continue, DeclarationHeaderKind.Class)
               listener: handleNoType(continue)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(continue)
@@ -332,7 +332,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, covariant)
         parseClass(covariant, class, class, covariant)
           parseClassHeaderOpt(covariant, class, class)
-            parseClassExtendsOpt(covariant)
+            parseClassExtendsOpt(covariant, DeclarationHeaderKind.Class)
               listener: handleNoType(covariant)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(covariant)
@@ -361,7 +361,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, default)
         parseClass(default, class, class, default)
           parseClassHeaderOpt(default, class, class)
-            parseClassExtendsOpt(default)
+            parseClassExtendsOpt(default, DeclarationHeaderKind.Class)
               listener: handleNoType(default)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(default)
@@ -390,7 +390,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, deferred)
         parseClass(deferred, class, class, deferred)
           parseClassHeaderOpt(deferred, class, class)
-            parseClassExtendsOpt(deferred)
+            parseClassExtendsOpt(deferred, DeclarationHeaderKind.Class)
               listener: handleNoType(deferred)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(deferred)
@@ -419,7 +419,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, do)
         parseClass(do, class, class, do)
           parseClassHeaderOpt(do, class, class)
-            parseClassExtendsOpt(do)
+            parseClassExtendsOpt(do, DeclarationHeaderKind.Class)
               listener: handleNoType(do)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(do)
@@ -448,7 +448,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, dynamic)
         parseClass(dynamic, class, class, dynamic)
           parseClassHeaderOpt(dynamic, class, class)
-            parseClassExtendsOpt(dynamic)
+            parseClassExtendsOpt(dynamic, DeclarationHeaderKind.Class)
               listener: handleNoType(dynamic)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(dynamic)
@@ -477,7 +477,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, else)
         parseClass(else, class, class, else)
           parseClassHeaderOpt(else, class, class)
-            parseClassExtendsOpt(else)
+            parseClassExtendsOpt(else, DeclarationHeaderKind.Class)
               listener: handleNoType(else)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(else)
@@ -506,7 +506,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, enum)
         parseClass(enum, class, class, enum)
           parseClassHeaderOpt(enum, class, class)
-            parseClassExtendsOpt(enum)
+            parseClassExtendsOpt(enum, DeclarationHeaderKind.Class)
               listener: handleNoType(enum)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(enum)
@@ -535,7 +535,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, export)
         parseClass(export, class, class, export)
           parseClassHeaderOpt(export, class, class)
-            parseClassExtendsOpt(export)
+            parseClassExtendsOpt(export, DeclarationHeaderKind.Class)
               listener: handleNoType(export)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(export)
@@ -564,7 +564,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, extends)
         parseClass(extends, class, class, extends)
           parseClassHeaderOpt(extends, class, class)
-            parseClassExtendsOpt(extends)
+            parseClassExtendsOpt(extends, DeclarationHeaderKind.Class)
               listener: handleNoType(extends)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(extends)
@@ -593,7 +593,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, extension)
         parseClass(extension, class, class, extension)
           parseClassHeaderOpt(extension, class, class)
-            parseClassExtendsOpt(extension)
+            parseClassExtendsOpt(extension, DeclarationHeaderKind.Class)
               listener: handleNoType(extension)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(extension)
@@ -622,7 +622,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, external)
         parseClass(external, class, class, external)
           parseClassHeaderOpt(external, class, class)
-            parseClassExtendsOpt(external)
+            parseClassExtendsOpt(external, DeclarationHeaderKind.Class)
               listener: handleNoType(external)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(external)
@@ -651,7 +651,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, factory)
         parseClass(factory, class, class, factory)
           parseClassHeaderOpt(factory, class, class)
-            parseClassExtendsOpt(factory)
+            parseClassExtendsOpt(factory, DeclarationHeaderKind.Class)
               listener: handleNoType(factory)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(factory)
@@ -680,7 +680,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, false)
         parseClass(false, class, class, false)
           parseClassHeaderOpt(false, class, class)
-            parseClassExtendsOpt(false)
+            parseClassExtendsOpt(false, DeclarationHeaderKind.Class)
               listener: handleNoType(false)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(false)
@@ -709,7 +709,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, final)
         parseClass(final, class, class, final)
           parseClassHeaderOpt(final, class, class)
-            parseClassExtendsOpt(final)
+            parseClassExtendsOpt(final, DeclarationHeaderKind.Class)
               listener: handleNoType(final)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(final)
@@ -738,7 +738,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, finally)
         parseClass(finally, class, class, finally)
           parseClassHeaderOpt(finally, class, class)
-            parseClassExtendsOpt(finally)
+            parseClassExtendsOpt(finally, DeclarationHeaderKind.Class)
               listener: handleNoType(finally)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(finally)
@@ -767,7 +767,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, for)
         parseClass(for, class, class, for)
           parseClassHeaderOpt(for, class, class)
-            parseClassExtendsOpt(for)
+            parseClassExtendsOpt(for, DeclarationHeaderKind.Class)
               listener: handleNoType(for)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(for)
@@ -796,7 +796,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Function)
         parseClass(Function, class, class, Function)
           parseClassHeaderOpt(Function, class, class)
-            parseClassExtendsOpt(Function)
+            parseClassExtendsOpt(Function, DeclarationHeaderKind.Class)
               listener: handleNoType(Function)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Function)
@@ -825,7 +825,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, get)
         parseClass(get, class, class, get)
           parseClassHeaderOpt(get, class, class)
-            parseClassExtendsOpt(get)
+            parseClassExtendsOpt(get, DeclarationHeaderKind.Class)
               listener: handleNoType(get)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(get)
@@ -852,7 +852,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, hide)
         parseClass(hide, class, class, hide)
           parseClassHeaderOpt(hide, class, class)
-            parseClassExtendsOpt(hide)
+            parseClassExtendsOpt(hide, DeclarationHeaderKind.Class)
               listener: handleNoType(hide)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(hide)
@@ -881,7 +881,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, if)
         parseClass(if, class, class, if)
           parseClassHeaderOpt(if, class, class)
-            parseClassExtendsOpt(if)
+            parseClassExtendsOpt(if, DeclarationHeaderKind.Class)
               listener: handleNoType(if)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(if)
@@ -910,7 +910,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, implements)
         parseClass(implements, class, class, implements)
           parseClassHeaderOpt(implements, class, class)
-            parseClassExtendsOpt(implements)
+            parseClassExtendsOpt(implements, DeclarationHeaderKind.Class)
               listener: handleNoType(implements)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(implements)
@@ -939,7 +939,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, import)
         parseClass(import, class, class, import)
           parseClassHeaderOpt(import, class, class)
-            parseClassExtendsOpt(import)
+            parseClassExtendsOpt(import, DeclarationHeaderKind.Class)
               listener: handleNoType(import)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(import)
@@ -968,7 +968,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, in)
         parseClass(in, class, class, in)
           parseClassHeaderOpt(in, class, class)
-            parseClassExtendsOpt(in)
+            parseClassExtendsOpt(in, DeclarationHeaderKind.Class)
               listener: handleNoType(in)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(in)
@@ -995,7 +995,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, inout)
         parseClass(inout, class, class, inout)
           parseClassHeaderOpt(inout, class, class)
-            parseClassExtendsOpt(inout)
+            parseClassExtendsOpt(inout, DeclarationHeaderKind.Class)
               listener: handleNoType(inout)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(inout)
@@ -1024,7 +1024,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, interface)
         parseClass(interface, class, class, interface)
           parseClassHeaderOpt(interface, class, class)
-            parseClassExtendsOpt(interface)
+            parseClassExtendsOpt(interface, DeclarationHeaderKind.Class)
               listener: handleNoType(interface)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(interface)
@@ -1053,7 +1053,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, is)
         parseClass(is, class, class, is)
           parseClassHeaderOpt(is, class, class)
-            parseClassExtendsOpt(is)
+            parseClassExtendsOpt(is, DeclarationHeaderKind.Class)
               listener: handleNoType(is)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(is)
@@ -1082,7 +1082,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, late)
         parseClass(late, class, class, late)
           parseClassHeaderOpt(late, class, class)
-            parseClassExtendsOpt(late)
+            parseClassExtendsOpt(late, DeclarationHeaderKind.Class)
               listener: handleNoType(late)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(late)
@@ -1111,7 +1111,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, library)
         parseClass(library, class, class, library)
           parseClassHeaderOpt(library, class, class)
-            parseClassExtendsOpt(library)
+            parseClassExtendsOpt(library, DeclarationHeaderKind.Class)
               listener: handleNoType(library)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(library)
@@ -1140,7 +1140,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, mixin)
         parseClass(mixin, class, class, mixin)
           parseClassHeaderOpt(mixin, class, class)
-            parseClassExtendsOpt(mixin)
+            parseClassExtendsOpt(mixin, DeclarationHeaderKind.Class)
               listener: handleNoType(mixin)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(mixin)
@@ -1167,7 +1167,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, native)
         parseClass(native, class, class, native)
           parseClassHeaderOpt(native, class, class)
-            parseClassExtendsOpt(native)
+            parseClassExtendsOpt(native, DeclarationHeaderKind.Class)
               listener: handleNoType(native)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(native)
@@ -1196,7 +1196,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, new)
         parseClass(new, class, class, new)
           parseClassHeaderOpt(new, class, class)
-            parseClassExtendsOpt(new)
+            parseClassExtendsOpt(new, DeclarationHeaderKind.Class)
               listener: handleNoType(new)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(new)
@@ -1225,7 +1225,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, null)
         parseClass(null, class, class, null)
           parseClassHeaderOpt(null, class, class)
-            parseClassExtendsOpt(null)
+            parseClassExtendsOpt(null, DeclarationHeaderKind.Class)
               listener: handleNoType(null)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(null)
@@ -1252,7 +1252,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, of)
         parseClass(of, class, class, of)
           parseClassHeaderOpt(of, class, class)
-            parseClassExtendsOpt(of)
+            parseClassExtendsOpt(of, DeclarationHeaderKind.Class)
               listener: handleNoType(of)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(of)
@@ -1279,7 +1279,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, on)
         parseClass(on, class, class, on)
           parseClassHeaderOpt(on, class, class)
-            parseClassExtendsOpt(on)
+            parseClassExtendsOpt(on, DeclarationHeaderKind.Class)
               listener: handleNoType(on)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(on)
@@ -1308,7 +1308,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, operator)
         parseClass(operator, class, class, operator)
           parseClassHeaderOpt(operator, class, class)
-            parseClassExtendsOpt(operator)
+            parseClassExtendsOpt(operator, DeclarationHeaderKind.Class)
               listener: handleNoType(operator)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(operator)
@@ -1335,7 +1335,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, out)
         parseClass(out, class, class, out)
           parseClassHeaderOpt(out, class, class)
-            parseClassExtendsOpt(out)
+            parseClassExtendsOpt(out, DeclarationHeaderKind.Class)
               listener: handleNoType(out)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(out)
@@ -1364,7 +1364,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, part)
         parseClass(part, class, class, part)
           parseClassHeaderOpt(part, class, class)
-            parseClassExtendsOpt(part)
+            parseClassExtendsOpt(part, DeclarationHeaderKind.Class)
               listener: handleNoType(part)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(part)
@@ -1391,7 +1391,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, patch)
         parseClass(patch, class, class, patch)
           parseClassHeaderOpt(patch, class, class)
-            parseClassExtendsOpt(patch)
+            parseClassExtendsOpt(patch, DeclarationHeaderKind.Class)
               listener: handleNoType(patch)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(patch)
@@ -1420,7 +1420,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, required)
         parseClass(required, class, class, required)
           parseClassHeaderOpt(required, class, class)
-            parseClassExtendsOpt(required)
+            parseClassExtendsOpt(required, DeclarationHeaderKind.Class)
               listener: handleNoType(required)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(required)
@@ -1449,7 +1449,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, rethrow)
         parseClass(rethrow, class, class, rethrow)
           parseClassHeaderOpt(rethrow, class, class)
-            parseClassExtendsOpt(rethrow)
+            parseClassExtendsOpt(rethrow, DeclarationHeaderKind.Class)
               listener: handleNoType(rethrow)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(rethrow)
@@ -1478,7 +1478,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, return)
         parseClass(return, class, class, return)
           parseClassHeaderOpt(return, class, class)
-            parseClassExtendsOpt(return)
+            parseClassExtendsOpt(return, DeclarationHeaderKind.Class)
               listener: handleNoType(return)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(return)
@@ -1507,7 +1507,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, set)
         parseClass(set, class, class, set)
           parseClassHeaderOpt(set, class, class)
-            parseClassExtendsOpt(set)
+            parseClassExtendsOpt(set, DeclarationHeaderKind.Class)
               listener: handleNoType(set)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(set)
@@ -1534,7 +1534,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, show)
         parseClass(show, class, class, show)
           parseClassHeaderOpt(show, class, class)
-            parseClassExtendsOpt(show)
+            parseClassExtendsOpt(show, DeclarationHeaderKind.Class)
               listener: handleNoType(show)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(show)
@@ -1561,7 +1561,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, source)
         parseClass(source, class, class, source)
           parseClassHeaderOpt(source, class, class)
-            parseClassExtendsOpt(source)
+            parseClassExtendsOpt(source, DeclarationHeaderKind.Class)
               listener: handleNoType(source)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(source)
@@ -1590,7 +1590,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, static)
         parseClass(static, class, class, static)
           parseClassHeaderOpt(static, class, class)
-            parseClassExtendsOpt(static)
+            parseClassExtendsOpt(static, DeclarationHeaderKind.Class)
               listener: handleNoType(static)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(static)
@@ -1619,7 +1619,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, super)
         parseClass(super, class, class, super)
           parseClassHeaderOpt(super, class, class)
-            parseClassExtendsOpt(super)
+            parseClassExtendsOpt(super, DeclarationHeaderKind.Class)
               listener: handleNoType(super)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(super)
@@ -1648,7 +1648,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, switch)
         parseClass(switch, class, class, switch)
           parseClassHeaderOpt(switch, class, class)
-            parseClassExtendsOpt(switch)
+            parseClassExtendsOpt(switch, DeclarationHeaderKind.Class)
               listener: handleNoType(switch)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(switch)
@@ -1675,7 +1675,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, sync)
         parseClass(sync, class, class, sync)
           parseClassHeaderOpt(sync, class, class)
-            parseClassExtendsOpt(sync)
+            parseClassExtendsOpt(sync, DeclarationHeaderKind.Class)
               listener: handleNoType(sync)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(sync)
@@ -1704,7 +1704,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, this)
         parseClass(this, class, class, this)
           parseClassHeaderOpt(this, class, class)
-            parseClassExtendsOpt(this)
+            parseClassExtendsOpt(this, DeclarationHeaderKind.Class)
               listener: handleNoType(this)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(this)
@@ -1733,7 +1733,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, throw)
         parseClass(throw, class, class, throw)
           parseClassHeaderOpt(throw, class, class)
-            parseClassExtendsOpt(throw)
+            parseClassExtendsOpt(throw, DeclarationHeaderKind.Class)
               listener: handleNoType(throw)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(throw)
@@ -1762,7 +1762,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, true)
         parseClass(true, class, class, true)
           parseClassHeaderOpt(true, class, class)
-            parseClassExtendsOpt(true)
+            parseClassExtendsOpt(true, DeclarationHeaderKind.Class)
               listener: handleNoType(true)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(true)
@@ -1791,7 +1791,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, try)
         parseClass(try, class, class, try)
           parseClassHeaderOpt(try, class, class)
-            parseClassExtendsOpt(try)
+            parseClassExtendsOpt(try, DeclarationHeaderKind.Class)
               listener: handleNoType(try)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(try)
@@ -1820,7 +1820,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, typedef)
         parseClass(typedef, class, class, typedef)
           parseClassHeaderOpt(typedef, class, class)
-            parseClassExtendsOpt(typedef)
+            parseClassExtendsOpt(typedef, DeclarationHeaderKind.Class)
               listener: handleNoType(typedef)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(typedef)
@@ -1849,7 +1849,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, var)
         parseClass(var, class, class, var)
           parseClassHeaderOpt(var, class, class)
-            parseClassExtendsOpt(var)
+            parseClassExtendsOpt(var, DeclarationHeaderKind.Class)
               listener: handleNoType(var)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(var)
@@ -1878,7 +1878,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, void)
         parseClass(void, class, class, void)
           parseClassHeaderOpt(void, class, class)
-            parseClassExtendsOpt(void)
+            parseClassExtendsOpt(void, DeclarationHeaderKind.Class)
               listener: handleNoType(void)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(void)
@@ -1907,7 +1907,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, while)
         parseClass(while, class, class, while)
           parseClassHeaderOpt(while, class, class)
-            parseClassExtendsOpt(while)
+            parseClassExtendsOpt(while, DeclarationHeaderKind.Class)
               listener: handleNoType(while)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(while)
@@ -1936,7 +1936,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, with)
         parseClass(with, class, class, with)
           parseClassHeaderOpt(with, class, class)
-            parseClassExtendsOpt(with)
+            parseClassExtendsOpt(with, DeclarationHeaderKind.Class)
               listener: handleNoType(with)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(with)
@@ -1963,7 +1963,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, yield)
         parseClass(yield, class, class, yield)
           parseClassHeaderOpt(yield, class, class)
-            parseClassExtendsOpt(yield)
+            parseClassExtendsOpt(yield, DeclarationHeaderKind.Class)
               listener: handleNoType(yield)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(yield)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_46346_prime_2.dart.expect b/pkg/front_end/parser_testcases/error_recovery/issue_46346_prime_2.dart.expect
index d915ab7..a21bd7f 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_46346_prime_2.dart.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_46346_prime_2.dart.expect
@@ -30,7 +30,7 @@
       handleClassExtends(null, 1)
       handleClassNoWithClause()
       handleImplements(null, 0)
-      handleRecoverClassHeader()
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.Class)
       handleRecoverableError(Message[ExpectedClassOrMixinBody, A class declaration must have a body, even if it is empty., Try adding an empty body., {string: class declaration}], , )
       // WARNING: Reporting at eof for .
       beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_46346_prime_2.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_46346_prime_2.dart.intertwined.expect
index 91a83bb2..741cb96 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_46346_prime_2.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_46346_prime_2.dart.intertwined.expect
@@ -20,7 +20,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, )
         parseClass(, class, class, )
           parseClassHeaderOpt(, class, class)
-            parseClassExtendsOpt()
+            parseClassExtendsOpt(, DeclarationHeaderKind.Class)
               listener: handleNoType()
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt()
@@ -29,19 +29,20 @@
               listener: handleImplements(null, 0)
             listener: handleClassHeader(class, class, null)
           parseClassHeaderRecovery(, class, class)
-            parseClassHeaderOpt(, class, class)
-              parseClassExtendsOpt()
+            parseDeclarationHeaderRecoveryInternal(, class, class, DeclarationHeaderKind.Class)
+              parseClassHeaderOpt(, class, class)
+                parseClassExtendsOpt(, DeclarationHeaderKind.Class)
+                parseClassWithClauseOpt()
+                parseClassOrMixinOrEnumImplementsOpt()
+              skipUnexpectedTokenOpt(, [extends, with, implements, {])
+              parseClassExtendsOpt(, DeclarationHeaderKind.Class)
+                listener: handleNoType()
+                listener: handleClassExtends(null, 1)
               parseClassWithClauseOpt()
+                listener: handleClassNoWithClause()
               parseClassOrMixinOrEnumImplementsOpt()
-            skipUnexpectedTokenOpt(, [extends, with, implements, {])
-            parseClassExtendsOpt()
-              listener: handleNoType()
-              listener: handleClassExtends(null, 1)
-            parseClassWithClauseOpt()
-              listener: handleClassNoWithClause()
-            parseClassOrMixinOrEnumImplementsOpt()
-              listener: handleImplements(null, 0)
-            listener: handleRecoverClassHeader()
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.Class)
           ensureBlock(, null, class declaration)
             reportRecoverableError(, Message[ExpectedClassOrMixinBody, A class declaration must have a body, even if it is empty., Try adding an empty body., {string: class declaration}])
               listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A class declaration must have a body, even if it is empty., Try adding an empty body., {string: class declaration}], , )
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_46505.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_46505.crash_dart.intertwined.expect
index 4546221..42b8cf5 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_46505.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_46505.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -81,7 +81,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, B)
         parseClass(B, class, class, B)
           parseClassHeaderOpt(B, class, class)
-            parseClassExtendsOpt(B)
+            parseClassExtendsOpt(B, DeclarationHeaderKind.Class)
               listener: handleNoType(B)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(B)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_1.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_1.crash_dart.intertwined.expect
index bbc30f0..13b95ba 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_1.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_1.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_2.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_2.crash_dart.intertwined.expect
index f8f1fb8..d4a831d 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_2.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_2.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_3.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_3.crash_dart.intertwined.expect
index 5e4500c..ccf2b89 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_3.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_3.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_4.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_4.crash_dart.intertwined.expect
index 2eb9c45..14f576a 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_4.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_4.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_5.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_5.crash_dart.intertwined.expect
index b297ff4..57c2af8 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_5.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_5.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -91,7 +91,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, B)
         parseClass(B, class, class, B)
           parseClassHeaderOpt(B, class, class)
-            parseClassExtendsOpt(B)
+            parseClassExtendsOpt(B, DeclarationHeaderKind.Class)
               listener: handleNoType(B)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(B)
@@ -204,7 +204,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_6.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_6.crash_dart.intertwined.expect
index bd7ce6b..9cb9516 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_6.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_46505_prime_6.crash_dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_48371_prime3.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_48371_prime3.dart.intertwined.expect
index 98951d1..d3f5bc0 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_48371_prime3.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_48371_prime3.dart.intertwined.expect
@@ -51,7 +51,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_48411.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_48411.dart.intertwined.expect
index 5a1712b..0e561c1 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_48411.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_48411.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -130,8 +130,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, B)
         parseClass(B, class, class, B)
           parseClassHeaderOpt(B, class, class)
-            parseClassExtendsOpt(B)
-              parseClassExtendsSeenExtendsClause(extends, B)
+            parseClassExtendsOpt(B, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, B, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
@@ -263,8 +263,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, B2)
         parseClass(B2, class, class, B2)
           parseClassHeaderOpt(B2, class, class)
-            parseClassExtendsOpt(B2)
-              parseClassExtendsSeenExtendsClause(extends, B2)
+            parseClassExtendsOpt(B2, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, B2, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
@@ -404,8 +404,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, B3)
         parseClass(B3, class, class, B3)
           parseClassHeaderOpt(B3, class, class)
-            parseClassExtendsOpt(B3)
-              parseClassExtendsSeenExtendsClause(extends, B3)
+            parseClassExtendsOpt(B3, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, B3, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
@@ -590,8 +590,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
-              parseClassExtendsSeenExtendsClause(extends, C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, C, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
@@ -740,8 +740,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, D)
         parseClass(D, class, class, D)
           parseClassHeaderOpt(D, class, class)
-            parseClassExtendsOpt(D)
-              parseClassExtendsSeenExtendsClause(extends, D)
+            parseClassExtendsOpt(D, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, D, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
@@ -876,8 +876,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, E)
         parseClass(E, class, class, E)
           parseClassHeaderOpt(E, class, class)
-            parseClassExtendsOpt(E)
-              parseClassExtendsSeenExtendsClause(extends, E)
+            parseClassExtendsOpt(E, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, E, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_48411_prime.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_48411_prime.dart.intertwined.expect
index cc552e9..a4d47d3 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_48411_prime.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_48411_prime.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -130,8 +130,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, B)
         parseClass(B, class, class, B)
           parseClassHeaderOpt(B, class, class)
-            parseClassExtendsOpt(B)
-              parseClassExtendsSeenExtendsClause(extends, B)
+            parseClassExtendsOpt(B, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, B, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
@@ -260,8 +260,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, B2)
         parseClass(B2, class, class, B2)
           parseClassHeaderOpt(B2, class, class)
-            parseClassExtendsOpt(B2)
-              parseClassExtendsSeenExtendsClause(extends, B2)
+            parseClassExtendsOpt(B2, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, B2, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
@@ -398,8 +398,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, B3)
         parseClass(B3, class, class, B3)
           parseClassHeaderOpt(B3, class, class)
-            parseClassExtendsOpt(B3)
-              parseClassExtendsSeenExtendsClause(extends, B3)
+            parseClassExtendsOpt(B3, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, B3, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
@@ -581,8 +581,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
-              parseClassExtendsSeenExtendsClause(extends, C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, C, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
@@ -728,8 +728,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, D)
         parseClass(D, class, class, D)
           parseClassHeaderOpt(D, class, class)
-            parseClassExtendsOpt(D)
-              parseClassExtendsSeenExtendsClause(extends, D)
+            parseClassExtendsOpt(D, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, D, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
@@ -861,8 +861,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, E)
         parseClass(E, class, class, E)
           parseClassHeaderOpt(E, class, class)
-            parseClassExtendsOpt(E)
-              parseClassExtendsSeenExtendsClause(extends, E)
+            parseClassExtendsOpt(E, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, E, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_48411_prime_1.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_48411_prime_1.dart.intertwined.expect
index 3740ad4..cc4851b 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_48411_prime_1.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_48411_prime_1.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
@@ -136,7 +136,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
@@ -315,7 +315,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
@@ -391,7 +391,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/error_recovery/issue_49116.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/issue_49116.dart.intertwined.expect
index 8696011..710186b 100644
--- a/pkg/front_end/parser_testcases/error_recovery/issue_49116.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/issue_49116.dart.intertwined.expect
@@ -2300,7 +2300,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, await)
         parseClass(await, class, class, await)
           parseClassHeaderOpt(await, class, class)
-            parseClassExtendsOpt(await)
+            parseClassExtendsOpt(await, DeclarationHeaderKind.Class)
               listener: handleNoType(await)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(await)
diff --git a/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_fields.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_fields.dart.intertwined.expect
index 6fbe17a..59ed748 100644
--- a/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_fields.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_fields.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, WrapperClass)
         parseClass(WrapperClass, class, class, WrapperClass)
           parseClassHeaderOpt(WrapperClass, class, class)
-            parseClassExtendsOpt(WrapperClass)
+            parseClassExtendsOpt(WrapperClass, DeclarationHeaderKind.Class)
               listener: handleNoType(WrapperClass)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(WrapperClass)
diff --git a/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.intertwined.expect
index 9180983..28f517b 100644
--- a/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/keyword_named_class_methods.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, WrapperClass)
         parseClass(WrapperClass, class, class, WrapperClass)
           parseClassHeaderOpt(WrapperClass, class, class)
-            parseClassExtendsOpt(WrapperClass)
+            parseClassExtendsOpt(WrapperClass, DeclarationHeaderKind.Class)
               listener: handleNoType(WrapperClass)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(WrapperClass)
diff --git a/pkg/front_end/parser_testcases/error_recovery/keyword_named_formal_parameter_start_of_next_top_level.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/keyword_named_formal_parameter_start_of_next_top_level.dart.intertwined.expect
index 611213e..7cfe075 100644
--- a/pkg/front_end/parser_testcases/error_recovery/keyword_named_formal_parameter_start_of_next_top_level.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/keyword_named_formal_parameter_start_of_next_top_level.dart.intertwined.expect
@@ -58,7 +58,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/error_recovery/method_called_with.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/method_called_with.dart.intertwined.expect
index aed39fb..0152e44 100644
--- a/pkg/front_end/parser_testcases/error_recovery/method_called_with.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/method_called_with.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/error_recovery/method_called_with_prime.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/method_called_with_prime.dart.intertwined.expect
index b297008..d041d1e 100644
--- a/pkg/front_end/parser_testcases/error_recovery/method_called_with_prime.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/method_called_with_prime.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/error_recovery/method_called_with_prime2.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/method_called_with_prime2.dart.intertwined.expect
index 04dab1d..ff6dae5 100644
--- a/pkg/front_end/parser_testcases/error_recovery/method_called_with_prime2.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/method_called_with_prime2.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, B)
         parseClass(B, class, class, B)
           parseClassHeaderOpt(B, class, class)
-            parseClassExtendsOpt(B)
+            parseClassExtendsOpt(B, DeclarationHeaderKind.Class)
               listener: handleNoType(B)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(B)
@@ -65,7 +65,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, M1)
         parseClass(M1, class, class, M1)
           parseClassHeaderOpt(M1, class, class)
-            parseClassExtendsOpt(M1)
+            parseClassExtendsOpt(M1, DeclarationHeaderKind.Class)
               listener: handleNoType(M1)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(M1)
diff --git a/pkg/front_end/parser_testcases/extension_named_type.dart.expect b/pkg/front_end/parser_testcases/extension_named_type.dart.expect
index 809ea94..ce08b0e 100644
--- a/pkg/front_end/parser_testcases/extension_named_type.dart.expect
+++ b/pkg/front_end/parser_testcases/extension_named_type.dart.expect
@@ -4,11 +4,7 @@
 extension type on A {
                ^^
 
-parser/extension_named_type:3:16: A extension type declaration must have a body, even if it is empty.
-extension type on A {
-               ^^
-
-parser/extension_named_type:3:19: A function declaration needs an explicit list of parameters.
+parser/extension_named_type:3:19: Unexpected token 'A'.
 extension type on A {
                   ^
 
@@ -36,40 +32,30 @@
       handleRecoverableError(MissingPrimaryConstructor, on, on)
       handleNoPrimaryConstructor(on, null)
       handleImplements(null, 0)
-      handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], on, on)
+      handleRecoverableError(Message[UnexpectedToken, Unexpected token 'A'., null, {lexeme: A}], A, A)
+      handleNoType(A)
+      handleClassExtends(null, 1)
+      handleClassNoWithClause()
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
       beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
-      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
-    endExtensionTypeDeclaration(extension, type, })
-  endTopLevelDeclaration(A)
-  beginMetadataStar(A)
-  endMetadataStar(0)
-  beginTopLevelMember(A)
-    beginTopLevelMethod(}, null, null)
-      handleNoType(})
-      handleIdentifier(A, topLevelFunctionDeclaration)
-      handleNoTypeVariables({)
-      handleRecoverableError(MissingFunctionParameters, A, A)
-      beginFormalParameters((, MemberKind.TopLevelMethod)
-      endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-      handleAsyncModifier(null, null)
-      beginBlockFunctionBody({)
         beginMetadataStar(method)
         endMetadataStar(0)
-        handleNoTypeVariables(()
-        beginLocalFunctionDeclaration(method)
-          handleNoType({)
-          beginFunctionName(method)
-            handleIdentifier(method, localFunctionDeclaration)
-          endFunctionName(method, ()
-          beginFormalParameters((, MemberKind.Local)
-          endFormalParameters(0, (, ), MemberKind.Local)
-          handleNoInitializers()
-          handleAsyncModifier(null, null)
-          beginBlockFunctionBody({)
-          endBlockFunctionBody(0, {, })
-        endLocalFunctionDeclaration(})
-      endBlockFunctionBody(1, {, })
-    endTopLevelMethod(A, null, })
+        beginMember()
+          beginMethod(DeclarationKind.ExtensionType, null, null, null, null, null, null, method)
+            handleNoType({)
+            handleIdentifier(method, methodDeclaration)
+            handleNoTypeVariables(()
+            beginFormalParameters((, MemberKind.NonStaticMethod)
+            endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+            handleNoInitializers()
+            handleAsyncModifier(null, null)
+            beginBlockFunctionBody({)
+            endBlockFunctionBody(0, {, })
+          endExtensionTypeMethod(null, method, (, null, })
+        endMember()
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 1, {, })
+    endExtensionTypeDeclaration(extension, type, })
   endTopLevelDeclaration(test)
   beginMetadataStar(test)
   endMetadataStar(0)
@@ -113,4 +99,4 @@
       handleExpressionFunctionBody(=>, ;)
     endTopLevelMethod(test, null, ;)
   endTopLevelDeclaration()
-endCompilationUnit(4, )
+endCompilationUnit(3, )
diff --git a/pkg/front_end/parser_testcases/extension_named_type.dart.intertwined.expect b/pkg/front_end/parser_testcases/extension_named_type.dart.intertwined.expect
index dab868b..44a2b9d 100644
--- a/pkg/front_end/parser_testcases/extension_named_type.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extension_named_type.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -44,78 +44,58 @@
           listener: handleNoPrimaryConstructor(on, null)
           parseClassOrMixinOrEnumImplementsOpt(on)
             listener: handleImplements(null, 0)
-          ensureBlock(on, null, extension type declaration)
-            reportRecoverableError(on, Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
-              listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], on, on)
-            insertBlock(on)
-              rewriter()
-              rewriter()
-          parseClassOrMixinOrExtensionBody(on, DeclarationKind.ExtensionType, on)
+          parseExtensionTypeHeaderRecovery(on, extension)
+            parseDeclarationHeaderRecoveryInternal(on, extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt(on)
+              skipUnexpectedTokenOpt(on, [extends, with, implements, {])
+                reportRecoverableErrorWithToken(A, Instance of 'Template<(Token) => Message>')
+                  listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'A'., null, {lexeme: A}], A, A)
+              parseClassExtendsOpt(A, DeclarationHeaderKind.ExtensionType)
+                listener: handleNoType(A)
+                listener: handleClassExtends(null, 1)
+              parseClassWithClauseOpt(A)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(A)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(A, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(A, DeclarationKind.ExtensionType, on)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
-            notEofOrValue(}, })
-            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
-          listener: endExtensionTypeDeclaration(extension, type, })
-  listener: endTopLevelDeclaration(A)
-  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
-    parseMetadataStar(})
-      listener: beginMetadataStar(A)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(})
-      listener: beginTopLevelMember(A)
-      isReservedKeyword({)
-      parseTopLevelMethod(}, null, null, }, Instance of 'NoType', null, A, false)
-        listener: beginTopLevelMethod(}, null, null)
-        listener: handleNoType(})
-        ensureIdentifierPotentiallyRecovered(}, topLevelFunctionDeclaration, false)
-          listener: handleIdentifier(A, topLevelFunctionDeclaration)
-        parseMethodTypeVar(A)
-          listener: handleNoTypeVariables({)
-        parseGetterOrFormalParameters(A, A, false, MemberKind.TopLevelMethod)
-          missingParameterMessage(MemberKind.TopLevelMethod)
-          reportRecoverableError(A, MissingFunctionParameters)
-            listener: handleRecoverableError(MissingFunctionParameters, A, A)
-          rewriter()
-          parseFormalParametersRest((, MemberKind.TopLevelMethod)
-            listener: beginFormalParameters((, MemberKind.TopLevelMethod)
-            listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-        parseAsyncModifierOpt())
-          listener: handleAsyncModifier(null, null)
-          inPlainSync()
-        parseFunctionBody(), false, false)
-          listener: beginBlockFunctionBody({)
-          notEofOrValue(}, method)
-          parseStatement({)
-            parseStatementX({)
-              parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, null)
-                looksLikeLocalFunction(method)
+            notEofOrValue(}, method)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.ExtensionType, on)
+              parseMetadataStar({)
                 listener: beginMetadataStar(method)
                 listener: endMetadataStar(0)
-                listener: handleNoTypeVariables(()
-                listener: beginLocalFunctionDeclaration(method)
+              listener: beginMember()
+              isReservedKeyword(()
+              parseMethod({, null, null, null, null, null, null, null, {, Instance of 'NoType', null, method, DeclarationKind.ExtensionType, on, false)
+                listener: beginMethod(DeclarationKind.ExtensionType, null, null, null, null, null, null, method)
                 listener: handleNoType({)
-                parseNamedFunctionRest({, method, method, false)
-                  listener: beginFunctionName(method)
-                  ensureIdentifier({, localFunctionDeclaration)
-                    listener: handleIdentifier(method, localFunctionDeclaration)
-                  listener: endFunctionName(method, ()
-                  parseFormalParametersRequiredOpt(method, MemberKind.Local)
-                    parseFormalParametersRest((, MemberKind.Local)
-                      listener: beginFormalParameters((, MemberKind.Local)
-                      listener: endFormalParameters(0, (, ), MemberKind.Local)
-                  parseInitializersOpt())
-                    listener: handleNoInitializers()
-                  parseAsyncOptBody(), false, false)
-                    parseAsyncModifierOpt())
-                      listener: handleAsyncModifier(null, null)
-                      inPlainSync()
-                    parseFunctionBody(), false, false)
-                      listener: beginBlockFunctionBody({)
-                      notEofOrValue(}, })
-                      listener: endBlockFunctionBody(0, {, })
-                  listener: endLocalFunctionDeclaration(})
-          notEofOrValue(}, })
-          listener: endBlockFunctionBody(1, {, })
-        listener: endTopLevelMethod(A, null, })
+                ensureIdentifierPotentiallyRecovered({, methodDeclaration, false)
+                  listener: handleIdentifier(method, methodDeclaration)
+                parseQualifiedRestOpt(method, methodDeclarationContinuation)
+                parseMethodTypeVar(method)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(method, method, false, MemberKind.NonStaticMethod)
+                  parseFormalParameters(method, MemberKind.NonStaticMethod)
+                    parseFormalParametersRest((, MemberKind.NonStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.NonStaticMethod)
+                      listener: endFormalParameters(0, (, ), MemberKind.NonStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
+                inPlainSync()
+                parseFunctionBody(), false, true)
+                  listener: beginBlockFunctionBody({)
+                  notEofOrValue(}, })
+                  listener: endBlockFunctionBody(0, {, })
+                listener: endExtensionTypeMethod(null, method, (, null, })
+              listener: endMember()
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 1, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
   listener: endTopLevelDeclaration(test)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
@@ -211,4 +191,4 @@
         listener: endTopLevelMethod(test, null, ;)
   listener: endTopLevelDeclaration()
   reportAllErrorTokens(class)
-  listener: endCompilationUnit(4, )
+  listener: endCompilationUnit(3, )
diff --git a/pkg/front_end/parser_testcases/extension_named_type.dart.parser.expect b/pkg/front_end/parser_testcases/extension_named_type.dart.parser.expect
index 43297dc..04658d0 100644
--- a/pkg/front_end/parser_testcases/extension_named_type.dart.parser.expect
+++ b/pkg/front_end/parser_testcases/extension_named_type.dart.parser.expect
@@ -1,8 +1,6 @@
-NOTICE: Stream was rewritten by parser!
-
 class A {}
 
-extension type on {}A (){
+extension type on A {
 method() {}
 }
 
@@ -11,7 +9,7 @@
 
 class[KeywordToken] A[StringToken] {[BeginToken]}[SimpleToken]
 
-extension[KeywordToken] type[StringToken] on[KeywordToken] {[SyntheticBeginToken]}[SyntheticToken]A[StringToken] ([SyntheticBeginToken])[SyntheticToken]{[BeginToken]
+extension[KeywordToken] type[StringToken] on[KeywordToken] A[StringToken] {[BeginToken]
 method[StringToken]([BeginToken])[SimpleToken] {[BeginToken]}[SimpleToken]
 }[SimpleToken]
 
diff --git a/pkg/front_end/parser_testcases/extension_type.dart.expect b/pkg/front_end/parser_testcases/extension_type.dart.expect
index d31819a..c624153 100644
--- a/pkg/front_end/parser_testcases/extension_type.dart.expect
+++ b/pkg/front_end/parser_testcases/extension_type.dart.expect
@@ -4,13 +4,13 @@
 extension type E on A {}
                ^
 
-parser/extension_type:3:16: A extension type declaration must have a body, even if it is empty.
+parser/extension_type:3:18: Expected 'extends' instead of this.
 extension type E on A {}
-               ^
+                 ^^
 
-parser/extension_type:3:21: A function declaration needs an explicit list of parameters.
+parser/extension_type:3:18: An extension type declaration can't have an 'extends' clause.
 extension type E on A {}
-                    ^
+                 ^^
 
 beginCompilationUnit(class)
   beginMetadataStar(class)
@@ -36,26 +36,17 @@
       handleRecoverableError(MissingPrimaryConstructor, E, E)
       handleNoPrimaryConstructor(E, null)
       handleImplements(null, 0)
-      handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], E, E)
+      handleRecoverableError(Message[ExpectedInstead, Expected 'extends' instead of this., null, {string: extends}], on, on)
+      handleIdentifier(A, typeReference)
+      handleNoTypeArguments({)
+      handleType(A, null)
+      handleClassExtends(on, 1)
+      handleRecoverableError(ExtensionTypeExtends, on, on)
+      handleClassNoWithClause()
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
       beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
     endExtensionTypeDeclaration(extension, type, })
-  endTopLevelDeclaration(on)
-  beginMetadataStar(on)
-  endMetadataStar(0)
-  beginTopLevelMember(on)
-    beginTopLevelMethod(}, null, null)
-      handleIdentifier(on, typeReference)
-      handleNoTypeArguments(A)
-      handleType(on, null)
-      handleIdentifier(A, topLevelFunctionDeclaration)
-      handleNoTypeVariables({)
-      handleRecoverableError(MissingFunctionParameters, A, A)
-      beginFormalParameters((, MemberKind.TopLevelMethod)
-      endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-      handleAsyncModifier(null, null)
-      beginBlockFunctionBody({)
-      endBlockFunctionBody(0, {, })
-    endTopLevelMethod(on, null, })
   endTopLevelDeclaration()
-endCompilationUnit(3, )
+endCompilationUnit(2, )
diff --git a/pkg/front_end/parser_testcases/extension_type.dart.intertwined.expect b/pkg/front_end/parser_testcases/extension_type.dart.intertwined.expect
index ebe29da..6d27775 100644
--- a/pkg/front_end/parser_testcases/extension_type.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extension_type.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -44,49 +44,30 @@
           listener: handleNoPrimaryConstructor(E, null)
           parseClassOrMixinOrEnumImplementsOpt(E)
             listener: handleImplements(null, 0)
-          ensureBlock(E, null, extension type declaration)
-            reportRecoverableError(E, Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
-              listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], E, E)
-            insertBlock(E)
-              rewriter()
-              rewriter()
-          parseClassOrMixinOrExtensionBody(E, DeclarationKind.ExtensionType, E)
+          parseExtensionTypeHeaderRecovery(E, extension)
+            parseDeclarationHeaderRecoveryInternal(E, extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt(E)
+              skipUnexpectedTokenOpt(E, [extends, with, implements, {])
+              reportRecoverableError(on, Message[ExpectedInstead, Expected 'extends' instead of this., null, {string: extends}])
+                listener: handleRecoverableError(Message[ExpectedInstead, Expected 'extends' instead of this., null, {string: extends}], on, on)
+              parseClassExtendsSeenExtendsClause(on, E, DeclarationHeaderKind.ExtensionType)
+                listener: handleIdentifier(A, typeReference)
+                listener: handleNoTypeArguments({)
+                listener: handleType(A, null)
+                listener: handleClassExtends(on, 1)
+              reportRecoverableError(on, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, on, on)
+              parseClassWithClauseOpt(A)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(A)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(A, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(A, DeclarationKind.ExtensionType, E)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
             notEofOrValue(}, })
             listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
           listener: endExtensionTypeDeclaration(extension, type, })
-  listener: endTopLevelDeclaration(on)
-  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
-    parseMetadataStar(})
-      listener: beginMetadataStar(on)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(})
-      listener: beginTopLevelMember(on)
-      parseTopLevelMethod(}, null, null, }, Instance of 'SimpleType', null, A, false)
-        listener: beginTopLevelMethod(}, null, null)
-        listener: handleIdentifier(on, typeReference)
-        listener: handleNoTypeArguments(A)
-        listener: handleType(on, null)
-        ensureIdentifierPotentiallyRecovered(on, topLevelFunctionDeclaration, false)
-          listener: handleIdentifier(A, topLevelFunctionDeclaration)
-        parseMethodTypeVar(A)
-          listener: handleNoTypeVariables({)
-        parseGetterOrFormalParameters(A, A, false, MemberKind.TopLevelMethod)
-          missingParameterMessage(MemberKind.TopLevelMethod)
-          reportRecoverableError(A, MissingFunctionParameters)
-            listener: handleRecoverableError(MissingFunctionParameters, A, A)
-          rewriter()
-          parseFormalParametersRest((, MemberKind.TopLevelMethod)
-            listener: beginFormalParameters((, MemberKind.TopLevelMethod)
-            listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-        parseAsyncModifierOpt())
-          listener: handleAsyncModifier(null, null)
-          inPlainSync()
-        parseFunctionBody(), false, false)
-          listener: beginBlockFunctionBody({)
-          notEofOrValue(}, })
-          listener: endBlockFunctionBody(0, {, })
-        listener: endTopLevelMethod(on, null, })
   listener: endTopLevelDeclaration()
   reportAllErrorTokens(class)
-  listener: endCompilationUnit(3, )
+  listener: endCompilationUnit(2, )
diff --git a/pkg/front_end/parser_testcases/extension_type.dart.parser.expect b/pkg/front_end/parser_testcases/extension_type.dart.parser.expect
index 5418181..0a015a7 100644
--- a/pkg/front_end/parser_testcases/extension_type.dart.parser.expect
+++ b/pkg/front_end/parser_testcases/extension_type.dart.parser.expect
@@ -1,11 +1,9 @@
-NOTICE: Stream was rewritten by parser!
-
 class A {}
 
-extension type E {}on A (){}
+extension type E on A {}
 
 
 class[KeywordToken] A[StringToken] {[BeginToken]}[SimpleToken]
 
-extension[KeywordToken] type[StringToken] E[StringToken] {[SyntheticBeginToken]}[SyntheticToken]on[KeywordToken] A[StringToken] ([SyntheticBeginToken])[SyntheticToken]{[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] E[StringToken] on[KeywordToken] A[StringToken] {[BeginToken]}[SimpleToken]
 [SimpleToken]
diff --git a/pkg/front_end/parser_testcases/extensions/covariant.dart.intertwined.expect b/pkg/front_end/parser_testcases/extensions/covariant.dart.intertwined.expect
index 1242442..2692015 100644
--- a/pkg/front_end/parser_testcases/extensions/covariant.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extensions/covariant.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -42,8 +42,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
-              parseClassExtendsSeenExtendsClause(extends, C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, C, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
diff --git a/pkg/front_end/parser_testcases/extensions/not_covariant.dart.intertwined.expect b/pkg/front_end/parser_testcases/extensions/not_covariant.dart.intertwined.expect
index 97aaf20..2e973cd 100644
--- a/pkg/front_end/parser_testcases/extensions/not_covariant.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extensions/not_covariant.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -42,8 +42,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
-              parseClassExtendsSeenExtendsClause(extends, C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, C, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
diff --git a/pkg/front_end/parser_testcases/extensions/static.dart.intertwined.expect b/pkg/front_end/parser_testcases/extensions/static.dart.intertwined.expect
index 7f15cee..d25d84c 100644
--- a/pkg/front_end/parser_testcases/extensions/static.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extensions/static.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -42,8 +42,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
-              parseClassExtendsSeenExtendsClause(extends, C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, C, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
diff --git a/pkg/front_end/parser_testcases/extensions/static_covariant.dart.intertwined.expect b/pkg/front_end/parser_testcases/extensions/static_covariant.dart.intertwined.expect
index e9464fa..05ae22d 100644
--- a/pkg/front_end/parser_testcases/extensions/static_covariant.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extensions/static_covariant.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
@@ -42,8 +42,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
-              parseClassExtendsSeenExtendsClause(extends, C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, C, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(A, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(A, null)
diff --git a/pkg/front_end/parser_testcases/general/augment_super.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/augment_super.dart.intertwined.expect
index 2b1d1bf..8c57edb 100644
--- a/pkg/front_end/parser_testcases/general/augment_super.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/augment_super.dart.intertwined.expect
@@ -719,7 +719,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Class)
         parseClass(Class, class, class, Class)
           parseClassHeaderOpt(Class, class, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
diff --git a/pkg/front_end/parser_testcases/general/built_in_identifier_class_fields.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/built_in_identifier_class_fields.dart.intertwined.expect
index d4ac67c..7051e56 100644
--- a/pkg/front_end/parser_testcases/general/built_in_identifier_class_fields.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/built_in_identifier_class_fields.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, WrapperClass)
         parseClass(WrapperClass, class, class, WrapperClass)
           parseClassHeaderOpt(WrapperClass, class, class)
-            parseClassExtendsOpt(WrapperClass)
+            parseClassExtendsOpt(WrapperClass, DeclarationHeaderKind.Class)
               listener: handleNoType(WrapperClass)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(WrapperClass)
diff --git a/pkg/front_end/parser_testcases/general/built_in_identifier_class_methods.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/built_in_identifier_class_methods.dart.intertwined.expect
index 7295871..e85cf51 100644
--- a/pkg/front_end/parser_testcases/general/built_in_identifier_class_methods.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/built_in_identifier_class_methods.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, WrapperClass)
         parseClass(WrapperClass, class, class, WrapperClass)
           parseClassHeaderOpt(WrapperClass, class, class)
-            parseClassExtendsOpt(WrapperClass)
+            parseClassExtendsOpt(WrapperClass, DeclarationHeaderKind.Class)
               listener: handleNoType(WrapperClass)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(WrapperClass)
diff --git a/pkg/front_end/parser_testcases/general/issue_41121.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/issue_41121.dart.intertwined.expect
index e1e2874..7a3978b 100644
--- a/pkg/front_end/parser_testcases/general/issue_41121.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/issue_41121.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, ConfigurationService)
         parseClass(ConfigurationService, class, class, ConfigurationService)
           parseClassHeaderOpt(ConfigurationService, class, class)
-            parseClassExtendsOpt(ConfigurationService)
+            parseClassExtendsOpt(ConfigurationService, DeclarationHeaderKind.Class)
               listener: handleNoType(ConfigurationService)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(ConfigurationService)
@@ -519,7 +519,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Configuration)
         parseClass(Configuration, class, class, Configuration)
           parseClassHeaderOpt(Configuration, class, class)
-            parseClassExtendsOpt(Configuration)
+            parseClassExtendsOpt(Configuration, DeclarationHeaderKind.Class)
               listener: handleNoType(Configuration)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Configuration)
diff --git a/pkg/front_end/parser_testcases/general/issue_45703.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/issue_45703.dart.intertwined.expect
index 90a3382..cc1b7aa 100644
--- a/pkg/front_end/parser_testcases/general/issue_45703.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/issue_45703.dart.intertwined.expect
@@ -17,7 +17,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Function)
         parseClass(Function, class, class, Function)
           parseClassHeaderOpt(Function, class, class)
-            parseClassExtendsOpt(Function)
+            parseClassExtendsOpt(Function, DeclarationHeaderKind.Class)
               listener: handleNoType(Function)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Function)
@@ -56,7 +56,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(>, class, class, C)
           parseClassHeaderOpt(>, class, class)
-            parseClassExtendsOpt(>)
+            parseClassExtendsOpt(>, DeclarationHeaderKind.Class)
               listener: handleNoType(>)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(>)
diff --git a/pkg/front_end/parser_testcases/general/metadata.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/metadata.dart.intertwined.expect
index 8177457..b874d6a 100644
--- a/pkg/front_end/parser_testcases/general/metadata.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/metadata.dart.intertwined.expect
@@ -237,7 +237,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, X)
         parseClass(X, class, class, X)
           parseClassHeaderOpt(X, class, class)
-            parseClassExtendsOpt(X)
+            parseClassExtendsOpt(X, DeclarationHeaderKind.Class)
               listener: handleNoType(X)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(X)
@@ -1711,7 +1711,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Y)
         parseClass(Y, class, class, Y)
           parseClassHeaderOpt(Y, class, class)
-            parseClassExtendsOpt(Y)
+            parseClassExtendsOpt(Y, DeclarationHeaderKind.Class)
               listener: handleNoType(Y)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Y)
diff --git a/pkg/front_end/parser_testcases/general/new_as_identifier.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/new_as_identifier.dart.intertwined.expect
index 007f1f1..1858f4d 100644
--- a/pkg/front_end/parser_testcases/general/new_as_identifier.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/new_as_identifier.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
@@ -241,7 +241,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, D)
         parseClass(D, class, class, D)
           parseClassHeaderOpt(D, class, class)
-            parseClassExtendsOpt(D)
+            parseClassExtendsOpt(D, DeclarationHeaderKind.Class)
               listener: handleNoType(D)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(D)
diff --git a/pkg/front_end/parser_testcases/general/operator_01.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/operator_01.dart.intertwined.expect
index 8d2b2ab..0fe9012 100644
--- a/pkg/front_end/parser_testcases/general/operator_01.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/operator_01.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/general/operator_hat_class.crash_dart.intertwined.expect b/pkg/front_end/parser_testcases/general/operator_hat_class.crash_dart.intertwined.expect
index 2dc796f..221b322 100644
--- a/pkg/front_end/parser_testcases/general/operator_hat_class.crash_dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/operator_hat_class.crash_dart.intertwined.expect
@@ -17,7 +17,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, operator)
         parseClass(operator, class, class, operator)
           parseClassHeaderOpt(operator, class, class)
-            parseClassExtendsOpt(operator)
+            parseClassExtendsOpt(operator, DeclarationHeaderKind.Class)
               listener: handleNoType(operator)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(operator)
diff --git a/pkg/front_end/parser_testcases/inline_class/extends_with.dart b/pkg/front_end/parser_testcases/inline_class/extends_with.dart
index 3e4c552..13bf26100 100644
--- a/pkg/front_end/parser_testcases/inline_class/extends_with.dart
+++ b/pkg/front_end/parser_testcases/inline_class/extends_with.dart
@@ -8,3 +8,16 @@
 extension type ET8(int i) with Foo, Bar implements Baz {}
 extension type ET9(int i) extends Foo with Bar implements Baz {}
 extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
+extension type ET11(int i) implements Bar extends Foo {}
+extension type ET12(int i) implements Bar with Foo {}
+extension type ET13(int i) implements Bar with Foo, Bar {}
+extension type ET14(int i) implements Bar extends Foo with Bar {}
+extension type ET15(int i) implements Bar extends Foo with Bar, Baz {}
+extension type ET16(int i) implements Bar extends Foo implements Bar {}
+extension type ET17(int i) implements Bar with Foo implements Bar {}
+extension type ET18(int i) implements Bar with Foo, Bar implements Baz {}
+extension type ET19(int i) implements Bar extends Foo with Bar implements Baz {}
+extension type ET20(int i) implements Bar extends Foo with Bar, Baz implements Boz {}
+extension type ET21(int i) implements Bar implements Boz {}
+extension type ET22(int i) extends Bar extends Boz {}
+extension type ET23(int i) extends Bar, Boz {}
diff --git a/pkg/front_end/parser_testcases/inline_class/extends_with.dart.expect b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.expect
index f457b13..545a3c0 100644
--- a/pkg/front_end/parser_testcases/inline_class/extends_with.dart.expect
+++ b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.expect
@@ -1,345 +1,153 @@
 Problems reported:
 
-parser/inline_class/extends_with:1:25: A extension type declaration must have a body, even if it is empty.
-extension type ET1(int i) extends Foo {}
-                        ^
-
-parser/inline_class/extends_with:1:27: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+parser/inline_class/extends_with:1:27: An extension type declaration can't have an 'extends' clause.
 extension type ET1(int i) extends Foo {}
                           ^^^^^^^
 
-parser/inline_class/extends_with:1:27: 'extends' can't be used as an identifier because it's a keyword.
-extension type ET1(int i) extends Foo {}
-                          ^^^^^^^
-
-parser/inline_class/extends_with:1:27: Expected ';' after this.
-extension type ET1(int i) extends Foo {}
-                          ^^^^^^^
-
-parser/inline_class/extends_with:1:35: A function declaration needs an explicit list of parameters.
-extension type ET1(int i) extends Foo {}
-                                  ^^^
-
-parser/inline_class/extends_with:2:25: A extension type declaration must have a body, even if it is empty.
-extension type ET2(int i) with Foo {}
-                        ^
-
-parser/inline_class/extends_with:2:27: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+parser/inline_class/extends_with:2:27: An extension type declaration can't have a 'with' clause.
 extension type ET2(int i) with Foo {}
                           ^^^^
 
-parser/inline_class/extends_with:2:27: 'with' can't be used as an identifier because it's a keyword.
-extension type ET2(int i) with Foo {}
-                          ^^^^
-
-parser/inline_class/extends_with:2:27: Expected ';' after this.
-extension type ET2(int i) with Foo {}
-                          ^^^^
-
-parser/inline_class/extends_with:2:32: A function declaration needs an explicit list of parameters.
-extension type ET2(int i) with Foo {}
-                               ^^^
-
-parser/inline_class/extends_with:3:25: A extension type declaration must have a body, even if it is empty.
-extension type ET3(int i) with Foo, Bar {}
-                        ^
-
-parser/inline_class/extends_with:3:27: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+parser/inline_class/extends_with:3:27: An extension type declaration can't have a 'with' clause.
 extension type ET3(int i) with Foo, Bar {}
                           ^^^^
 
-parser/inline_class/extends_with:3:27: 'with' can't be used as an identifier because it's a keyword.
-extension type ET3(int i) with Foo, Bar {}
-                          ^^^^
-
-parser/inline_class/extends_with:3:27: Expected ';' after this.
-extension type ET3(int i) with Foo, Bar {}
-                          ^^^^
-
-parser/inline_class/extends_with:3:32: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-extension type ET3(int i) with Foo, Bar {}
-                               ^^^
-
-parser/inline_class/extends_with:3:37: Expected ';' after this.
-extension type ET3(int i) with Foo, Bar {}
-                                    ^^^
-
-parser/inline_class/extends_with:3:41: Expected a declaration, but got '{'.
-extension type ET3(int i) with Foo, Bar {}
-                                        ^
-
-parser/inline_class/extends_with:4:25: A extension type declaration must have a body, even if it is empty.
-extension type ET4(int i) extends Foo with Bar {}
-                        ^
-
-parser/inline_class/extends_with:4:27: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+parser/inline_class/extends_with:4:27: An extension type declaration can't have an 'extends' clause.
 extension type ET4(int i) extends Foo with Bar {}
                           ^^^^^^^
 
-parser/inline_class/extends_with:4:27: 'extends' can't be used as an identifier because it's a keyword.
-extension type ET4(int i) extends Foo with Bar {}
-                          ^^^^^^^
-
-parser/inline_class/extends_with:4:27: Expected ';' after this.
-extension type ET4(int i) extends Foo with Bar {}
-                          ^^^^^^^
-
-parser/inline_class/extends_with:4:35: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-extension type ET4(int i) extends Foo with Bar {}
-                                  ^^^
-
-parser/inline_class/extends_with:4:35: Expected ';' after this.
-extension type ET4(int i) extends Foo with Bar {}
-                                  ^^^
-
-parser/inline_class/extends_with:4:39: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+parser/inline_class/extends_with:4:39: An extension type declaration can't have a 'with' clause.
 extension type ET4(int i) extends Foo with Bar {}
                                       ^^^^
 
-parser/inline_class/extends_with:4:39: 'with' can't be used as an identifier because it's a keyword.
-extension type ET4(int i) extends Foo with Bar {}
-                                      ^^^^
-
-parser/inline_class/extends_with:4:39: Expected ';' after this.
-extension type ET4(int i) extends Foo with Bar {}
-                                      ^^^^
-
-parser/inline_class/extends_with:4:44: A function declaration needs an explicit list of parameters.
-extension type ET4(int i) extends Foo with Bar {}
-                                           ^^^
-
-parser/inline_class/extends_with:5:25: A extension type declaration must have a body, even if it is empty.
-extension type ET5(int i) extends Foo with Bar, Baz {}
-                        ^
-
-parser/inline_class/extends_with:5:27: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+parser/inline_class/extends_with:5:27: An extension type declaration can't have an 'extends' clause.
 extension type ET5(int i) extends Foo with Bar, Baz {}
                           ^^^^^^^
 
-parser/inline_class/extends_with:5:27: 'extends' can't be used as an identifier because it's a keyword.
-extension type ET5(int i) extends Foo with Bar, Baz {}
-                          ^^^^^^^
-
-parser/inline_class/extends_with:5:27: Expected ';' after this.
-extension type ET5(int i) extends Foo with Bar, Baz {}
-                          ^^^^^^^
-
-parser/inline_class/extends_with:5:35: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-extension type ET5(int i) extends Foo with Bar, Baz {}
-                                  ^^^
-
-parser/inline_class/extends_with:5:35: Expected ';' after this.
-extension type ET5(int i) extends Foo with Bar, Baz {}
-                                  ^^^
-
-parser/inline_class/extends_with:5:39: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+parser/inline_class/extends_with:5:39: An extension type declaration can't have a 'with' clause.
 extension type ET5(int i) extends Foo with Bar, Baz {}
                                       ^^^^
 
-parser/inline_class/extends_with:5:39: 'with' can't be used as an identifier because it's a keyword.
-extension type ET5(int i) extends Foo with Bar, Baz {}
-                                      ^^^^
-
-parser/inline_class/extends_with:5:39: Expected ';' after this.
-extension type ET5(int i) extends Foo with Bar, Baz {}
-                                      ^^^^
-
-parser/inline_class/extends_with:5:44: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-extension type ET5(int i) extends Foo with Bar, Baz {}
-                                           ^^^
-
-parser/inline_class/extends_with:5:49: Expected ';' after this.
-extension type ET5(int i) extends Foo with Bar, Baz {}
-                                                ^^^
-
-parser/inline_class/extends_with:5:53: Expected a declaration, but got '{'.
-extension type ET5(int i) extends Foo with Bar, Baz {}
-                                                    ^
-
-parser/inline_class/extends_with:6:25: A extension type declaration must have a body, even if it is empty.
-extension type ET6(int i) extends Foo implements Bar {}
-                        ^
-
-parser/inline_class/extends_with:6:27: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+parser/inline_class/extends_with:6:27: An extension type declaration can't have an 'extends' clause.
 extension type ET6(int i) extends Foo implements Bar {}
                           ^^^^^^^
 
-parser/inline_class/extends_with:6:27: 'extends' can't be used as an identifier because it's a keyword.
-extension type ET6(int i) extends Foo implements Bar {}
-                          ^^^^^^^
-
-parser/inline_class/extends_with:6:27: Expected ';' after this.
-extension type ET6(int i) extends Foo implements Bar {}
-                          ^^^^^^^
-
-parser/inline_class/extends_with:6:39: Expected ';' after this.
-extension type ET6(int i) extends Foo implements Bar {}
-                                      ^^^^^^^^^^
-
-parser/inline_class/extends_with:6:50: A function declaration needs an explicit list of parameters.
-extension type ET6(int i) extends Foo implements Bar {}
-                                                 ^^^
-
-parser/inline_class/extends_with:7:25: A extension type declaration must have a body, even if it is empty.
-extension type ET7(int i) with Foo implements Bar {}
-                        ^
-
-parser/inline_class/extends_with:7:27: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+parser/inline_class/extends_with:7:27: An extension type declaration can't have a 'with' clause.
 extension type ET7(int i) with Foo implements Bar {}
                           ^^^^
 
-parser/inline_class/extends_with:7:27: 'with' can't be used as an identifier because it's a keyword.
-extension type ET7(int i) with Foo implements Bar {}
-                          ^^^^
-
-parser/inline_class/extends_with:7:27: Expected ';' after this.
-extension type ET7(int i) with Foo implements Bar {}
-                          ^^^^
-
-parser/inline_class/extends_with:7:36: Expected ';' after this.
-extension type ET7(int i) with Foo implements Bar {}
-                                   ^^^^^^^^^^
-
-parser/inline_class/extends_with:7:47: A function declaration needs an explicit list of parameters.
-extension type ET7(int i) with Foo implements Bar {}
-                                              ^^^
-
-parser/inline_class/extends_with:8:25: A extension type declaration must have a body, even if it is empty.
-extension type ET8(int i) with Foo, Bar implements Baz {}
-                        ^
-
-parser/inline_class/extends_with:8:27: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+parser/inline_class/extends_with:8:27: An extension type declaration can't have a 'with' clause.
 extension type ET8(int i) with Foo, Bar implements Baz {}
                           ^^^^
 
-parser/inline_class/extends_with:8:27: 'with' can't be used as an identifier because it's a keyword.
-extension type ET8(int i) with Foo, Bar implements Baz {}
-                          ^^^^
-
-parser/inline_class/extends_with:8:27: Expected ';' after this.
-extension type ET8(int i) with Foo, Bar implements Baz {}
-                          ^^^^
-
-parser/inline_class/extends_with:8:32: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-extension type ET8(int i) with Foo, Bar implements Baz {}
-                               ^^^
-
-parser/inline_class/extends_with:8:37: Expected ';' after this.
-extension type ET8(int i) with Foo, Bar implements Baz {}
-                                    ^^^
-
-parser/inline_class/extends_with:8:41: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-extension type ET8(int i) with Foo, Bar implements Baz {}
-                                        ^^^^^^^^^^
-
-parser/inline_class/extends_with:8:41: Expected ';' after this.
-extension type ET8(int i) with Foo, Bar implements Baz {}
-                                        ^^^^^^^^^^
-
-parser/inline_class/extends_with:8:52: A function declaration needs an explicit list of parameters.
-extension type ET8(int i) with Foo, Bar implements Baz {}
-                                                   ^^^
-
-parser/inline_class/extends_with:9:25: A extension type declaration must have a body, even if it is empty.
-extension type ET9(int i) extends Foo with Bar implements Baz {}
-                        ^
-
-parser/inline_class/extends_with:9:27: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+parser/inline_class/extends_with:9:27: An extension type declaration can't have an 'extends' clause.
 extension type ET9(int i) extends Foo with Bar implements Baz {}
                           ^^^^^^^
 
-parser/inline_class/extends_with:9:27: 'extends' can't be used as an identifier because it's a keyword.
-extension type ET9(int i) extends Foo with Bar implements Baz {}
-                          ^^^^^^^
-
-parser/inline_class/extends_with:9:27: Expected ';' after this.
-extension type ET9(int i) extends Foo with Bar implements Baz {}
-                          ^^^^^^^
-
-parser/inline_class/extends_with:9:35: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-extension type ET9(int i) extends Foo with Bar implements Baz {}
-                                  ^^^
-
-parser/inline_class/extends_with:9:35: Expected ';' after this.
-extension type ET9(int i) extends Foo with Bar implements Baz {}
-                                  ^^^
-
-parser/inline_class/extends_with:9:39: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+parser/inline_class/extends_with:9:39: An extension type declaration can't have a 'with' clause.
 extension type ET9(int i) extends Foo with Bar implements Baz {}
                                       ^^^^
 
-parser/inline_class/extends_with:9:39: 'with' can't be used as an identifier because it's a keyword.
-extension type ET9(int i) extends Foo with Bar implements Baz {}
-                                      ^^^^
-
-parser/inline_class/extends_with:9:39: Expected ';' after this.
-extension type ET9(int i) extends Foo with Bar implements Baz {}
-                                      ^^^^
-
-parser/inline_class/extends_with:9:48: Expected ';' after this.
-extension type ET9(int i) extends Foo with Bar implements Baz {}
-                                               ^^^^^^^^^^
-
-parser/inline_class/extends_with:9:59: A function declaration needs an explicit list of parameters.
-extension type ET9(int i) extends Foo with Bar implements Baz {}
-                                                          ^^^
-
-parser/inline_class/extends_with:10:26: A extension type declaration must have a body, even if it is empty.
-extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
-                         ^
-
-parser/inline_class/extends_with:10:28: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
+parser/inline_class/extends_with:10:28: An extension type declaration can't have an 'extends' clause.
 extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
                            ^^^^^^^
 
-parser/inline_class/extends_with:10:28: 'extends' can't be used as an identifier because it's a keyword.
+parser/inline_class/extends_with:10:40: An extension type declaration can't have a 'with' clause.
 extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
+                                       ^^^^
+
+parser/inline_class/extends_with:11:43: An extension type declaration can't have an 'extends' clause.
+extension type ET11(int i) implements Bar extends Foo {}
+                                          ^^^^^^^
+
+parser/inline_class/extends_with:12:43: An extension type declaration can't have a 'with' clause.
+extension type ET12(int i) implements Bar with Foo {}
+                                          ^^^^
+
+parser/inline_class/extends_with:13:43: An extension type declaration can't have a 'with' clause.
+extension type ET13(int i) implements Bar with Foo, Bar {}
+                                          ^^^^
+
+parser/inline_class/extends_with:14:43: An extension type declaration can't have an 'extends' clause.
+extension type ET14(int i) implements Bar extends Foo with Bar {}
+                                          ^^^^^^^
+
+parser/inline_class/extends_with:14:55: An extension type declaration can't have a 'with' clause.
+extension type ET14(int i) implements Bar extends Foo with Bar {}
+                                                      ^^^^
+
+parser/inline_class/extends_with:15:43: An extension type declaration can't have an 'extends' clause.
+extension type ET15(int i) implements Bar extends Foo with Bar, Baz {}
+                                          ^^^^^^^
+
+parser/inline_class/extends_with:15:55: An extension type declaration can't have a 'with' clause.
+extension type ET15(int i) implements Bar extends Foo with Bar, Baz {}
+                                                      ^^^^
+
+parser/inline_class/extends_with:16:43: An extension type declaration can't have an 'extends' clause.
+extension type ET16(int i) implements Bar extends Foo implements Bar {}
+                                          ^^^^^^^
+
+parser/inline_class/extends_with:16:55: Each class definition can have at most one implements clause.
+extension type ET16(int i) implements Bar extends Foo implements Bar {}
+                                                      ^^^^^^^^^^
+
+parser/inline_class/extends_with:17:43: An extension type declaration can't have a 'with' clause.
+extension type ET17(int i) implements Bar with Foo implements Bar {}
+                                          ^^^^
+
+parser/inline_class/extends_with:17:52: Each class definition can have at most one implements clause.
+extension type ET17(int i) implements Bar with Foo implements Bar {}
+                                                   ^^^^^^^^^^
+
+parser/inline_class/extends_with:18:43: An extension type declaration can't have a 'with' clause.
+extension type ET18(int i) implements Bar with Foo, Bar implements Baz {}
+                                          ^^^^
+
+parser/inline_class/extends_with:18:57: Each class definition can have at most one implements clause.
+extension type ET18(int i) implements Bar with Foo, Bar implements Baz {}
+                                                        ^^^^^^^^^^
+
+parser/inline_class/extends_with:19:43: An extension type declaration can't have an 'extends' clause.
+extension type ET19(int i) implements Bar extends Foo with Bar implements Baz {}
+                                          ^^^^^^^
+
+parser/inline_class/extends_with:19:55: An extension type declaration can't have a 'with' clause.
+extension type ET19(int i) implements Bar extends Foo with Bar implements Baz {}
+                                                      ^^^^
+
+parser/inline_class/extends_with:19:64: Each class definition can have at most one implements clause.
+extension type ET19(int i) implements Bar extends Foo with Bar implements Baz {}
+                                                               ^^^^^^^^^^
+
+parser/inline_class/extends_with:20:43: An extension type declaration can't have an 'extends' clause.
+extension type ET20(int i) implements Bar extends Foo with Bar, Baz implements Boz {}
+                                          ^^^^^^^
+
+parser/inline_class/extends_with:20:55: An extension type declaration can't have a 'with' clause.
+extension type ET20(int i) implements Bar extends Foo with Bar, Baz implements Boz {}
+                                                      ^^^^
+
+parser/inline_class/extends_with:20:69: Each class definition can have at most one implements clause.
+extension type ET20(int i) implements Bar extends Foo with Bar, Baz implements Boz {}
+                                                                    ^^^^^^^^^^
+
+parser/inline_class/extends_with:21:43: Each class definition can have at most one implements clause.
+extension type ET21(int i) implements Bar implements Boz {}
+                                          ^^^^^^^^^^
+
+parser/inline_class/extends_with:22:28: An extension type declaration can't have an 'extends' clause.
+extension type ET22(int i) extends Bar extends Boz {}
                            ^^^^^^^
 
-parser/inline_class/extends_with:10:28: Expected ';' after this.
-extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
+parser/inline_class/extends_with:22:40: An extension type declaration can't have an 'extends' clause.
+extension type ET22(int i) extends Bar extends Boz {}
+                                       ^^^^^^^
+
+parser/inline_class/extends_with:23:28: An extension type declaration can't have an 'extends' clause.
+extension type ET23(int i) extends Bar, Boz {}
                            ^^^^^^^
 
-parser/inline_class/extends_with:10:36: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
-                                   ^^^
-
-parser/inline_class/extends_with:10:36: Expected ';' after this.
-extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
-                                   ^^^
-
-parser/inline_class/extends_with:10:40: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
-                                       ^^^^
-
-parser/inline_class/extends_with:10:40: 'with' can't be used as an identifier because it's a keyword.
-extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
-                                       ^^^^
-
-parser/inline_class/extends_with:10:40: Expected ';' after this.
-extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
-                                       ^^^^
-
-parser/inline_class/extends_with:10:45: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
-                                            ^^^
-
-parser/inline_class/extends_with:10:50: Expected ';' after this.
-extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
-                                                 ^^^
-
-parser/inline_class/extends_with:10:54: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
-extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
-                                                     ^^^^^^^^^^
-
-parser/inline_class/extends_with:10:54: Expected ';' after this.
-extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
-                                                     ^^^^^^^^^^
-
-parser/inline_class/extends_with:10:65: A function declaration needs an explicit list of parameters.
-extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
-                                                                ^^^
-
 beginCompilationUnit(extension)
   beginMetadataStar(extension)
   endMetadataStar(0)
@@ -360,37 +168,17 @@
         endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
       endPrimaryConstructor((, null, false)
       handleImplements(null, 0)
-      handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments({)
+      handleType(Foo, null)
+      handleClassExtends(extends, 1)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      handleClassNoWithClause()
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
       beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
     endExtensionTypeDeclaration(extension, type, })
-  endTopLevelDeclaration(extends)
-  beginMetadataStar(extends)
-  endMetadataStar(0)
-  beginTopLevelMember(extends)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-      handleRecoverableError(MissingConstFinalVarOrType, extends, extends)
-      handleNoType(})
-      handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'extends' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: extends}], extends, extends)
-      handleIdentifier(extends, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Foo)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], extends, extends)
-    endTopLevelFields(null, null, null, null, null, 1, extends, ;)
-  endTopLevelDeclaration(Foo)
-  beginMetadataStar(Foo)
-  endMetadataStar(0)
-  beginTopLevelMember(Foo)
-    beginTopLevelMethod(;, null, null)
-      handleNoType(;)
-      handleIdentifier(Foo, topLevelFunctionDeclaration)
-      handleNoTypeVariables({)
-      handleRecoverableError(MissingFunctionParameters, Foo, Foo)
-      beginFormalParameters((, MemberKind.TopLevelMethod)
-      endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-      handleAsyncModifier(null, null)
-      beginBlockFunctionBody({)
-      endBlockFunctionBody(0, {, })
-    endTopLevelMethod(Foo, null, })
   endTopLevelDeclaration(extension)
   beginMetadataStar(extension)
   endMetadataStar(0)
@@ -411,37 +199,20 @@
         endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
       endPrimaryConstructor((, null, false)
       handleImplements(null, 0)
-      handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
+      handleNoType())
+      handleClassExtends(null, 1)
+      beginTypeList(Foo)
+        handleIdentifier(Foo, typeReference)
+        handleNoTypeArguments({)
+        handleType(Foo, null)
+      endTypeList(1)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
       beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
     endExtensionTypeDeclaration(extension, type, })
-  endTopLevelDeclaration(with)
-  beginMetadataStar(with)
-  endMetadataStar(0)
-  beginTopLevelMember(with)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-      handleRecoverableError(MissingConstFinalVarOrType, with, with)
-      handleNoType(})
-      handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-      handleIdentifier(with, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Foo)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-    endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  endTopLevelDeclaration(Foo)
-  beginMetadataStar(Foo)
-  endMetadataStar(0)
-  beginTopLevelMember(Foo)
-    beginTopLevelMethod(;, null, null)
-      handleNoType(;)
-      handleIdentifier(Foo, topLevelFunctionDeclaration)
-      handleNoTypeVariables({)
-      handleRecoverableError(MissingFunctionParameters, Foo, Foo)
-      beginFormalParameters((, MemberKind.TopLevelMethod)
-      endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-      handleAsyncModifier(null, null)
-      beginBlockFunctionBody({)
-      endBlockFunctionBody(0, {, })
-    endTopLevelMethod(Foo, null, })
   endTopLevelDeclaration(extension)
   beginMetadataStar(extension)
   endMetadataStar(0)
@@ -462,44 +233,23 @@
         endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
       endPrimaryConstructor((, null, false)
       handleImplements(null, 0)
-      handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
+      handleNoType())
+      handleClassExtends(null, 1)
+      beginTypeList(Foo)
+        handleIdentifier(Foo, typeReference)
+        handleNoTypeArguments(,)
+        handleType(Foo, null)
+        handleIdentifier(Bar, typeReference)
+        handleNoTypeArguments({)
+        handleType(Bar, null)
+      endTypeList(2)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
       beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
     endExtensionTypeDeclaration(extension, type, })
-  endTopLevelDeclaration(with)
-  beginMetadataStar(with)
-  endMetadataStar(0)
-  beginTopLevelMember(with)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-      handleRecoverableError(MissingConstFinalVarOrType, with, with)
-      handleNoType(})
-      handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-      handleIdentifier(with, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Foo)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-    endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  endTopLevelDeclaration(Foo)
-  beginMetadataStar(Foo)
-  endMetadataStar(0)
-  beginTopLevelMember(Foo)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleRecoverableError(MissingConstFinalVarOrType, Foo, Foo)
-      handleNoType(;)
-      handleIdentifier(Foo, topLevelVariableDeclaration)
-      handleNoFieldInitializer(,)
-      handleIdentifier(Bar, topLevelVariableDeclaration)
-      handleNoFieldInitializer({)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Bar, Bar)
-    endTopLevelFields(null, null, null, null, null, 2, Foo, ;)
-  endTopLevelDeclaration({)
-  beginMetadataStar({)
-  endMetadataStar(0)
-  beginTopLevelMember({)
-    handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '{'., null, {lexeme: {}], {, {)
-    beginBlock({, BlockKind(invalid))
-    endBlock(0, {, }, BlockKind(invalid))
-    handleInvalidTopLevelBlock({)
-    handleInvalidTopLevelDeclaration(})
   endTopLevelDeclaration(extension)
   beginMetadataStar(extension)
   endMetadataStar(0)
@@ -520,60 +270,23 @@
         endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
       endPrimaryConstructor((, null, false)
       handleImplements(null, 0)
-      handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments(with)
+      handleType(Foo, null)
+      handleClassExtends(extends, 1)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      beginTypeList(Bar)
+        handleIdentifier(Bar, typeReference)
+        handleNoTypeArguments({)
+        handleType(Bar, null)
+      endTypeList(1)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
       beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
     endExtensionTypeDeclaration(extension, type, })
-  endTopLevelDeclaration(extends)
-  beginMetadataStar(extends)
-  endMetadataStar(0)
-  beginTopLevelMember(extends)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-      handleRecoverableError(MissingConstFinalVarOrType, extends, extends)
-      handleNoType(})
-      handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'extends' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: extends}], extends, extends)
-      handleIdentifier(extends, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Foo)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], extends, extends)
-    endTopLevelFields(null, null, null, null, null, 1, extends, ;)
-  endTopLevelDeclaration(Foo)
-  beginMetadataStar(Foo)
-  endMetadataStar(0)
-  beginTopLevelMember(Foo)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleRecoverableError(MissingConstFinalVarOrType, Foo, Foo)
-      handleNoType(;)
-      handleIdentifier(Foo, topLevelVariableDeclaration)
-      handleNoFieldInitializer(with)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Foo, Foo)
-    endTopLevelFields(null, null, null, null, null, 1, Foo, ;)
-  endTopLevelDeclaration(with)
-  beginMetadataStar(with)
-  endMetadataStar(0)
-  beginTopLevelMember(with)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleRecoverableError(MissingConstFinalVarOrType, with, with)
-      handleNoType(;)
-      handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-      handleIdentifier(with, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Bar)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-    endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  endTopLevelDeclaration(Bar)
-  beginMetadataStar(Bar)
-  endMetadataStar(0)
-  beginTopLevelMember(Bar)
-    beginTopLevelMethod(;, null, null)
-      handleNoType(;)
-      handleIdentifier(Bar, topLevelFunctionDeclaration)
-      handleNoTypeVariables({)
-      handleRecoverableError(MissingFunctionParameters, Bar, Bar)
-      beginFormalParameters((, MemberKind.TopLevelMethod)
-      endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-      handleAsyncModifier(null, null)
-      beginBlockFunctionBody({)
-      endBlockFunctionBody(0, {, })
-    endTopLevelMethod(Bar, null, })
   endTopLevelDeclaration(extension)
   beginMetadataStar(extension)
   endMetadataStar(0)
@@ -594,67 +307,26 @@
         endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
       endPrimaryConstructor((, null, false)
       handleImplements(null, 0)
-      handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments(with)
+      handleType(Foo, null)
+      handleClassExtends(extends, 1)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      beginTypeList(Bar)
+        handleIdentifier(Bar, typeReference)
+        handleNoTypeArguments(,)
+        handleType(Bar, null)
+        handleIdentifier(Baz, typeReference)
+        handleNoTypeArguments({)
+        handleType(Baz, null)
+      endTypeList(2)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
       beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
     endExtensionTypeDeclaration(extension, type, })
-  endTopLevelDeclaration(extends)
-  beginMetadataStar(extends)
-  endMetadataStar(0)
-  beginTopLevelMember(extends)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-      handleRecoverableError(MissingConstFinalVarOrType, extends, extends)
-      handleNoType(})
-      handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'extends' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: extends}], extends, extends)
-      handleIdentifier(extends, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Foo)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], extends, extends)
-    endTopLevelFields(null, null, null, null, null, 1, extends, ;)
-  endTopLevelDeclaration(Foo)
-  beginMetadataStar(Foo)
-  endMetadataStar(0)
-  beginTopLevelMember(Foo)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleRecoverableError(MissingConstFinalVarOrType, Foo, Foo)
-      handleNoType(;)
-      handleIdentifier(Foo, topLevelVariableDeclaration)
-      handleNoFieldInitializer(with)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Foo, Foo)
-    endTopLevelFields(null, null, null, null, null, 1, Foo, ;)
-  endTopLevelDeclaration(with)
-  beginMetadataStar(with)
-  endMetadataStar(0)
-  beginTopLevelMember(with)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleRecoverableError(MissingConstFinalVarOrType, with, with)
-      handleNoType(;)
-      handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-      handleIdentifier(with, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Bar)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-    endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  endTopLevelDeclaration(Bar)
-  beginMetadataStar(Bar)
-  endMetadataStar(0)
-  beginTopLevelMember(Bar)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleRecoverableError(MissingConstFinalVarOrType, Bar, Bar)
-      handleNoType(;)
-      handleIdentifier(Bar, topLevelVariableDeclaration)
-      handleNoFieldInitializer(,)
-      handleIdentifier(Baz, topLevelVariableDeclaration)
-      handleNoFieldInitializer({)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Baz, Baz)
-    endTopLevelFields(null, null, null, null, null, 2, Bar, ;)
-  endTopLevelDeclaration({)
-  beginMetadataStar({)
-  endMetadataStar(0)
-  beginTopLevelMember({)
-    handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '{'., null, {lexeme: {}], {, {)
-    beginBlock({, BlockKind(invalid))
-    endBlock(0, {, }, BlockKind(invalid))
-    handleInvalidTopLevelBlock({)
-    handleInvalidTopLevelDeclaration(})
   endTopLevelDeclaration(extension)
   beginMetadataStar(extension)
   endMetadataStar(0)
@@ -675,49 +347,20 @@
         endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
       endPrimaryConstructor((, null, false)
       handleImplements(null, 0)
-      handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
-      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
-      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
-    endExtensionTypeDeclaration(extension, type, })
-  endTopLevelDeclaration(extends)
-  beginMetadataStar(extends)
-  endMetadataStar(0)
-  beginTopLevelMember(extends)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-      handleRecoverableError(MissingConstFinalVarOrType, extends, extends)
-      handleNoType(})
-      handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'extends' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: extends}], extends, extends)
-      handleIdentifier(extends, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Foo)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], extends, extends)
-    endTopLevelFields(null, null, null, null, null, 1, extends, ;)
-  endTopLevelDeclaration(Foo)
-  beginMetadataStar(Foo)
-  endMetadataStar(0)
-  beginTopLevelMember(Foo)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
       handleIdentifier(Foo, typeReference)
       handleNoTypeArguments(implements)
       handleType(Foo, null)
-      handleIdentifier(implements, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Bar)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], implements, implements)
-    endTopLevelFields(null, null, null, null, null, 1, Foo, ;)
-  endTopLevelDeclaration(Bar)
-  beginMetadataStar(Bar)
-  endMetadataStar(0)
-  beginTopLevelMember(Bar)
-    beginTopLevelMethod(;, null, null)
-      handleNoType(;)
-      handleIdentifier(Bar, topLevelFunctionDeclaration)
-      handleNoTypeVariables({)
-      handleRecoverableError(MissingFunctionParameters, Bar, Bar)
-      beginFormalParameters((, MemberKind.TopLevelMethod)
-      endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-      handleAsyncModifier(null, null)
-      beginBlockFunctionBody({)
-      endBlockFunctionBody(0, {, })
-    endTopLevelMethod(Bar, null, })
+      handleClassExtends(extends, 1)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      handleClassNoWithClause()
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments({)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
   endTopLevelDeclaration(extension)
   beginMetadataStar(extension)
   endMetadataStar(0)
@@ -738,49 +381,23 @@
         endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
       endPrimaryConstructor((, null, false)
       handleImplements(null, 0)
-      handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
+      handleNoType())
+      handleClassExtends(null, 1)
+      beginTypeList(Foo)
+        handleIdentifier(Foo, typeReference)
+        handleNoTypeArguments(implements)
+        handleType(Foo, null)
+      endTypeList(1)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments({)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
       beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
     endExtensionTypeDeclaration(extension, type, })
-  endTopLevelDeclaration(with)
-  beginMetadataStar(with)
-  endMetadataStar(0)
-  beginTopLevelMember(with)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-      handleRecoverableError(MissingConstFinalVarOrType, with, with)
-      handleNoType(})
-      handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-      handleIdentifier(with, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Foo)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-    endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  endTopLevelDeclaration(Foo)
-  beginMetadataStar(Foo)
-  endMetadataStar(0)
-  beginTopLevelMember(Foo)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleIdentifier(Foo, typeReference)
-      handleNoTypeArguments(implements)
-      handleType(Foo, null)
-      handleIdentifier(implements, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Bar)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], implements, implements)
-    endTopLevelFields(null, null, null, null, null, 1, Foo, ;)
-  endTopLevelDeclaration(Bar)
-  beginMetadataStar(Bar)
-  endMetadataStar(0)
-  beginTopLevelMember(Bar)
-    beginTopLevelMethod(;, null, null)
-      handleNoType(;)
-      handleIdentifier(Bar, topLevelFunctionDeclaration)
-      handleNoTypeVariables({)
-      handleRecoverableError(MissingFunctionParameters, Bar, Bar)
-      beginFormalParameters((, MemberKind.TopLevelMethod)
-      endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-      handleAsyncModifier(null, null)
-      beginBlockFunctionBody({)
-      endBlockFunctionBody(0, {, })
-    endTopLevelMethod(Bar, null, })
   endTopLevelDeclaration(extension)
   beginMetadataStar(extension)
   endMetadataStar(0)
@@ -801,61 +418,26 @@
         endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
       endPrimaryConstructor((, null, false)
       handleImplements(null, 0)
-      handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
+      handleNoType())
+      handleClassExtends(null, 1)
+      beginTypeList(Foo)
+        handleIdentifier(Foo, typeReference)
+        handleNoTypeArguments(,)
+        handleType(Foo, null)
+        handleIdentifier(Bar, typeReference)
+        handleNoTypeArguments(implements)
+        handleType(Bar, null)
+      endTypeList(2)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleIdentifier(Baz, typeReference)
+      handleNoTypeArguments({)
+      handleType(Baz, null)
+      handleImplements(implements, 1)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
       beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
     endExtensionTypeDeclaration(extension, type, })
-  endTopLevelDeclaration(with)
-  beginMetadataStar(with)
-  endMetadataStar(0)
-  beginTopLevelMember(with)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-      handleRecoverableError(MissingConstFinalVarOrType, with, with)
-      handleNoType(})
-      handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-      handleIdentifier(with, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Foo)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-    endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  endTopLevelDeclaration(Foo)
-  beginMetadataStar(Foo)
-  endMetadataStar(0)
-  beginTopLevelMember(Foo)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleRecoverableError(MissingConstFinalVarOrType, Foo, Foo)
-      handleNoType(;)
-      handleIdentifier(Foo, topLevelVariableDeclaration)
-      handleNoFieldInitializer(,)
-      handleIdentifier(Bar, topLevelVariableDeclaration)
-      handleNoFieldInitializer(implements)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Bar, Bar)
-    endTopLevelFields(null, null, null, null, null, 2, Foo, ;)
-  endTopLevelDeclaration(implements)
-  beginMetadataStar(implements)
-  endMetadataStar(0)
-  beginTopLevelMember(implements)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleRecoverableError(MissingConstFinalVarOrType, implements, implements)
-      handleNoType(;)
-      handleIdentifier(implements, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Baz)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], implements, implements)
-    endTopLevelFields(null, null, null, null, null, 1, implements, ;)
-  endTopLevelDeclaration(Baz)
-  beginMetadataStar(Baz)
-  endMetadataStar(0)
-  beginTopLevelMember(Baz)
-    beginTopLevelMethod(;, null, null)
-      handleNoType(;)
-      handleIdentifier(Baz, topLevelFunctionDeclaration)
-      handleNoTypeVariables({)
-      handleRecoverableError(MissingFunctionParameters, Baz, Baz)
-      beginFormalParameters((, MemberKind.TopLevelMethod)
-      endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-      handleAsyncModifier(null, null)
-      beginBlockFunctionBody({)
-      endBlockFunctionBody(0, {, })
-    endTopLevelMethod(Baz, null, })
   endTopLevelDeclaration(extension)
   beginMetadataStar(extension)
   endMetadataStar(0)
@@ -876,72 +458,26 @@
         endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
       endPrimaryConstructor((, null, false)
       handleImplements(null, 0)
-      handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments(with)
+      handleType(Foo, null)
+      handleClassExtends(extends, 1)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      beginTypeList(Bar)
+        handleIdentifier(Bar, typeReference)
+        handleNoTypeArguments(implements)
+        handleType(Bar, null)
+      endTypeList(1)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleIdentifier(Baz, typeReference)
+      handleNoTypeArguments({)
+      handleType(Baz, null)
+      handleImplements(implements, 1)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
       beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
     endExtensionTypeDeclaration(extension, type, })
-  endTopLevelDeclaration(extends)
-  beginMetadataStar(extends)
-  endMetadataStar(0)
-  beginTopLevelMember(extends)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-      handleRecoverableError(MissingConstFinalVarOrType, extends, extends)
-      handleNoType(})
-      handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'extends' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: extends}], extends, extends)
-      handleIdentifier(extends, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Foo)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], extends, extends)
-    endTopLevelFields(null, null, null, null, null, 1, extends, ;)
-  endTopLevelDeclaration(Foo)
-  beginMetadataStar(Foo)
-  endMetadataStar(0)
-  beginTopLevelMember(Foo)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleRecoverableError(MissingConstFinalVarOrType, Foo, Foo)
-      handleNoType(;)
-      handleIdentifier(Foo, topLevelVariableDeclaration)
-      handleNoFieldInitializer(with)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Foo, Foo)
-    endTopLevelFields(null, null, null, null, null, 1, Foo, ;)
-  endTopLevelDeclaration(with)
-  beginMetadataStar(with)
-  endMetadataStar(0)
-  beginTopLevelMember(with)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleRecoverableError(MissingConstFinalVarOrType, with, with)
-      handleNoType(;)
-      handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-      handleIdentifier(with, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Bar)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-    endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  endTopLevelDeclaration(Bar)
-  beginMetadataStar(Bar)
-  endMetadataStar(0)
-  beginTopLevelMember(Bar)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleIdentifier(Bar, typeReference)
-      handleNoTypeArguments(implements)
-      handleType(Bar, null)
-      handleIdentifier(implements, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Baz)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], implements, implements)
-    endTopLevelFields(null, null, null, null, null, 1, Bar, ;)
-  endTopLevelDeclaration(Baz)
-  beginMetadataStar(Baz)
-  endMetadataStar(0)
-  beginTopLevelMember(Baz)
-    beginTopLevelMethod(;, null, null)
-      handleNoType(;)
-      handleIdentifier(Baz, topLevelFunctionDeclaration)
-      handleNoTypeVariables({)
-      handleRecoverableError(MissingFunctionParameters, Baz, Baz)
-      beginFormalParameters((, MemberKind.TopLevelMethod)
-      endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-      handleAsyncModifier(null, null)
-      beginBlockFunctionBody({)
-      endBlockFunctionBody(0, {, })
-    endTopLevelMethod(Baz, null, })
   endTopLevelDeclaration(extension)
   beginMetadataStar(extension)
   endMetadataStar(0)
@@ -962,83 +498,544 @@
         endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
       endPrimaryConstructor((, null, false)
       handleImplements(null, 0)
-      handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments(with)
+      handleType(Foo, null)
+      handleClassExtends(extends, 1)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      beginTypeList(Bar)
+        handleIdentifier(Bar, typeReference)
+        handleNoTypeArguments(,)
+        handleType(Bar, null)
+        handleIdentifier(Baz, typeReference)
+        handleNoTypeArguments(implements)
+        handleType(Baz, null)
+      endTypeList(2)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleIdentifier(Boz, typeReference)
+      handleNoTypeArguments({)
+      handleType(Boz, null)
+      handleImplements(implements, 1)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
       beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
     endExtensionTypeDeclaration(extension, type, })
-  endTopLevelDeclaration(extends)
-  beginMetadataStar(extends)
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
   endMetadataStar(0)
-  beginTopLevelMember(extends)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-      handleRecoverableError(MissingConstFinalVarOrType, extends, extends)
-      handleNoType(})
-      handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'extends' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: extends}], extends, extends)
-      handleIdentifier(extends, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Foo)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], extends, extends)
-    endTopLevelFields(null, null, null, null, null, 1, extends, ;)
-  endTopLevelDeclaration(Foo)
-  beginMetadataStar(Foo)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET11)
+      beginPrimaryConstructor(()
+        beginFormalParameters((, MemberKind.PrimaryConstructor)
+          beginMetadataStar(int)
+          endMetadataStar(0)
+          beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+            handleIdentifier(int, typeReference)
+            handleNoTypeArguments(i)
+            handleType(int, null)
+            handleIdentifier(i, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments(extends)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments({)
+      handleType(Foo, null)
+      handleClassExtends(extends, 1)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      handleClassNoWithClause()
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
   endMetadataStar(0)
-  beginTopLevelMember(Foo)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleRecoverableError(MissingConstFinalVarOrType, Foo, Foo)
-      handleNoType(;)
-      handleIdentifier(Foo, topLevelVariableDeclaration)
-      handleNoFieldInitializer(with)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Foo, Foo)
-    endTopLevelFields(null, null, null, null, null, 1, Foo, ;)
-  endTopLevelDeclaration(with)
-  beginMetadataStar(with)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET12)
+      beginPrimaryConstructor(()
+        beginFormalParameters((, MemberKind.PrimaryConstructor)
+          beginMetadataStar(int)
+          endMetadataStar(0)
+          beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+            handleIdentifier(int, typeReference)
+            handleNoTypeArguments(i)
+            handleType(int, null)
+            handleIdentifier(i, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments(with)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleNoType(Bar)
+      handleClassExtends(null, 1)
+      beginTypeList(Foo)
+        handleIdentifier(Foo, typeReference)
+        handleNoTypeArguments({)
+        handleType(Foo, null)
+      endTypeList(1)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
   endMetadataStar(0)
-  beginTopLevelMember(with)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleRecoverableError(MissingConstFinalVarOrType, with, with)
-      handleNoType(;)
-      handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-      handleIdentifier(with, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Bar)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-    endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  endTopLevelDeclaration(Bar)
-  beginMetadataStar(Bar)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET13)
+      beginPrimaryConstructor(()
+        beginFormalParameters((, MemberKind.PrimaryConstructor)
+          beginMetadataStar(int)
+          endMetadataStar(0)
+          beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+            handleIdentifier(int, typeReference)
+            handleNoTypeArguments(i)
+            handleType(int, null)
+            handleIdentifier(i, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments(with)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleNoType(Bar)
+      handleClassExtends(null, 1)
+      beginTypeList(Foo)
+        handleIdentifier(Foo, typeReference)
+        handleNoTypeArguments(,)
+        handleType(Foo, null)
+        handleIdentifier(Bar, typeReference)
+        handleNoTypeArguments({)
+        handleType(Bar, null)
+      endTypeList(2)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
   endMetadataStar(0)
-  beginTopLevelMember(Bar)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleRecoverableError(MissingConstFinalVarOrType, Bar, Bar)
-      handleNoType(;)
-      handleIdentifier(Bar, topLevelVariableDeclaration)
-      handleNoFieldInitializer(,)
-      handleIdentifier(Baz, topLevelVariableDeclaration)
-      handleNoFieldInitializer(implements)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Baz, Baz)
-    endTopLevelFields(null, null, null, null, null, 2, Bar, ;)
-  endTopLevelDeclaration(implements)
-  beginMetadataStar(implements)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET14)
+      beginPrimaryConstructor(()
+        beginFormalParameters((, MemberKind.PrimaryConstructor)
+          beginMetadataStar(int)
+          endMetadataStar(0)
+          beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+            handleIdentifier(int, typeReference)
+            handleNoTypeArguments(i)
+            handleType(int, null)
+            handleIdentifier(i, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments(extends)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments(with)
+      handleType(Foo, null)
+      handleClassExtends(extends, 1)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      beginTypeList(Bar)
+        handleIdentifier(Bar, typeReference)
+        handleNoTypeArguments({)
+        handleType(Bar, null)
+      endTypeList(1)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
   endMetadataStar(0)
-  beginTopLevelMember(implements)
-    beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-      handleRecoverableError(MissingConstFinalVarOrType, implements, implements)
-      handleNoType(;)
-      handleIdentifier(implements, topLevelVariableDeclaration)
-      handleNoFieldInitializer(Boz)
-      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], implements, implements)
-    endTopLevelFields(null, null, null, null, null, 1, implements, ;)
-  endTopLevelDeclaration(Boz)
-  beginMetadataStar(Boz)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET15)
+      beginPrimaryConstructor(()
+        beginFormalParameters((, MemberKind.PrimaryConstructor)
+          beginMetadataStar(int)
+          endMetadataStar(0)
+          beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+            handleIdentifier(int, typeReference)
+            handleNoTypeArguments(i)
+            handleType(int, null)
+            handleIdentifier(i, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments(extends)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments(with)
+      handleType(Foo, null)
+      handleClassExtends(extends, 1)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      beginTypeList(Bar)
+        handleIdentifier(Bar, typeReference)
+        handleNoTypeArguments(,)
+        handleType(Bar, null)
+        handleIdentifier(Baz, typeReference)
+        handleNoTypeArguments({)
+        handleType(Baz, null)
+      endTypeList(2)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
   endMetadataStar(0)
-  beginTopLevelMember(Boz)
-    beginTopLevelMethod(;, null, null)
-      handleNoType(;)
-      handleIdentifier(Boz, topLevelFunctionDeclaration)
-      handleNoTypeVariables({)
-      handleRecoverableError(MissingFunctionParameters, Boz, Boz)
-      beginFormalParameters((, MemberKind.TopLevelMethod)
-      endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-      handleAsyncModifier(null, null)
-      beginBlockFunctionBody({)
-      endBlockFunctionBody(0, {, })
-    endTopLevelMethod(Boz, null, })
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET16)
+      beginPrimaryConstructor(()
+        beginFormalParameters((, MemberKind.PrimaryConstructor)
+          beginMetadataStar(int)
+          endMetadataStar(0)
+          beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+            handleIdentifier(int, typeReference)
+            handleNoTypeArguments(i)
+            handleType(int, null)
+            handleIdentifier(i, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments(extends)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments(implements)
+      handleType(Foo, null)
+      handleClassExtends(extends, 1)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      handleClassNoWithClause()
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments({)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleRecoverableError(MultipleImplements, implements, implements)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET17)
+      beginPrimaryConstructor(()
+        beginFormalParameters((, MemberKind.PrimaryConstructor)
+          beginMetadataStar(int)
+          endMetadataStar(0)
+          beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+            handleIdentifier(int, typeReference)
+            handleNoTypeArguments(i)
+            handleType(int, null)
+            handleIdentifier(i, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments(with)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleNoType(Bar)
+      handleClassExtends(null, 1)
+      beginTypeList(Foo)
+        handleIdentifier(Foo, typeReference)
+        handleNoTypeArguments(implements)
+        handleType(Foo, null)
+      endTypeList(1)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments({)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleRecoverableError(MultipleImplements, implements, implements)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET18)
+      beginPrimaryConstructor(()
+        beginFormalParameters((, MemberKind.PrimaryConstructor)
+          beginMetadataStar(int)
+          endMetadataStar(0)
+          beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+            handleIdentifier(int, typeReference)
+            handleNoTypeArguments(i)
+            handleType(int, null)
+            handleIdentifier(i, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments(with)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleNoType(Bar)
+      handleClassExtends(null, 1)
+      beginTypeList(Foo)
+        handleIdentifier(Foo, typeReference)
+        handleNoTypeArguments(,)
+        handleType(Foo, null)
+        handleIdentifier(Bar, typeReference)
+        handleNoTypeArguments(implements)
+        handleType(Bar, null)
+      endTypeList(2)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleIdentifier(Baz, typeReference)
+      handleNoTypeArguments({)
+      handleType(Baz, null)
+      handleImplements(implements, 1)
+      handleRecoverableError(MultipleImplements, implements, implements)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET19)
+      beginPrimaryConstructor(()
+        beginFormalParameters((, MemberKind.PrimaryConstructor)
+          beginMetadataStar(int)
+          endMetadataStar(0)
+          beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+            handleIdentifier(int, typeReference)
+            handleNoTypeArguments(i)
+            handleType(int, null)
+            handleIdentifier(i, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments(extends)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments(with)
+      handleType(Foo, null)
+      handleClassExtends(extends, 1)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      beginTypeList(Bar)
+        handleIdentifier(Bar, typeReference)
+        handleNoTypeArguments(implements)
+        handleType(Bar, null)
+      endTypeList(1)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleIdentifier(Baz, typeReference)
+      handleNoTypeArguments({)
+      handleType(Baz, null)
+      handleImplements(implements, 1)
+      handleRecoverableError(MultipleImplements, implements, implements)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET20)
+      beginPrimaryConstructor(()
+        beginFormalParameters((, MemberKind.PrimaryConstructor)
+          beginMetadataStar(int)
+          endMetadataStar(0)
+          beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+            handleIdentifier(int, typeReference)
+            handleNoTypeArguments(i)
+            handleType(int, null)
+            handleIdentifier(i, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments(extends)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments(with)
+      handleType(Foo, null)
+      handleClassExtends(extends, 1)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      beginTypeList(Bar)
+        handleIdentifier(Bar, typeReference)
+        handleNoTypeArguments(,)
+        handleType(Bar, null)
+        handleIdentifier(Baz, typeReference)
+        handleNoTypeArguments(implements)
+        handleType(Baz, null)
+      endTypeList(2)
+      handleClassWithClause(with)
+      handleRecoverableError(ExtensionTypeWith, with, with)
+      handleIdentifier(Boz, typeReference)
+      handleNoTypeArguments({)
+      handleType(Boz, null)
+      handleImplements(implements, 1)
+      handleRecoverableError(MultipleImplements, implements, implements)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET21)
+      beginPrimaryConstructor(()
+        beginFormalParameters((, MemberKind.PrimaryConstructor)
+          beginMetadataStar(int)
+          endMetadataStar(0)
+          beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+            handleIdentifier(int, typeReference)
+            handleNoTypeArguments(i)
+            handleType(int, null)
+            handleIdentifier(i, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments(implements)
+      handleType(Bar, null)
+      handleImplements(implements, 1)
+      handleNoType(Bar)
+      handleClassExtends(null, 1)
+      handleClassNoWithClause()
+      handleIdentifier(Boz, typeReference)
+      handleNoTypeArguments({)
+      handleType(Boz, null)
+      handleImplements(implements, 1)
+      handleRecoverableError(MultipleImplements, implements, implements)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET22)
+      beginPrimaryConstructor(()
+        beginFormalParameters((, MemberKind.PrimaryConstructor)
+          beginMetadataStar(int)
+          endMetadataStar(0)
+          beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+            handleIdentifier(int, typeReference)
+            handleNoTypeArguments(i)
+            handleType(int, null)
+            handleIdentifier(i, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleImplements(null, 0)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments(extends)
+      handleType(Bar, null)
+      handleClassExtends(extends, 1)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      handleClassNoWithClause()
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      handleIdentifier(Boz, typeReference)
+      handleNoTypeArguments({)
+      handleType(Boz, null)
+      handleClassExtends(extends, 1)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      handleClassNoWithClause()
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET23)
+      beginPrimaryConstructor(()
+        beginFormalParameters((, MemberKind.PrimaryConstructor)
+          beginMetadataStar(int)
+          endMetadataStar(0)
+          beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+            handleIdentifier(int, typeReference)
+            handleNoTypeArguments(i)
+            handleType(int, null)
+            handleIdentifier(i, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleImplements(null, 0)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments(,)
+      handleType(Bar, null)
+      handleIdentifier(Boz, typeReference)
+      handleNoTypeArguments({)
+      handleType(Boz, null)
+      handleClassExtends(extends, 2)
+      handleRecoverableError(ExtensionTypeExtends, extends, extends)
+      handleClassNoWithClause()
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
   endTopLevelDeclaration()
-endCompilationUnit(47, )
+endCompilationUnit(23, )
diff --git a/pkg/front_end/parser_testcases/inline_class/extends_with.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.intertwined.expect
index 9e9a081..d5f8d47 100644
--- a/pkg/front_end/parser_testcases/inline_class/extends_with.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.intertwined.expect
@@ -32,72 +32,29 @@
           listener: endPrimaryConstructor((, null, false)
           parseClassOrMixinOrEnumImplementsOpt())
             listener: handleImplements(null, 0)
-          ensureBlock(), null, extension type declaration)
-            reportRecoverableError(), Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
-              listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
-            insertBlock())
-              rewriter()
-              rewriter()
-          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, ET1)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(), [extends, with, implements, {])
+              parseClassExtendsOpt(), DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, ), DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments({)
+                  listener: handleType(Foo, null)
+                  listener: handleClassExtends(extends, 1)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Foo)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(Foo)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Foo, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Foo, DeclarationKind.ExtensionType, ET1)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
             notEofOrValue(}, })
             listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
           listener: endExtensionTypeDeclaration(extension, type, })
-  listener: endTopLevelDeclaration(extends)
-  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
-    parseMetadataStar(})
-      listener: beginMetadataStar(extends)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(})
-      listener: beginTopLevelMember(extends)
-      isReservedKeyword(Foo)
-      parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', extends, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-        reportRecoverableError(extends, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, extends, extends)
-        listener: handleNoType(})
-        ensureIdentifierPotentiallyRecovered(}, topLevelVariableDeclaration, false)
-          reportRecoverableErrorWithToken(extends, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'extends' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: extends}], extends, extends)
-          listener: handleIdentifier(extends, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(extends, extends, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Foo)
-        ensureSemicolon(extends)
-          reportRecoverableError(extends, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], extends, extends)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, extends, ;)
-  listener: endTopLevelDeclaration(Foo)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Foo)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Foo)
-      isReservedKeyword({)
-      parseTopLevelMethod(;, null, null, ;, Instance of 'NoType', null, Foo, false)
-        listener: beginTopLevelMethod(;, null, null)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelFunctionDeclaration, false)
-          listener: handleIdentifier(Foo, topLevelFunctionDeclaration)
-        parseMethodTypeVar(Foo)
-          listener: handleNoTypeVariables({)
-        parseGetterOrFormalParameters(Foo, Foo, false, MemberKind.TopLevelMethod)
-          missingParameterMessage(MemberKind.TopLevelMethod)
-          reportRecoverableError(Foo, MissingFunctionParameters)
-            listener: handleRecoverableError(MissingFunctionParameters, Foo, Foo)
-          rewriter()
-          parseFormalParametersRest((, MemberKind.TopLevelMethod)
-            listener: beginFormalParameters((, MemberKind.TopLevelMethod)
-            listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-        parseAsyncModifierOpt())
-          listener: handleAsyncModifier(null, null)
-          inPlainSync()
-        parseFunctionBody(), false, false)
-          listener: beginBlockFunctionBody({)
-          notEofOrValue(}, })
-          listener: endBlockFunctionBody(0, {, })
-        listener: endTopLevelMethod(Foo, null, })
   listener: endTopLevelDeclaration(extension)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
@@ -129,72 +86,32 @@
           listener: endPrimaryConstructor((, null, false)
           parseClassOrMixinOrEnumImplementsOpt())
             listener: handleImplements(null, 0)
-          ensureBlock(), null, extension type declaration)
-            reportRecoverableError(), Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
-              listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
-            insertBlock())
-              rewriter()
-              rewriter()
-          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, ET2)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(), [extends, with, implements, {])
+              parseClassExtendsOpt(), DeclarationHeaderKind.ExtensionType)
+                listener: handleNoType())
+                listener: handleClassExtends(null, 1)
+              parseClassWithClauseOpt())
+                parseTypeList(with)
+                  listener: beginTypeList(Foo)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments({)
+                  listener: handleType(Foo, null)
+                  listener: endTypeList(1)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Foo)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Foo, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Foo, DeclarationKind.ExtensionType, ET2)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
             notEofOrValue(}, })
             listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
           listener: endExtensionTypeDeclaration(extension, type, })
-  listener: endTopLevelDeclaration(with)
-  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
-    parseMetadataStar(})
-      listener: beginMetadataStar(with)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(})
-      listener: beginTopLevelMember(with)
-      isReservedKeyword(Foo)
-      parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', with, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-        reportRecoverableError(with, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, with, with)
-        listener: handleNoType(})
-        ensureIdentifierPotentiallyRecovered(}, topLevelVariableDeclaration, false)
-          reportRecoverableErrorWithToken(with, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-          listener: handleIdentifier(with, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(with, with, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Foo)
-        ensureSemicolon(with)
-          reportRecoverableError(with, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  listener: endTopLevelDeclaration(Foo)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Foo)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Foo)
-      isReservedKeyword({)
-      parseTopLevelMethod(;, null, null, ;, Instance of 'NoType', null, Foo, false)
-        listener: beginTopLevelMethod(;, null, null)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelFunctionDeclaration, false)
-          listener: handleIdentifier(Foo, topLevelFunctionDeclaration)
-        parseMethodTypeVar(Foo)
-          listener: handleNoTypeVariables({)
-        parseGetterOrFormalParameters(Foo, Foo, false, MemberKind.TopLevelMethod)
-          missingParameterMessage(MemberKind.TopLevelMethod)
-          reportRecoverableError(Foo, MissingFunctionParameters)
-            listener: handleRecoverableError(MissingFunctionParameters, Foo, Foo)
-          rewriter()
-          parseFormalParametersRest((, MemberKind.TopLevelMethod)
-            listener: beginFormalParameters((, MemberKind.TopLevelMethod)
-            listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-        parseAsyncModifierOpt())
-          listener: handleAsyncModifier(null, null)
-          inPlainSync()
-        parseFunctionBody(), false, false)
-          listener: beginBlockFunctionBody({)
-          notEofOrValue(}, })
-          listener: endBlockFunctionBody(0, {, })
-        listener: endTopLevelMethod(Foo, null, })
   listener: endTopLevelDeclaration(extension)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
@@ -226,84 +143,35 @@
           listener: endPrimaryConstructor((, null, false)
           parseClassOrMixinOrEnumImplementsOpt())
             listener: handleImplements(null, 0)
-          ensureBlock(), null, extension type declaration)
-            reportRecoverableError(), Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
-              listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
-            insertBlock())
-              rewriter()
-              rewriter()
-          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, ET3)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(), [extends, with, implements, {])
+              parseClassExtendsOpt(), DeclarationHeaderKind.ExtensionType)
+                listener: handleNoType())
+                listener: handleClassExtends(null, 1)
+              parseClassWithClauseOpt())
+                parseTypeList(with)
+                  listener: beginTypeList(Foo)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(,)
+                  listener: handleType(Foo, null)
+                  listener: handleIdentifier(Bar, typeReference)
+                  listener: handleNoTypeArguments({)
+                  listener: handleType(Bar, null)
+                  listener: endTypeList(2)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Bar)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Bar, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Bar, DeclarationKind.ExtensionType, ET3)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
             notEofOrValue(}, })
             listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
           listener: endExtensionTypeDeclaration(extension, type, })
-  listener: endTopLevelDeclaration(with)
-  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
-    parseMetadataStar(})
-      listener: beginMetadataStar(with)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(})
-      listener: beginTopLevelMember(with)
-      isReservedKeyword(Foo)
-      parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', with, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-        reportRecoverableError(with, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, with, with)
-        listener: handleNoType(})
-        ensureIdentifierPotentiallyRecovered(}, topLevelVariableDeclaration, false)
-          reportRecoverableErrorWithToken(with, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-          listener: handleIdentifier(with, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(with, with, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Foo)
-        ensureSemicolon(with)
-          reportRecoverableError(with, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  listener: endTopLevelDeclaration(Foo)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Foo)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Foo)
-      isReservedKeyword(,)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', Foo, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        reportRecoverableError(Foo, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, Foo, Foo)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelVariableDeclaration, false)
-          listener: handleIdentifier(Foo, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(Foo, Foo, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(,)
-        ensureIdentifier(,, topLevelVariableDeclaration)
-          listener: handleIdentifier(Bar, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(Bar, Bar, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer({)
-        ensureSemicolon(Bar)
-          reportRecoverableError(Bar, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Bar, Bar)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 2, Foo, ;)
-  listener: endTopLevelDeclaration({)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar({)
-      listener: endMetadataStar(0)
-    listener: beginTopLevelMember({)
-    parseInvalidTopLevelDeclaration(;)
-      reportRecoverableErrorWithToken({, Instance of 'Template<(Token) => Message>')
-        listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '{'., null, {lexeme: {}], {, {)
-      parseInvalidBlock(;)
-        parseBlock(;, BlockKind(invalid))
-          ensureBlock(;, null, null)
-          listener: beginBlock({, BlockKind(invalid))
-          notEofOrValue(}, })
-          listener: endBlock(0, {, }, BlockKind(invalid))
-        listener: handleInvalidTopLevelBlock({)
-      listener: handleInvalidTopLevelDeclaration(})
   listener: endTopLevelDeclaration(extension)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
@@ -335,119 +203,37 @@
           listener: endPrimaryConstructor((, null, false)
           parseClassOrMixinOrEnumImplementsOpt())
             listener: handleImplements(null, 0)
-          ensureBlock(), null, extension type declaration)
-            reportRecoverableError(), Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
-              listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
-            insertBlock())
-              rewriter()
-              rewriter()
-          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, ET4)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(), [extends, with, implements, {])
+              parseClassExtendsOpt(), DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, ), DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(with)
+                  listener: handleType(Foo, null)
+                  listener: handleClassExtends(extends, 1)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Foo)
+                parseTypeList(with)
+                  listener: beginTypeList(Bar)
+                  listener: handleIdentifier(Bar, typeReference)
+                  listener: handleNoTypeArguments({)
+                  listener: handleType(Bar, null)
+                  listener: endTypeList(1)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Bar)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Bar, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Bar, DeclarationKind.ExtensionType, ET4)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
             notEofOrValue(}, })
             listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
           listener: endExtensionTypeDeclaration(extension, type, })
-  listener: endTopLevelDeclaration(extends)
-  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
-    parseMetadataStar(})
-      listener: beginMetadataStar(extends)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(})
-      listener: beginTopLevelMember(extends)
-      isReservedKeyword(Foo)
-      parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', extends, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-        reportRecoverableError(extends, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, extends, extends)
-        listener: handleNoType(})
-        ensureIdentifierPotentiallyRecovered(}, topLevelVariableDeclaration, false)
-          reportRecoverableErrorWithToken(extends, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'extends' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: extends}], extends, extends)
-          listener: handleIdentifier(extends, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(extends, extends, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Foo)
-        ensureSemicolon(extends)
-          reportRecoverableError(extends, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], extends, extends)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, extends, ;)
-  listener: endTopLevelDeclaration(Foo)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Foo)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Foo)
-      isReservedKeyword(with)
-      indicatesMethodOrField(Bar)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', Foo, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        reportRecoverableError(Foo, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, Foo, Foo)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelVariableDeclaration, false)
-          listener: handleIdentifier(Foo, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(Foo, Foo, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(with)
-        ensureSemicolon(Foo)
-          reportRecoverableError(Foo, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Foo, Foo)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, Foo, ;)
-  listener: endTopLevelDeclaration(with)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(with)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(with)
-      isReservedKeyword(Bar)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', with, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        reportRecoverableError(with, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, with, with)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelVariableDeclaration, false)
-          reportRecoverableErrorWithToken(with, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-          listener: handleIdentifier(with, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(with, with, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Bar)
-        ensureSemicolon(with)
-          reportRecoverableError(with, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  listener: endTopLevelDeclaration(Bar)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Bar)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Bar)
-      isReservedKeyword({)
-      parseTopLevelMethod(;, null, null, ;, Instance of 'NoType', null, Bar, false)
-        listener: beginTopLevelMethod(;, null, null)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelFunctionDeclaration, false)
-          listener: handleIdentifier(Bar, topLevelFunctionDeclaration)
-        parseMethodTypeVar(Bar)
-          listener: handleNoTypeVariables({)
-        parseGetterOrFormalParameters(Bar, Bar, false, MemberKind.TopLevelMethod)
-          missingParameterMessage(MemberKind.TopLevelMethod)
-          reportRecoverableError(Bar, MissingFunctionParameters)
-            listener: handleRecoverableError(MissingFunctionParameters, Bar, Bar)
-          rewriter()
-          parseFormalParametersRest((, MemberKind.TopLevelMethod)
-            listener: beginFormalParameters((, MemberKind.TopLevelMethod)
-            listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-        parseAsyncModifierOpt())
-          listener: handleAsyncModifier(null, null)
-          inPlainSync()
-        parseFunctionBody(), false, false)
-          listener: beginBlockFunctionBody({)
-          notEofOrValue(}, })
-          listener: endBlockFunctionBody(0, {, })
-        listener: endTopLevelMethod(Bar, null, })
   listener: endTopLevelDeclaration(extension)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
@@ -479,131 +265,40 @@
           listener: endPrimaryConstructor((, null, false)
           parseClassOrMixinOrEnumImplementsOpt())
             listener: handleImplements(null, 0)
-          ensureBlock(), null, extension type declaration)
-            reportRecoverableError(), Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
-              listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
-            insertBlock())
-              rewriter()
-              rewriter()
-          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, ET5)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(), [extends, with, implements, {])
+              parseClassExtendsOpt(), DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, ), DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(with)
+                  listener: handleType(Foo, null)
+                  listener: handleClassExtends(extends, 1)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Foo)
+                parseTypeList(with)
+                  listener: beginTypeList(Bar)
+                  listener: handleIdentifier(Bar, typeReference)
+                  listener: handleNoTypeArguments(,)
+                  listener: handleType(Bar, null)
+                  listener: handleIdentifier(Baz, typeReference)
+                  listener: handleNoTypeArguments({)
+                  listener: handleType(Baz, null)
+                  listener: endTypeList(2)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Baz)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Baz, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Baz, DeclarationKind.ExtensionType, ET5)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
             notEofOrValue(}, })
             listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
           listener: endExtensionTypeDeclaration(extension, type, })
-  listener: endTopLevelDeclaration(extends)
-  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
-    parseMetadataStar(})
-      listener: beginMetadataStar(extends)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(})
-      listener: beginTopLevelMember(extends)
-      isReservedKeyword(Foo)
-      parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', extends, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-        reportRecoverableError(extends, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, extends, extends)
-        listener: handleNoType(})
-        ensureIdentifierPotentiallyRecovered(}, topLevelVariableDeclaration, false)
-          reportRecoverableErrorWithToken(extends, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'extends' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: extends}], extends, extends)
-          listener: handleIdentifier(extends, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(extends, extends, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Foo)
-        ensureSemicolon(extends)
-          reportRecoverableError(extends, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], extends, extends)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, extends, ;)
-  listener: endTopLevelDeclaration(Foo)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Foo)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Foo)
-      isReservedKeyword(with)
-      indicatesMethodOrField(Bar)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', Foo, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        reportRecoverableError(Foo, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, Foo, Foo)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelVariableDeclaration, false)
-          listener: handleIdentifier(Foo, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(Foo, Foo, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(with)
-        ensureSemicolon(Foo)
-          reportRecoverableError(Foo, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Foo, Foo)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, Foo, ;)
-  listener: endTopLevelDeclaration(with)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(with)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(with)
-      isReservedKeyword(Bar)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', with, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        reportRecoverableError(with, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, with, with)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelVariableDeclaration, false)
-          reportRecoverableErrorWithToken(with, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-          listener: handleIdentifier(with, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(with, with, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Bar)
-        ensureSemicolon(with)
-          reportRecoverableError(with, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  listener: endTopLevelDeclaration(Bar)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Bar)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Bar)
-      isReservedKeyword(,)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', Bar, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        reportRecoverableError(Bar, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, Bar, Bar)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelVariableDeclaration, false)
-          listener: handleIdentifier(Bar, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(Bar, Bar, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(,)
-        ensureIdentifier(,, topLevelVariableDeclaration)
-          listener: handleIdentifier(Baz, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(Baz, Baz, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer({)
-        ensureSemicolon(Baz)
-          reportRecoverableError(Baz, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Baz, Baz)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 2, Bar, ;)
-  listener: endTopLevelDeclaration({)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar({)
-      listener: endMetadataStar(0)
-    listener: beginTopLevelMember({)
-    parseInvalidTopLevelDeclaration(;)
-      reportRecoverableErrorWithToken({, Instance of 'Template<(Token) => Message>')
-        listener: handleRecoverableError(Message[ExpectedDeclaration, Expected a declaration, but got '{'., null, {lexeme: {}], {, {)
-      parseInvalidBlock(;)
-        parseBlock(;, BlockKind(invalid))
-          ensureBlock(;, null, null)
-          listener: beginBlock({, BlockKind(invalid))
-          notEofOrValue(}, })
-          listener: endBlock(0, {, }, BlockKind(invalid))
-        listener: handleInvalidTopLevelBlock({)
-      listener: handleInvalidTopLevelDeclaration(})
   listener: endTopLevelDeclaration(extension)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
@@ -635,93 +330,32 @@
           listener: endPrimaryConstructor((, null, false)
           parseClassOrMixinOrEnumImplementsOpt())
             listener: handleImplements(null, 0)
-          ensureBlock(), null, extension type declaration)
-            reportRecoverableError(), Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
-              listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
-            insertBlock())
-              rewriter()
-              rewriter()
-          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, ET6)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(), [extends, with, implements, {])
+              parseClassExtendsOpt(), DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, ), DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(implements)
+                  listener: handleType(Foo, null)
+                  listener: handleClassExtends(extends, 1)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Foo)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(Foo)
+                listener: handleIdentifier(Bar, typeReference)
+                listener: handleNoTypeArguments({)
+                listener: handleType(Bar, null)
+                listener: handleImplements(implements, 1)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Bar, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Bar, DeclarationKind.ExtensionType, ET6)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
             notEofOrValue(}, })
             listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
           listener: endExtensionTypeDeclaration(extension, type, })
-  listener: endTopLevelDeclaration(extends)
-  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
-    parseMetadataStar(})
-      listener: beginMetadataStar(extends)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(})
-      listener: beginTopLevelMember(extends)
-      isReservedKeyword(Foo)
-      parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', extends, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-        reportRecoverableError(extends, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, extends, extends)
-        listener: handleNoType(})
-        ensureIdentifierPotentiallyRecovered(}, topLevelVariableDeclaration, false)
-          reportRecoverableErrorWithToken(extends, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'extends' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: extends}], extends, extends)
-          listener: handleIdentifier(extends, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(extends, extends, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Foo)
-        ensureSemicolon(extends)
-          reportRecoverableError(extends, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], extends, extends)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, extends, ;)
-  listener: endTopLevelDeclaration(Foo)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Foo)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Foo)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'SimpleType', implements, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        listener: handleIdentifier(Foo, typeReference)
-        listener: handleNoTypeArguments(implements)
-        listener: handleType(Foo, null)
-        ensureIdentifierPotentiallyRecovered(Foo, topLevelVariableDeclaration, false)
-          listener: handleIdentifier(implements, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(implements, implements, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Bar)
-        ensureSemicolon(implements)
-          reportRecoverableError(implements, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], implements, implements)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, Foo, ;)
-  listener: endTopLevelDeclaration(Bar)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Bar)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Bar)
-      isReservedKeyword({)
-      parseTopLevelMethod(;, null, null, ;, Instance of 'NoType', null, Bar, false)
-        listener: beginTopLevelMethod(;, null, null)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelFunctionDeclaration, false)
-          listener: handleIdentifier(Bar, topLevelFunctionDeclaration)
-        parseMethodTypeVar(Bar)
-          listener: handleNoTypeVariables({)
-        parseGetterOrFormalParameters(Bar, Bar, false, MemberKind.TopLevelMethod)
-          missingParameterMessage(MemberKind.TopLevelMethod)
-          reportRecoverableError(Bar, MissingFunctionParameters)
-            listener: handleRecoverableError(MissingFunctionParameters, Bar, Bar)
-          rewriter()
-          parseFormalParametersRest((, MemberKind.TopLevelMethod)
-            listener: beginFormalParameters((, MemberKind.TopLevelMethod)
-            listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-        parseAsyncModifierOpt())
-          listener: handleAsyncModifier(null, null)
-          inPlainSync()
-        parseFunctionBody(), false, false)
-          listener: beginBlockFunctionBody({)
-          notEofOrValue(}, })
-          listener: endBlockFunctionBody(0, {, })
-        listener: endTopLevelMethod(Bar, null, })
   listener: endTopLevelDeclaration(extension)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
@@ -753,93 +387,35 @@
           listener: endPrimaryConstructor((, null, false)
           parseClassOrMixinOrEnumImplementsOpt())
             listener: handleImplements(null, 0)
-          ensureBlock(), null, extension type declaration)
-            reportRecoverableError(), Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
-              listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
-            insertBlock())
-              rewriter()
-              rewriter()
-          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, ET7)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(), [extends, with, implements, {])
+              parseClassExtendsOpt(), DeclarationHeaderKind.ExtensionType)
+                listener: handleNoType())
+                listener: handleClassExtends(null, 1)
+              parseClassWithClauseOpt())
+                parseTypeList(with)
+                  listener: beginTypeList(Foo)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(implements)
+                  listener: handleType(Foo, null)
+                  listener: endTypeList(1)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Foo)
+                listener: handleIdentifier(Bar, typeReference)
+                listener: handleNoTypeArguments({)
+                listener: handleType(Bar, null)
+                listener: handleImplements(implements, 1)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Bar, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Bar, DeclarationKind.ExtensionType, ET7)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
             notEofOrValue(}, })
             listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
           listener: endExtensionTypeDeclaration(extension, type, })
-  listener: endTopLevelDeclaration(with)
-  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
-    parseMetadataStar(})
-      listener: beginMetadataStar(with)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(})
-      listener: beginTopLevelMember(with)
-      isReservedKeyword(Foo)
-      parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', with, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-        reportRecoverableError(with, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, with, with)
-        listener: handleNoType(})
-        ensureIdentifierPotentiallyRecovered(}, topLevelVariableDeclaration, false)
-          reportRecoverableErrorWithToken(with, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-          listener: handleIdentifier(with, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(with, with, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Foo)
-        ensureSemicolon(with)
-          reportRecoverableError(with, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  listener: endTopLevelDeclaration(Foo)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Foo)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Foo)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'SimpleType', implements, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        listener: handleIdentifier(Foo, typeReference)
-        listener: handleNoTypeArguments(implements)
-        listener: handleType(Foo, null)
-        ensureIdentifierPotentiallyRecovered(Foo, topLevelVariableDeclaration, false)
-          listener: handleIdentifier(implements, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(implements, implements, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Bar)
-        ensureSemicolon(implements)
-          reportRecoverableError(implements, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], implements, implements)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, Foo, ;)
-  listener: endTopLevelDeclaration(Bar)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Bar)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Bar)
-      isReservedKeyword({)
-      parseTopLevelMethod(;, null, null, ;, Instance of 'NoType', null, Bar, false)
-        listener: beginTopLevelMethod(;, null, null)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelFunctionDeclaration, false)
-          listener: handleIdentifier(Bar, topLevelFunctionDeclaration)
-        parseMethodTypeVar(Bar)
-          listener: handleNoTypeVariables({)
-        parseGetterOrFormalParameters(Bar, Bar, false, MemberKind.TopLevelMethod)
-          missingParameterMessage(MemberKind.TopLevelMethod)
-          reportRecoverableError(Bar, MissingFunctionParameters)
-            listener: handleRecoverableError(MissingFunctionParameters, Bar, Bar)
-          rewriter()
-          parseFormalParametersRest((, MemberKind.TopLevelMethod)
-            listener: beginFormalParameters((, MemberKind.TopLevelMethod)
-            listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-        parseAsyncModifierOpt())
-          listener: handleAsyncModifier(null, null)
-          inPlainSync()
-        parseFunctionBody(), false, false)
-          listener: beginBlockFunctionBody({)
-          notEofOrValue(}, })
-          listener: endBlockFunctionBody(0, {, })
-        listener: endTopLevelMethod(Bar, null, })
   listener: endTopLevelDeclaration(extension)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
@@ -871,120 +447,38 @@
           listener: endPrimaryConstructor((, null, false)
           parseClassOrMixinOrEnumImplementsOpt())
             listener: handleImplements(null, 0)
-          ensureBlock(), null, extension type declaration)
-            reportRecoverableError(), Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
-              listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
-            insertBlock())
-              rewriter()
-              rewriter()
-          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, ET8)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(), [extends, with, implements, {])
+              parseClassExtendsOpt(), DeclarationHeaderKind.ExtensionType)
+                listener: handleNoType())
+                listener: handleClassExtends(null, 1)
+              parseClassWithClauseOpt())
+                parseTypeList(with)
+                  listener: beginTypeList(Foo)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(,)
+                  listener: handleType(Foo, null)
+                  listener: handleIdentifier(Bar, typeReference)
+                  listener: handleNoTypeArguments(implements)
+                  listener: handleType(Bar, null)
+                  listener: endTypeList(2)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Bar)
+                listener: handleIdentifier(Baz, typeReference)
+                listener: handleNoTypeArguments({)
+                listener: handleType(Baz, null)
+                listener: handleImplements(implements, 1)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Baz, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Baz, DeclarationKind.ExtensionType, ET8)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
             notEofOrValue(}, })
             listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
           listener: endExtensionTypeDeclaration(extension, type, })
-  listener: endTopLevelDeclaration(with)
-  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
-    parseMetadataStar(})
-      listener: beginMetadataStar(with)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(})
-      listener: beginTopLevelMember(with)
-      isReservedKeyword(Foo)
-      parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', with, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-        reportRecoverableError(with, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, with, with)
-        listener: handleNoType(})
-        ensureIdentifierPotentiallyRecovered(}, topLevelVariableDeclaration, false)
-          reportRecoverableErrorWithToken(with, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-          listener: handleIdentifier(with, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(with, with, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Foo)
-        ensureSemicolon(with)
-          reportRecoverableError(with, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  listener: endTopLevelDeclaration(Foo)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Foo)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Foo)
-      isReservedKeyword(,)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', Foo, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        reportRecoverableError(Foo, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, Foo, Foo)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelVariableDeclaration, false)
-          listener: handleIdentifier(Foo, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(Foo, Foo, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(,)
-        ensureIdentifier(,, topLevelVariableDeclaration)
-          listener: handleIdentifier(Bar, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(Bar, Bar, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(implements)
-        ensureSemicolon(Bar)
-          reportRecoverableError(Bar, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Bar, Bar)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 2, Foo, ;)
-  listener: endTopLevelDeclaration(implements)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(implements)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(implements)
-      isReservedKeyword(Baz)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', implements, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        reportRecoverableError(implements, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, implements, implements)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelVariableDeclaration, false)
-          listener: handleIdentifier(implements, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(implements, implements, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Baz)
-        ensureSemicolon(implements)
-          reportRecoverableError(implements, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], implements, implements)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, implements, ;)
-  listener: endTopLevelDeclaration(Baz)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Baz)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Baz)
-      isReservedKeyword({)
-      parseTopLevelMethod(;, null, null, ;, Instance of 'NoType', null, Baz, false)
-        listener: beginTopLevelMethod(;, null, null)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelFunctionDeclaration, false)
-          listener: handleIdentifier(Baz, topLevelFunctionDeclaration)
-        parseMethodTypeVar(Baz)
-          listener: handleNoTypeVariables({)
-        parseGetterOrFormalParameters(Baz, Baz, false, MemberKind.TopLevelMethod)
-          missingParameterMessage(MemberKind.TopLevelMethod)
-          reportRecoverableError(Baz, MissingFunctionParameters)
-            listener: handleRecoverableError(MissingFunctionParameters, Baz, Baz)
-          rewriter()
-          parseFormalParametersRest((, MemberKind.TopLevelMethod)
-            listener: beginFormalParameters((, MemberKind.TopLevelMethod)
-            listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-        parseAsyncModifierOpt())
-          listener: handleAsyncModifier(null, null)
-          inPlainSync()
-        parseFunctionBody(), false, false)
-          listener: beginBlockFunctionBody({)
-          notEofOrValue(}, })
-          listener: endBlockFunctionBody(0, {, })
-        listener: endTopLevelMethod(Baz, null, })
   listener: endTopLevelDeclaration(extension)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
@@ -1016,140 +510,40 @@
           listener: endPrimaryConstructor((, null, false)
           parseClassOrMixinOrEnumImplementsOpt())
             listener: handleImplements(null, 0)
-          ensureBlock(), null, extension type declaration)
-            reportRecoverableError(), Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
-              listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
-            insertBlock())
-              rewriter()
-              rewriter()
-          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, ET9)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(), [extends, with, implements, {])
+              parseClassExtendsOpt(), DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, ), DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(with)
+                  listener: handleType(Foo, null)
+                  listener: handleClassExtends(extends, 1)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Foo)
+                parseTypeList(with)
+                  listener: beginTypeList(Bar)
+                  listener: handleIdentifier(Bar, typeReference)
+                  listener: handleNoTypeArguments(implements)
+                  listener: handleType(Bar, null)
+                  listener: endTypeList(1)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Bar)
+                listener: handleIdentifier(Baz, typeReference)
+                listener: handleNoTypeArguments({)
+                listener: handleType(Baz, null)
+                listener: handleImplements(implements, 1)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Baz, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Baz, DeclarationKind.ExtensionType, ET9)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
             notEofOrValue(}, })
             listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
           listener: endExtensionTypeDeclaration(extension, type, })
-  listener: endTopLevelDeclaration(extends)
-  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
-    parseMetadataStar(})
-      listener: beginMetadataStar(extends)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(})
-      listener: beginTopLevelMember(extends)
-      isReservedKeyword(Foo)
-      parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', extends, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-        reportRecoverableError(extends, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, extends, extends)
-        listener: handleNoType(})
-        ensureIdentifierPotentiallyRecovered(}, topLevelVariableDeclaration, false)
-          reportRecoverableErrorWithToken(extends, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'extends' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: extends}], extends, extends)
-          listener: handleIdentifier(extends, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(extends, extends, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Foo)
-        ensureSemicolon(extends)
-          reportRecoverableError(extends, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], extends, extends)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, extends, ;)
-  listener: endTopLevelDeclaration(Foo)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Foo)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Foo)
-      isReservedKeyword(with)
-      indicatesMethodOrField(Bar)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', Foo, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        reportRecoverableError(Foo, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, Foo, Foo)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelVariableDeclaration, false)
-          listener: handleIdentifier(Foo, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(Foo, Foo, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(with)
-        ensureSemicolon(Foo)
-          reportRecoverableError(Foo, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Foo, Foo)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, Foo, ;)
-  listener: endTopLevelDeclaration(with)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(with)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(with)
-      isReservedKeyword(Bar)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', with, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        reportRecoverableError(with, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, with, with)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelVariableDeclaration, false)
-          reportRecoverableErrorWithToken(with, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-          listener: handleIdentifier(with, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(with, with, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Bar)
-        ensureSemicolon(with)
-          reportRecoverableError(with, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  listener: endTopLevelDeclaration(Bar)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Bar)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Bar)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'SimpleType', implements, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        listener: handleIdentifier(Bar, typeReference)
-        listener: handleNoTypeArguments(implements)
-        listener: handleType(Bar, null)
-        ensureIdentifierPotentiallyRecovered(Bar, topLevelVariableDeclaration, false)
-          listener: handleIdentifier(implements, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(implements, implements, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Baz)
-        ensureSemicolon(implements)
-          reportRecoverableError(implements, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], implements, implements)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, Bar, ;)
-  listener: endTopLevelDeclaration(Baz)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Baz)
-      listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Baz)
-      isReservedKeyword({)
-      parseTopLevelMethod(;, null, null, ;, Instance of 'NoType', null, Baz, false)
-        listener: beginTopLevelMethod(;, null, null)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelFunctionDeclaration, false)
-          listener: handleIdentifier(Baz, topLevelFunctionDeclaration)
-        parseMethodTypeVar(Baz)
-          listener: handleNoTypeVariables({)
-        parseGetterOrFormalParameters(Baz, Baz, false, MemberKind.TopLevelMethod)
-          missingParameterMessage(MemberKind.TopLevelMethod)
-          reportRecoverableError(Baz, MissingFunctionParameters)
-            listener: handleRecoverableError(MissingFunctionParameters, Baz, Baz)
-          rewriter()
-          parseFormalParametersRest((, MemberKind.TopLevelMethod)
-            listener: beginFormalParameters((, MemberKind.TopLevelMethod)
-            listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-        parseAsyncModifierOpt())
-          listener: handleAsyncModifier(null, null)
-          inPlainSync()
-        parseFunctionBody(), false, false)
-          listener: beginBlockFunctionBody({)
-          notEofOrValue(}, })
-          listener: endBlockFunctionBody(0, {, })
-        listener: endTopLevelMethod(Baz, null, })
   listener: endTopLevelDeclaration(extension)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
@@ -1181,167 +575,876 @@
           listener: endPrimaryConstructor((, null, false)
           parseClassOrMixinOrEnumImplementsOpt())
             listener: handleImplements(null, 0)
-          ensureBlock(), null, extension type declaration)
-            reportRecoverableError(), Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
-              listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
-            insertBlock())
-              rewriter()
-              rewriter()
-          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, ET10)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(), [extends, with, implements, {])
+              parseClassExtendsOpt(), DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, ), DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(with)
+                  listener: handleType(Foo, null)
+                  listener: handleClassExtends(extends, 1)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Foo)
+                parseTypeList(with)
+                  listener: beginTypeList(Bar)
+                  listener: handleIdentifier(Bar, typeReference)
+                  listener: handleNoTypeArguments(,)
+                  listener: handleType(Bar, null)
+                  listener: handleIdentifier(Baz, typeReference)
+                  listener: handleNoTypeArguments(implements)
+                  listener: handleType(Baz, null)
+                  listener: endTypeList(2)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Baz)
+                listener: handleIdentifier(Boz, typeReference)
+                listener: handleNoTypeArguments({)
+                listener: handleType(Boz, null)
+                listener: handleImplements(implements, 1)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Boz, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Boz, DeclarationKind.ExtensionType, ET10)
             listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
             notEofOrValue(}, })
             listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
           listener: endExtensionTypeDeclaration(extension, type, })
-  listener: endTopLevelDeclaration(extends)
+  listener: endTopLevelDeclaration(extension)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
-      listener: beginMetadataStar(extends)
+      listener: beginMetadataStar(extension)
       listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(})
-      listener: beginTopLevelMember(extends)
-      isReservedKeyword(Foo)
-      parseFields(}, null, null, null, null, null, null, null, }, Instance of 'NoType', extends, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, })
-        reportRecoverableError(extends, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, extends, extends)
-        listener: handleNoType(})
-        ensureIdentifierPotentiallyRecovered(}, topLevelVariableDeclaration, false)
-          reportRecoverableErrorWithToken(extends, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'extends' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: extends}], extends, extends)
-          listener: handleIdentifier(extends, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(extends, extends, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Foo)
-        ensureSemicolon(extends)
-          reportRecoverableError(extends, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], extends, extends)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, extends, ;)
-  listener: endTopLevelDeclaration(Foo)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Foo)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET11)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET11, MemberKind.PrimaryConstructor)
+            parseFormalParametersRest((, MemberKind.PrimaryConstructor)
+              listener: beginFormalParameters((, MemberKind.PrimaryConstructor)
+              parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(()
+                  listener: beginMetadataStar(int)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleIdentifier(int, typeReference)
+                listener: handleNoTypeArguments(i)
+                listener: handleType(int, null)
+                ensureIdentifier(int, formalParameterDeclaration)
+                  listener: handleIdentifier(i, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments(extends)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 1)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
+              parseClassExtendsOpt(Bar, DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, Bar, DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments({)
+                  listener: handleType(Foo, null)
+                  listener: handleClassExtends(extends, 1)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Foo)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(Foo)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Foo, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Foo, DeclarationKind.ExtensionType, ET11)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(extension)
       listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Foo)
-      isReservedKeyword(with)
-      indicatesMethodOrField(Bar)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', Foo, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        reportRecoverableError(Foo, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, Foo, Foo)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelVariableDeclaration, false)
-          listener: handleIdentifier(Foo, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(Foo, Foo, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(with)
-        ensureSemicolon(Foo)
-          reportRecoverableError(Foo, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Foo, Foo)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, Foo, ;)
-  listener: endTopLevelDeclaration(with)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(with)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET12)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET12, MemberKind.PrimaryConstructor)
+            parseFormalParametersRest((, MemberKind.PrimaryConstructor)
+              listener: beginFormalParameters((, MemberKind.PrimaryConstructor)
+              parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(()
+                  listener: beginMetadataStar(int)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleIdentifier(int, typeReference)
+                listener: handleNoTypeArguments(i)
+                listener: handleType(int, null)
+                ensureIdentifier(int, formalParameterDeclaration)
+                  listener: handleIdentifier(i, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments(with)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 1)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
+              parseClassExtendsOpt(Bar, DeclarationHeaderKind.ExtensionType)
+                listener: handleNoType(Bar)
+                listener: handleClassExtends(null, 1)
+              parseClassWithClauseOpt(Bar)
+                parseTypeList(with)
+                  listener: beginTypeList(Foo)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments({)
+                  listener: handleType(Foo, null)
+                  listener: endTypeList(1)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Foo)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Foo, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Foo, DeclarationKind.ExtensionType, ET12)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(extension)
       listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(with)
-      isReservedKeyword(Bar)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', with, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        reportRecoverableError(with, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, with, with)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelVariableDeclaration, false)
-          reportRecoverableErrorWithToken(with, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[ExpectedIdentifierButGotKeyword, 'with' can't be used as an identifier because it's a keyword., Try renaming this to be an identifier that isn't a keyword., {lexeme: with}], with, with)
-          listener: handleIdentifier(with, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(with, with, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Bar)
-        ensureSemicolon(with)
-          reportRecoverableError(with, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], with, with)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, with, ;)
-  listener: endTopLevelDeclaration(Bar)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Bar)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET13)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET13, MemberKind.PrimaryConstructor)
+            parseFormalParametersRest((, MemberKind.PrimaryConstructor)
+              listener: beginFormalParameters((, MemberKind.PrimaryConstructor)
+              parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(()
+                  listener: beginMetadataStar(int)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleIdentifier(int, typeReference)
+                listener: handleNoTypeArguments(i)
+                listener: handleType(int, null)
+                ensureIdentifier(int, formalParameterDeclaration)
+                  listener: handleIdentifier(i, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments(with)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 1)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
+              parseClassExtendsOpt(Bar, DeclarationHeaderKind.ExtensionType)
+                listener: handleNoType(Bar)
+                listener: handleClassExtends(null, 1)
+              parseClassWithClauseOpt(Bar)
+                parseTypeList(with)
+                  listener: beginTypeList(Foo)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(,)
+                  listener: handleType(Foo, null)
+                  listener: handleIdentifier(Bar, typeReference)
+                  listener: handleNoTypeArguments({)
+                  listener: handleType(Bar, null)
+                  listener: endTypeList(2)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Bar)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Bar, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Bar, DeclarationKind.ExtensionType, ET13)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(extension)
       listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Bar)
-      isReservedKeyword(,)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', Bar, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        reportRecoverableError(Bar, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, Bar, Bar)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelVariableDeclaration, false)
-          listener: handleIdentifier(Bar, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(Bar, Bar, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(,)
-        ensureIdentifier(,, topLevelVariableDeclaration)
-          listener: handleIdentifier(Baz, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(Baz, Baz, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(implements)
-        ensureSemicolon(Baz)
-          reportRecoverableError(Baz, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Baz, Baz)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 2, Bar, ;)
-  listener: endTopLevelDeclaration(implements)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(implements)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET14)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET14, MemberKind.PrimaryConstructor)
+            parseFormalParametersRest((, MemberKind.PrimaryConstructor)
+              listener: beginFormalParameters((, MemberKind.PrimaryConstructor)
+              parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(()
+                  listener: beginMetadataStar(int)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleIdentifier(int, typeReference)
+                listener: handleNoTypeArguments(i)
+                listener: handleType(int, null)
+                ensureIdentifier(int, formalParameterDeclaration)
+                  listener: handleIdentifier(i, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments(extends)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 1)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
+              parseClassExtendsOpt(Bar, DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, Bar, DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(with)
+                  listener: handleType(Foo, null)
+                  listener: handleClassExtends(extends, 1)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Foo)
+                parseTypeList(with)
+                  listener: beginTypeList(Bar)
+                  listener: handleIdentifier(Bar, typeReference)
+                  listener: handleNoTypeArguments({)
+                  listener: handleType(Bar, null)
+                  listener: endTypeList(1)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Bar)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Bar, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Bar, DeclarationKind.ExtensionType, ET14)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(extension)
       listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(implements)
-      isReservedKeyword(Boz)
-      parseFields(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', implements, DeclarationKind.TopLevel, null, false)
-        listener: beginFields(DeclarationKind.TopLevel, null, null, null, null, null, null, null, ;)
-        reportRecoverableError(implements, MissingConstFinalVarOrType)
-          listener: handleRecoverableError(MissingConstFinalVarOrType, implements, implements)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelVariableDeclaration, false)
-          listener: handleIdentifier(implements, topLevelVariableDeclaration)
-        parseFieldInitializerOpt(implements, implements, null, null, null, null, null, DeclarationKind.TopLevel, null)
-          listener: handleNoFieldInitializer(Boz)
-        ensureSemicolon(implements)
-          reportRecoverableError(implements, Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}])
-            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], implements, implements)
-          rewriter()
-        listener: endTopLevelFields(null, null, null, null, null, 1, implements, ;)
-  listener: endTopLevelDeclaration(Boz)
-  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
-    parseMetadataStar(;)
-      listener: beginMetadataStar(Boz)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET15)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET15, MemberKind.PrimaryConstructor)
+            parseFormalParametersRest((, MemberKind.PrimaryConstructor)
+              listener: beginFormalParameters((, MemberKind.PrimaryConstructor)
+              parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(()
+                  listener: beginMetadataStar(int)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleIdentifier(int, typeReference)
+                listener: handleNoTypeArguments(i)
+                listener: handleType(int, null)
+                ensureIdentifier(int, formalParameterDeclaration)
+                  listener: handleIdentifier(i, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments(extends)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 1)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
+              parseClassExtendsOpt(Bar, DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, Bar, DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(with)
+                  listener: handleType(Foo, null)
+                  listener: handleClassExtends(extends, 1)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Foo)
+                parseTypeList(with)
+                  listener: beginTypeList(Bar)
+                  listener: handleIdentifier(Bar, typeReference)
+                  listener: handleNoTypeArguments(,)
+                  listener: handleType(Bar, null)
+                  listener: handleIdentifier(Baz, typeReference)
+                  listener: handleNoTypeArguments({)
+                  listener: handleType(Baz, null)
+                  listener: endTypeList(2)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Baz)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Baz, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Baz, DeclarationKind.ExtensionType, ET15)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(extension)
       listener: endMetadataStar(0)
-    parseTopLevelMemberImpl(;)
-      listener: beginTopLevelMember(Boz)
-      isReservedKeyword({)
-      parseTopLevelMethod(;, null, null, ;, Instance of 'NoType', null, Boz, false)
-        listener: beginTopLevelMethod(;, null, null)
-        listener: handleNoType(;)
-        ensureIdentifierPotentiallyRecovered(;, topLevelFunctionDeclaration, false)
-          listener: handleIdentifier(Boz, topLevelFunctionDeclaration)
-        parseMethodTypeVar(Boz)
-          listener: handleNoTypeVariables({)
-        parseGetterOrFormalParameters(Boz, Boz, false, MemberKind.TopLevelMethod)
-          missingParameterMessage(MemberKind.TopLevelMethod)
-          reportRecoverableError(Boz, MissingFunctionParameters)
-            listener: handleRecoverableError(MissingFunctionParameters, Boz, Boz)
-          rewriter()
-          parseFormalParametersRest((, MemberKind.TopLevelMethod)
-            listener: beginFormalParameters((, MemberKind.TopLevelMethod)
-            listener: endFormalParameters(0, (, ), MemberKind.TopLevelMethod)
-        parseAsyncModifierOpt())
-          listener: handleAsyncModifier(null, null)
-          inPlainSync()
-        parseFunctionBody(), false, false)
-          listener: beginBlockFunctionBody({)
-          notEofOrValue(}, })
-          listener: endBlockFunctionBody(0, {, })
-        listener: endTopLevelMethod(Boz, null, })
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET16)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET16, MemberKind.PrimaryConstructor)
+            parseFormalParametersRest((, MemberKind.PrimaryConstructor)
+              listener: beginFormalParameters((, MemberKind.PrimaryConstructor)
+              parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(()
+                  listener: beginMetadataStar(int)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleIdentifier(int, typeReference)
+                listener: handleNoTypeArguments(i)
+                listener: handleType(int, null)
+                ensureIdentifier(int, formalParameterDeclaration)
+                  listener: handleIdentifier(i, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments(extends)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 1)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
+              parseClassExtendsOpt(Bar, DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, Bar, DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(implements)
+                  listener: handleType(Foo, null)
+                  listener: handleClassExtends(extends, 1)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Foo)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(Foo)
+                listener: handleIdentifier(Bar, typeReference)
+                listener: handleNoTypeArguments({)
+                listener: handleType(Bar, null)
+                listener: handleImplements(implements, 1)
+              reportRecoverableError(implements, MultipleImplements)
+                listener: handleRecoverableError(MultipleImplements, implements, implements)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Bar, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Bar, DeclarationKind.ExtensionType, ET16)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET17)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET17, MemberKind.PrimaryConstructor)
+            parseFormalParametersRest((, MemberKind.PrimaryConstructor)
+              listener: beginFormalParameters((, MemberKind.PrimaryConstructor)
+              parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(()
+                  listener: beginMetadataStar(int)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleIdentifier(int, typeReference)
+                listener: handleNoTypeArguments(i)
+                listener: handleType(int, null)
+                ensureIdentifier(int, formalParameterDeclaration)
+                  listener: handleIdentifier(i, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments(with)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 1)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
+              parseClassExtendsOpt(Bar, DeclarationHeaderKind.ExtensionType)
+                listener: handleNoType(Bar)
+                listener: handleClassExtends(null, 1)
+              parseClassWithClauseOpt(Bar)
+                parseTypeList(with)
+                  listener: beginTypeList(Foo)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(implements)
+                  listener: handleType(Foo, null)
+                  listener: endTypeList(1)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Foo)
+                listener: handleIdentifier(Bar, typeReference)
+                listener: handleNoTypeArguments({)
+                listener: handleType(Bar, null)
+                listener: handleImplements(implements, 1)
+              reportRecoverableError(implements, MultipleImplements)
+                listener: handleRecoverableError(MultipleImplements, implements, implements)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Bar, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Bar, DeclarationKind.ExtensionType, ET17)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET18)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET18, MemberKind.PrimaryConstructor)
+            parseFormalParametersRest((, MemberKind.PrimaryConstructor)
+              listener: beginFormalParameters((, MemberKind.PrimaryConstructor)
+              parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(()
+                  listener: beginMetadataStar(int)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleIdentifier(int, typeReference)
+                listener: handleNoTypeArguments(i)
+                listener: handleType(int, null)
+                ensureIdentifier(int, formalParameterDeclaration)
+                  listener: handleIdentifier(i, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments(with)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 1)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
+              parseClassExtendsOpt(Bar, DeclarationHeaderKind.ExtensionType)
+                listener: handleNoType(Bar)
+                listener: handleClassExtends(null, 1)
+              parseClassWithClauseOpt(Bar)
+                parseTypeList(with)
+                  listener: beginTypeList(Foo)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(,)
+                  listener: handleType(Foo, null)
+                  listener: handleIdentifier(Bar, typeReference)
+                  listener: handleNoTypeArguments(implements)
+                  listener: handleType(Bar, null)
+                  listener: endTypeList(2)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Bar)
+                listener: handleIdentifier(Baz, typeReference)
+                listener: handleNoTypeArguments({)
+                listener: handleType(Baz, null)
+                listener: handleImplements(implements, 1)
+              reportRecoverableError(implements, MultipleImplements)
+                listener: handleRecoverableError(MultipleImplements, implements, implements)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Baz, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Baz, DeclarationKind.ExtensionType, ET18)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET19)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET19, MemberKind.PrimaryConstructor)
+            parseFormalParametersRest((, MemberKind.PrimaryConstructor)
+              listener: beginFormalParameters((, MemberKind.PrimaryConstructor)
+              parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(()
+                  listener: beginMetadataStar(int)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleIdentifier(int, typeReference)
+                listener: handleNoTypeArguments(i)
+                listener: handleType(int, null)
+                ensureIdentifier(int, formalParameterDeclaration)
+                  listener: handleIdentifier(i, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments(extends)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 1)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
+              parseClassExtendsOpt(Bar, DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, Bar, DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(with)
+                  listener: handleType(Foo, null)
+                  listener: handleClassExtends(extends, 1)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Foo)
+                parseTypeList(with)
+                  listener: beginTypeList(Bar)
+                  listener: handleIdentifier(Bar, typeReference)
+                  listener: handleNoTypeArguments(implements)
+                  listener: handleType(Bar, null)
+                  listener: endTypeList(1)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Bar)
+                listener: handleIdentifier(Baz, typeReference)
+                listener: handleNoTypeArguments({)
+                listener: handleType(Baz, null)
+                listener: handleImplements(implements, 1)
+              reportRecoverableError(implements, MultipleImplements)
+                listener: handleRecoverableError(MultipleImplements, implements, implements)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Baz, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Baz, DeclarationKind.ExtensionType, ET19)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET20)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET20, MemberKind.PrimaryConstructor)
+            parseFormalParametersRest((, MemberKind.PrimaryConstructor)
+              listener: beginFormalParameters((, MemberKind.PrimaryConstructor)
+              parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(()
+                  listener: beginMetadataStar(int)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleIdentifier(int, typeReference)
+                listener: handleNoTypeArguments(i)
+                listener: handleType(int, null)
+                ensureIdentifier(int, formalParameterDeclaration)
+                  listener: handleIdentifier(i, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments(extends)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 1)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
+              parseClassExtendsOpt(Bar, DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, Bar, DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Foo, typeReference)
+                  listener: handleNoTypeArguments(with)
+                  listener: handleType(Foo, null)
+                  listener: handleClassExtends(extends, 1)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Foo)
+                parseTypeList(with)
+                  listener: beginTypeList(Bar)
+                  listener: handleIdentifier(Bar, typeReference)
+                  listener: handleNoTypeArguments(,)
+                  listener: handleType(Bar, null)
+                  listener: handleIdentifier(Baz, typeReference)
+                  listener: handleNoTypeArguments(implements)
+                  listener: handleType(Baz, null)
+                  listener: endTypeList(2)
+                listener: handleClassWithClause(with)
+              reportRecoverableError(with, ExtensionTypeWith)
+                listener: handleRecoverableError(ExtensionTypeWith, with, with)
+              parseClassOrMixinOrEnumImplementsOpt(Baz)
+                listener: handleIdentifier(Boz, typeReference)
+                listener: handleNoTypeArguments({)
+                listener: handleType(Boz, null)
+                listener: handleImplements(implements, 1)
+              reportRecoverableError(implements, MultipleImplements)
+                listener: handleRecoverableError(MultipleImplements, implements, implements)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Boz, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Boz, DeclarationKind.ExtensionType, ET20)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET21)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET21, MemberKind.PrimaryConstructor)
+            parseFormalParametersRest((, MemberKind.PrimaryConstructor)
+              listener: beginFormalParameters((, MemberKind.PrimaryConstructor)
+              parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(()
+                  listener: beginMetadataStar(int)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleIdentifier(int, typeReference)
+                listener: handleNoTypeArguments(i)
+                listener: handleType(int, null)
+                ensureIdentifier(int, formalParameterDeclaration)
+                  listener: handleIdentifier(i, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments(implements)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 1)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
+              parseClassExtendsOpt(Bar, DeclarationHeaderKind.ExtensionType)
+                listener: handleNoType(Bar)
+                listener: handleClassExtends(null, 1)
+              parseClassWithClauseOpt(Bar)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(Bar)
+                listener: handleIdentifier(Boz, typeReference)
+                listener: handleNoTypeArguments({)
+                listener: handleType(Boz, null)
+                listener: handleImplements(implements, 1)
+              reportRecoverableError(implements, MultipleImplements)
+                listener: handleRecoverableError(MultipleImplements, implements, implements)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Boz, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Boz, DeclarationKind.ExtensionType, ET21)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET22)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET22, MemberKind.PrimaryConstructor)
+            parseFormalParametersRest((, MemberKind.PrimaryConstructor)
+              listener: beginFormalParameters((, MemberKind.PrimaryConstructor)
+              parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(()
+                  listener: beginMetadataStar(int)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleIdentifier(int, typeReference)
+                listener: handleNoTypeArguments(i)
+                listener: handleType(int, null)
+                ensureIdentifier(int, formalParameterDeclaration)
+                  listener: handleIdentifier(i, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleImplements(null, 0)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(), [extends, with, implements, {])
+              parseClassExtendsOpt(), DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, ), DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Bar, typeReference)
+                  listener: handleNoTypeArguments(extends)
+                  listener: handleType(Bar, null)
+                  listener: handleClassExtends(extends, 1)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Bar)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(Bar)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+              skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
+              parseClassExtendsOpt(Bar, DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, Bar, DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Boz, typeReference)
+                  listener: handleNoTypeArguments({)
+                  listener: handleType(Boz, null)
+                  listener: handleClassExtends(extends, 1)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Boz)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(Boz)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Boz, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Boz, DeclarationKind.ExtensionType, ET22)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET23)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET23, MemberKind.PrimaryConstructor)
+            parseFormalParametersRest((, MemberKind.PrimaryConstructor)
+              listener: beginFormalParameters((, MemberKind.PrimaryConstructor)
+              parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(()
+                  listener: beginMetadataStar(int)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleIdentifier(int, typeReference)
+                listener: handleNoTypeArguments(i)
+                listener: handleType(int, null)
+                ensureIdentifier(int, formalParameterDeclaration)
+                  listener: handleIdentifier(i, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleImplements(null, 0)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(), [extends, with, implements, {])
+              parseClassExtendsOpt(), DeclarationHeaderKind.ExtensionType)
+                parseClassExtendsSeenExtendsClause(extends, ), DeclarationHeaderKind.ExtensionType)
+                  listener: handleIdentifier(Bar, typeReference)
+                  listener: handleNoTypeArguments(,)
+                  listener: handleType(Bar, null)
+                  listener: handleIdentifier(Boz, typeReference)
+                  listener: handleNoTypeArguments({)
+                  listener: handleType(Boz, null)
+                  listener: handleClassExtends(extends, 2)
+              reportRecoverableError(extends, ExtensionTypeExtends)
+                listener: handleRecoverableError(ExtensionTypeExtends, extends, extends)
+              parseClassWithClauseOpt(Boz)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(Boz)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
+          ensureBlock(Boz, null, extension type declaration)
+          parseClassOrMixinOrExtensionBody(Boz, DeclarationKind.ExtensionType, ET23)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
   listener: endTopLevelDeclaration()
   reportAllErrorTokens(extension)
-  listener: endCompilationUnit(47, )
+  listener: endCompilationUnit(23, )
diff --git a/pkg/front_end/parser_testcases/inline_class/extends_with.dart.parser.expect b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.parser.expect
index cc8b256..15990ab 100644
--- a/pkg/front_end/parser_testcases/inline_class/extends_with.dart.parser.expect
+++ b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.parser.expect
@@ -1,25 +1,49 @@
-NOTICE: Stream was rewritten by parser!
-
-extension type ET1(int i) {}extends ;Foo (){}
-extension type ET2(int i) {}with ;Foo (){}
-extension type ET3(int i) {}with ;Foo, Bar ;{}
-extension type ET4(int i) {}extends ;Foo ;with ;Bar (){}
-extension type ET5(int i) {}extends ;Foo ;with ;Bar, Baz ;{}
-extension type ET6(int i) {}extends ;Foo implements ;Bar (){}
-extension type ET7(int i) {}with ;Foo implements ;Bar (){}
-extension type ET8(int i) {}with ;Foo, Bar ;implements ;Baz (){}
-extension type ET9(int i) {}extends ;Foo ;with ;Bar implements ;Baz (){}
-extension type ET10(int i) {}extends ;Foo ;with ;Bar, Baz ;implements ;Boz (){}
+extension type ET1(int i) extends Foo {}
+extension type ET2(int i) with Foo {}
+extension type ET3(int i) with Foo, Bar {}
+extension type ET4(int i) extends Foo with Bar {}
+extension type ET5(int i) extends Foo with Bar, Baz {}
+extension type ET6(int i) extends Foo implements Bar {}
+extension type ET7(int i) with Foo implements Bar {}
+extension type ET8(int i) with Foo, Bar implements Baz {}
+extension type ET9(int i) extends Foo with Bar implements Baz {}
+extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
+extension type ET11(int i) implements Bar extends Foo {}
+extension type ET12(int i) implements Bar with Foo {}
+extension type ET13(int i) implements Bar with Foo, Bar {}
+extension type ET14(int i) implements Bar extends Foo with Bar {}
+extension type ET15(int i) implements Bar extends Foo with Bar, Baz {}
+extension type ET16(int i) implements Bar extends Foo implements Bar {}
+extension type ET17(int i) implements Bar with Foo implements Bar {}
+extension type ET18(int i) implements Bar with Foo, Bar implements Baz {}
+extension type ET19(int i) implements Bar extends Foo with Bar implements Baz {}
+extension type ET20(int i) implements Bar extends Foo with Bar, Baz implements Boz {}
+extension type ET21(int i) implements Bar implements Boz {}
+extension type ET22(int i) extends Bar extends Boz {}
+extension type ET23(int i) extends Bar, Boz {}
 
 
-extension[KeywordToken] type[StringToken] ET1[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[SyntheticBeginToken]}[SyntheticToken]extends[KeywordToken] ;[SyntheticToken]Foo[StringToken] ([SyntheticBeginToken])[SyntheticToken]{[BeginToken]}[SimpleToken]
-extension[KeywordToken] type[StringToken] ET2[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[SyntheticBeginToken]}[SyntheticToken]with[KeywordToken] ;[SyntheticToken]Foo[StringToken] ([SyntheticBeginToken])[SyntheticToken]{[BeginToken]}[SimpleToken]
-extension[KeywordToken] type[StringToken] ET3[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[SyntheticBeginToken]}[SyntheticToken]with[KeywordToken] ;[SyntheticToken]Foo[StringToken],[SimpleToken] Bar[StringToken] ;[SyntheticToken]{[BeginToken]}[SimpleToken]
-extension[KeywordToken] type[StringToken] ET4[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[SyntheticBeginToken]}[SyntheticToken]extends[KeywordToken] ;[SyntheticToken]Foo[StringToken] ;[SyntheticToken]with[KeywordToken] ;[SyntheticToken]Bar[StringToken] ([SyntheticBeginToken])[SyntheticToken]{[BeginToken]}[SimpleToken]
-extension[KeywordToken] type[StringToken] ET5[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[SyntheticBeginToken]}[SyntheticToken]extends[KeywordToken] ;[SyntheticToken]Foo[StringToken] ;[SyntheticToken]with[KeywordToken] ;[SyntheticToken]Bar[StringToken],[SimpleToken] Baz[StringToken] ;[SyntheticToken]{[BeginToken]}[SimpleToken]
-extension[KeywordToken] type[StringToken] ET6[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[SyntheticBeginToken]}[SyntheticToken]extends[KeywordToken] ;[SyntheticToken]Foo[StringToken] implements[KeywordToken] ;[SyntheticToken]Bar[StringToken] ([SyntheticBeginToken])[SyntheticToken]{[BeginToken]}[SimpleToken]
-extension[KeywordToken] type[StringToken] ET7[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[SyntheticBeginToken]}[SyntheticToken]with[KeywordToken] ;[SyntheticToken]Foo[StringToken] implements[KeywordToken] ;[SyntheticToken]Bar[StringToken] ([SyntheticBeginToken])[SyntheticToken]{[BeginToken]}[SimpleToken]
-extension[KeywordToken] type[StringToken] ET8[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[SyntheticBeginToken]}[SyntheticToken]with[KeywordToken] ;[SyntheticToken]Foo[StringToken],[SimpleToken] Bar[StringToken] ;[SyntheticToken]implements[KeywordToken] ;[SyntheticToken]Baz[StringToken] ([SyntheticBeginToken])[SyntheticToken]{[BeginToken]}[SimpleToken]
-extension[KeywordToken] type[StringToken] ET9[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[SyntheticBeginToken]}[SyntheticToken]extends[KeywordToken] ;[SyntheticToken]Foo[StringToken] ;[SyntheticToken]with[KeywordToken] ;[SyntheticToken]Bar[StringToken] implements[KeywordToken] ;[SyntheticToken]Baz[StringToken] ([SyntheticBeginToken])[SyntheticToken]{[BeginToken]}[SimpleToken]
-extension[KeywordToken] type[StringToken] ET10[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[SyntheticBeginToken]}[SyntheticToken]extends[KeywordToken] ;[SyntheticToken]Foo[StringToken] ;[SyntheticToken]with[KeywordToken] ;[SyntheticToken]Bar[StringToken],[SimpleToken] Baz[StringToken] ;[SyntheticToken]implements[KeywordToken] ;[SyntheticToken]Boz[StringToken] ([SyntheticBeginToken])[SyntheticToken]{[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET1[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] extends[KeywordToken] Foo[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET2[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] with[KeywordToken] Foo[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET3[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] with[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET4[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] extends[KeywordToken] Foo[StringToken] with[KeywordToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET5[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] extends[KeywordToken] Foo[StringToken] with[KeywordToken] Bar[StringToken],[SimpleToken] Baz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET6[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] extends[KeywordToken] Foo[StringToken] implements[KeywordToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET7[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] with[KeywordToken] Foo[StringToken] implements[KeywordToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET8[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] with[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken] implements[KeywordToken] Baz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET9[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] extends[KeywordToken] Foo[StringToken] with[KeywordToken] Bar[StringToken] implements[KeywordToken] Baz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET10[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] extends[KeywordToken] Foo[StringToken] with[KeywordToken] Bar[StringToken],[SimpleToken] Baz[StringToken] implements[KeywordToken] Boz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET11[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] extends[KeywordToken] Foo[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET12[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] with[KeywordToken] Foo[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET13[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] with[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET14[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] extends[KeywordToken] Foo[StringToken] with[KeywordToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET15[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] extends[KeywordToken] Foo[StringToken] with[KeywordToken] Bar[StringToken],[SimpleToken] Baz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET16[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] extends[KeywordToken] Foo[StringToken] implements[KeywordToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET17[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] with[KeywordToken] Foo[StringToken] implements[KeywordToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET18[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] with[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken] implements[KeywordToken] Baz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET19[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] extends[KeywordToken] Foo[StringToken] with[KeywordToken] Bar[StringToken] implements[KeywordToken] Baz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET20[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] extends[KeywordToken] Foo[StringToken] with[KeywordToken] Bar[StringToken],[SimpleToken] Baz[StringToken] implements[KeywordToken] Boz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET21[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] implements[KeywordToken] Boz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET22[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] extends[KeywordToken] Bar[StringToken] extends[KeywordToken] Boz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET23[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] extends[KeywordToken] Bar[StringToken],[SimpleToken] Boz[StringToken] {[BeginToken]}[SimpleToken]
 [SimpleToken]
diff --git a/pkg/front_end/parser_testcases/inline_class/extends_with.dart.scanner.expect b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.scanner.expect
index 7c24840..15990ab 100644
--- a/pkg/front_end/parser_testcases/inline_class/extends_with.dart.scanner.expect
+++ b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.scanner.expect
@@ -8,6 +8,19 @@
 extension type ET8(int i) with Foo, Bar implements Baz {}
 extension type ET9(int i) extends Foo with Bar implements Baz {}
 extension type ET10(int i) extends Foo with Bar, Baz implements Boz {}
+extension type ET11(int i) implements Bar extends Foo {}
+extension type ET12(int i) implements Bar with Foo {}
+extension type ET13(int i) implements Bar with Foo, Bar {}
+extension type ET14(int i) implements Bar extends Foo with Bar {}
+extension type ET15(int i) implements Bar extends Foo with Bar, Baz {}
+extension type ET16(int i) implements Bar extends Foo implements Bar {}
+extension type ET17(int i) implements Bar with Foo implements Bar {}
+extension type ET18(int i) implements Bar with Foo, Bar implements Baz {}
+extension type ET19(int i) implements Bar extends Foo with Bar implements Baz {}
+extension type ET20(int i) implements Bar extends Foo with Bar, Baz implements Boz {}
+extension type ET21(int i) implements Bar implements Boz {}
+extension type ET22(int i) extends Bar extends Boz {}
+extension type ET23(int i) extends Bar, Boz {}
 
 
 extension[KeywordToken] type[StringToken] ET1[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] extends[KeywordToken] Foo[StringToken] {[BeginToken]}[SimpleToken]
@@ -20,4 +33,17 @@
 extension[KeywordToken] type[StringToken] ET8[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] with[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken] implements[KeywordToken] Baz[StringToken] {[BeginToken]}[SimpleToken]
 extension[KeywordToken] type[StringToken] ET9[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] extends[KeywordToken] Foo[StringToken] with[KeywordToken] Bar[StringToken] implements[KeywordToken] Baz[StringToken] {[BeginToken]}[SimpleToken]
 extension[KeywordToken] type[StringToken] ET10[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] extends[KeywordToken] Foo[StringToken] with[KeywordToken] Bar[StringToken],[SimpleToken] Baz[StringToken] implements[KeywordToken] Boz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET11[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] extends[KeywordToken] Foo[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET12[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] with[KeywordToken] Foo[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET13[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] with[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET14[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] extends[KeywordToken] Foo[StringToken] with[KeywordToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET15[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] extends[KeywordToken] Foo[StringToken] with[KeywordToken] Bar[StringToken],[SimpleToken] Baz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET16[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] extends[KeywordToken] Foo[StringToken] implements[KeywordToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET17[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] with[KeywordToken] Foo[StringToken] implements[KeywordToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET18[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] with[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken] implements[KeywordToken] Baz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET19[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] extends[KeywordToken] Foo[StringToken] with[KeywordToken] Bar[StringToken] implements[KeywordToken] Baz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET20[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] extends[KeywordToken] Foo[StringToken] with[KeywordToken] Bar[StringToken],[SimpleToken] Baz[StringToken] implements[KeywordToken] Boz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET21[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Bar[StringToken] implements[KeywordToken] Boz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET22[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] extends[KeywordToken] Bar[StringToken] extends[KeywordToken] Boz[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET23[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] extends[KeywordToken] Bar[StringToken],[SimpleToken] Boz[StringToken] {[BeginToken]}[SimpleToken]
 [SimpleToken]
diff --git a/pkg/front_end/parser_testcases/inline_class/inline_class.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/inline_class.dart.intertwined.expect
index ecdc2ef..bdb86e4 100644
--- a/pkg/front_end/parser_testcases/inline_class/inline_class.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/inline_class/inline_class.dart.intertwined.expect
@@ -38,7 +38,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Class)
         parseClass(Class, class, class, Class)
           parseClassHeaderOpt(Class, class, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
diff --git a/pkg/front_end/parser_testcases/inline_class/no_body.dart.expect b/pkg/front_end/parser_testcases/inline_class/no_body.dart.expect
index b873320..c558a89 100644
--- a/pkg/front_end/parser_testcases/inline_class/no_body.dart.expect
+++ b/pkg/front_end/parser_testcases/inline_class/no_body.dart.expect
@@ -64,7 +64,7 @@
       handleClassExtends(null, 1)
       handleClassNoWithClause()
       handleImplements(null, 0)
-      handleRecoverClassHeader()
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.Class)
       handleRecoverableError(Message[ExpectedClassOrMixinBody, A class declaration must have a body, even if it is empty., Try adding an empty body., {string: class declaration}], C, C)
       beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.Class, 0, {, })
@@ -137,6 +137,11 @@
         endFormalParameters(1, (, ), MemberKind.PrimaryConstructor)
       endPrimaryConstructor((, null, false)
       handleImplements(null, 0)
+      handleNoType())
+      handleClassExtends(null, 1)
+      handleClassNoWithClause()
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
       handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
       beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
@@ -170,6 +175,11 @@
       handleNoTypeArguments(;)
       handleType(Foo, null)
       handleImplements(implements, 1)
+      handleNoType(Foo)
+      handleClassExtends(null, 1)
+      handleClassNoWithClause()
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
       handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], Foo, Foo)
       beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
@@ -206,6 +216,11 @@
       handleNoTypeArguments(;)
       handleType(Bar, null)
       handleImplements(implements, 2)
+      handleNoType(Bar)
+      handleClassExtends(null, 1)
+      handleClassNoWithClause()
+      handleImplements(null, 0)
+      handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
       handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], Bar, Bar)
       beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
       endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
diff --git a/pkg/front_end/parser_testcases/inline_class/no_body.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/no_body.dart.intertwined.expect
index 6cbe6ce..b5703cb 100644
--- a/pkg/front_end/parser_testcases/inline_class/no_body.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/inline_class/no_body.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
@@ -24,19 +24,20 @@
               listener: handleImplements(null, 0)
             listener: handleClassHeader(class, class, null)
           parseClassHeaderRecovery(C, class, class)
-            parseClassHeaderOpt(C, class, class)
-              parseClassExtendsOpt(C)
+            parseDeclarationHeaderRecoveryInternal(C, class, class, DeclarationHeaderKind.Class)
+              parseClassHeaderOpt(C, class, class)
+                parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
+                parseClassWithClauseOpt(C)
+                parseClassOrMixinOrEnumImplementsOpt(C)
+              skipUnexpectedTokenOpt(C, [extends, with, implements, {])
+              parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
+                listener: handleNoType(C)
+                listener: handleClassExtends(null, 1)
               parseClassWithClauseOpt(C)
+                listener: handleClassNoWithClause()
               parseClassOrMixinOrEnumImplementsOpt(C)
-            skipUnexpectedTokenOpt(C, [extends, with, implements, {])
-            parseClassExtendsOpt(C)
-              listener: handleNoType(C)
-              listener: handleClassExtends(null, 1)
-            parseClassWithClauseOpt(C)
-              listener: handleClassNoWithClause()
-            parseClassOrMixinOrEnumImplementsOpt(C)
-              listener: handleImplements(null, 0)
-            listener: handleRecoverClassHeader()
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.Class)
           ensureBlock(C, null, class declaration)
             reportRecoverableError(C, Message[ExpectedClassOrMixinBody, A class declaration must have a body, even if it is empty., Try adding an empty body., {string: class declaration}])
               listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A class declaration must have a body, even if it is empty., Try adding an empty body., {string: class declaration}], C, C)
@@ -173,6 +174,18 @@
           listener: endPrimaryConstructor((, null, false)
           parseClassOrMixinOrEnumImplementsOpt())
             listener: handleImplements(null, 0)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(), [extends, with, implements, {])
+              parseClassExtendsOpt(), DeclarationHeaderKind.ExtensionType)
+                listener: handleNoType())
+                listener: handleClassExtends(null, 1)
+              parseClassWithClauseOpt())
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt())
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
           ensureBlock(), null, extension type declaration)
             reportRecoverableError(), Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
               listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], ), ))
@@ -228,6 +241,18 @@
             listener: handleNoTypeArguments(;)
             listener: handleType(Foo, null)
             listener: handleImplements(implements, 1)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(Foo, [extends, with, implements, {])
+              parseClassExtendsOpt(Foo, DeclarationHeaderKind.ExtensionType)
+                listener: handleNoType(Foo)
+                listener: handleClassExtends(null, 1)
+              parseClassWithClauseOpt(Foo)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(Foo)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
           ensureBlock(Foo, null, extension type declaration)
             reportRecoverableError(Foo, Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
               listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], Foo, Foo)
@@ -286,6 +311,18 @@
             listener: handleNoTypeArguments(;)
             listener: handleType(Bar, null)
             listener: handleImplements(implements, 2)
+          parseExtensionTypeHeaderRecovery(), extension)
+            parseDeclarationHeaderRecoveryInternal(), extension, extension, DeclarationHeaderKind.ExtensionType)
+              parseClassOrMixinOrEnumImplementsOpt())
+              skipUnexpectedTokenOpt(Bar, [extends, with, implements, {])
+              parseClassExtendsOpt(Bar, DeclarationHeaderKind.ExtensionType)
+                listener: handleNoType(Bar)
+                listener: handleClassExtends(null, 1)
+              parseClassWithClauseOpt(Bar)
+                listener: handleClassNoWithClause()
+              parseClassOrMixinOrEnumImplementsOpt(Bar)
+                listener: handleImplements(null, 0)
+              listener: handleRecoverDeclarationHeader(DeclarationHeaderKind.ExtensionType)
           ensureBlock(Bar, null, extension type declaration)
             reportRecoverableError(Bar, Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}])
               listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension type declaration must have a body, even if it is empty., Try adding an empty body., {string: extension type declaration}], Bar, Bar)
diff --git a/pkg/front_end/parser_testcases/macros/augment_class.dart.intertwined.expect b/pkg/front_end/parser_testcases/macros/augment_class.dart.intertwined.expect
index 888d267..a4586f0 100644
--- a/pkg/front_end/parser_testcases/macros/augment_class.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/macros/augment_class.dart.intertwined.expect
@@ -38,7 +38,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Class)
         parseClass(Class, class, class, Class)
           parseClassHeaderOpt(Class, class, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
@@ -90,7 +90,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Class)
         parseClass(Class, class, class, Class)
           parseClassHeaderOpt(Class, class, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
diff --git a/pkg/front_end/parser_testcases/macros/macro_class.dart.intertwined.expect b/pkg/front_end/parser_testcases/macros/macro_class.dart.intertwined.expect
index 839896e..c7418f1 100644
--- a/pkg/front_end/parser_testcases/macros/macro_class.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/macros/macro_class.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(macro, null, macro, null, null, null, null, null, null, Class)
         parseClass(Class, macro, class, Class)
           parseClassHeaderOpt(Class, macro, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
@@ -42,7 +42,7 @@
         listener: beginClassDeclaration(abstract, abstract, macro, null, null, null, null, null, null, Class)
         parseClass(Class, abstract, class, Class)
           parseClassHeaderOpt(Class, abstract, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
diff --git a/pkg/front_end/parser_testcases/nnbd/error_recovery/abstract_placement.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/error_recovery/abstract_placement.dart.intertwined.expect
index 67823d0..6abfe98 100644
--- a/pkg/front_end/parser_testcases/nnbd/error_recovery/abstract_placement.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/error_recovery/abstract_placement.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(abstract, abstract, null, null, null, null, null, null, null, C)
         parseClass(C, abstract, class, C)
           parseClassHeaderOpt(C, abstract, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
@@ -218,7 +218,7 @@
         listener: beginClassDeclaration(abstract, abstract, null, null, null, null, null, null, null, Bar)
         parseClass(Bar, abstract, class, Bar)
           parseClassHeaderOpt(Bar, abstract, class)
-            parseClassExtendsOpt(Bar)
+            parseClassExtendsOpt(Bar, DeclarationHeaderKind.Class)
               listener: handleNoType(Bar)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Bar)
diff --git a/pkg/front_end/parser_testcases/nnbd/error_recovery/external_placement.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/error_recovery/external_placement.dart.intertwined.expect
index 285be8f..0f8177b 100644
--- a/pkg/front_end/parser_testcases/nnbd/error_recovery/external_placement.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/error_recovery/external_placement.dart.intertwined.expect
@@ -55,7 +55,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.intertwined.expect
index 3175d33..39ee3bf 100644
--- a/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/error_recovery/late_without_var_etc.dart.intertwined.expect
@@ -82,7 +82,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39723.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39723.dart.intertwined.expect
index 8001360..b78ee55 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39723.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39723.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39723_prime.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39723_prime.dart.intertwined.expect
index e8986a0..a95cbc1 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39723_prime.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39723_prime.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(A, class, class, A)
           parseClassHeaderOpt(A, class, class)
-            parseClassExtendsOpt(A)
+            parseClassExtendsOpt(A, DeclarationHeaderKind.Class)
               listener: handleNoType(A)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(A)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39858.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39858.dart.intertwined.expect
index d8c998d..911194a 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39858.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39858.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, X)
         parseClass(X, class, class, X)
           parseClassHeaderOpt(X, class, class)
-            parseClassExtendsOpt(X)
+            parseClassExtendsOpt(X, DeclarationHeaderKind.Class)
               listener: handleNoType(X)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(X)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_39858_prime1.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_39858_prime1.dart.intertwined.expect
index 7d06b41..3262d84 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_39858_prime1.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_39858_prime1.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, X)
         parseClass(X, class, class, X)
           parseClassHeaderOpt(X, class, class)
-            parseClassExtendsOpt(X)
+            parseClassExtendsOpt(X, DeclarationHeaderKind.Class)
               listener: handleNoType(X)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(X)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40805_01.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40805_01.dart.intertwined.expect
index e30cbf1..53b1770 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_40805_01.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40805_01.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40805_02.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40805_02.dart.intertwined.expect
index 10c1baf..45936dd 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_40805_02.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40805_02.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40805_03.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40805_03.dart.intertwined.expect
index 014564c..59fcfa6 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_40805_03.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40805_03.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40834_01.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40834_01.dart.intertwined.expect
index 1f85a3c..0b3494c 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_40834_01.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40834_01.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40834_02.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40834_02.dart.intertwined.expect
index 0603921..891c79a 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_40834_02.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40834_02.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_40834_03.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_40834_03.dart.intertwined.expect
index c9addbd..fa847ab 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_40834_03.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_40834_03.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_41597.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_41597.dart.intertwined.expect
index 548666cd..1b7659e 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_41597.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_41597.dart.intertwined.expect
@@ -195,7 +195,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_42621.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_42621.dart.intertwined.expect
index ba71a7c..f3e565b 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_42621.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_42621.dart.intertwined.expect
@@ -642,7 +642,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Order)
         parseClass(Order, class, class, Order)
           parseClassHeaderOpt(Order, class, class)
-            parseClassExtendsOpt(Order)
+            parseClassExtendsOpt(Order, DeclarationHeaderKind.Class)
               listener: handleNoType(Order)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Order)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_49132.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_49132.dart.intertwined.expect
index 5e8adda..8d1f9ec 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_49132.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_49132.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_49132_not_nullable.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_49132_not_nullable.dart.intertwined.expect
index 1841d21..eadac50 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_49132_not_nullable.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_49132_not_nullable.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/nnbd/issue_49132_prime.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/issue_49132_prime.dart.intertwined.expect
index 3e6bb96..a527faa 100644
--- a/pkg/front_end/parser_testcases/nnbd/issue_49132_prime.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/issue_49132_prime.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/nnbd/late_member.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/late_member.dart.intertwined.expect
index b90a50a..1a2c8ec 100644
--- a/pkg/front_end/parser_testcases/nnbd/late_member.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/late_member.dart.intertwined.expect
@@ -334,7 +334,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, X)
         parseClass(X, class, class, X)
           parseClassHeaderOpt(X, class, class)
-            parseClassExtendsOpt(X)
+            parseClassExtendsOpt(X, DeclarationHeaderKind.Class)
               listener: handleNoType(X)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(X)
@@ -425,7 +425,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Y)
         parseClass(Y, class, class, Y)
           parseClassHeaderOpt(Y, class, class)
-            parseClassExtendsOpt(Y)
+            parseClassExtendsOpt(Y, DeclarationHeaderKind.Class)
               listener: handleNoType(Y)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Y)
diff --git a/pkg/front_end/parser_testcases/nnbd/late_modifier.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/late_modifier.dart.intertwined.expect
index cf89d29..1f98daf 100644
--- a/pkg/front_end/parser_testcases/nnbd/late_modifier.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/late_modifier.dart.intertwined.expect
@@ -383,7 +383,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, X)
         parseClass(X, class, class, X)
           parseClassHeaderOpt(X, class, class)
-            parseClassExtendsOpt(X)
+            parseClassExtendsOpt(X, DeclarationHeaderKind.Class)
               listener: handleNoType(X)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(X)
@@ -474,7 +474,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Y)
         parseClass(Y, class, class, Y)
           parseClassHeaderOpt(Y, class, class)
-            parseClassExtendsOpt(Y)
+            parseClassExtendsOpt(Y, DeclarationHeaderKind.Class)
               listener: handleNoType(Y)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Y)
diff --git a/pkg/front_end/parser_testcases/nnbd/null_shorting_index.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/null_shorting_index.dart.intertwined.expect
index 952ac55..2908fe4 100644
--- a/pkg/front_end/parser_testcases/nnbd/null_shorting_index.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/null_shorting_index.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Class1)
         parseClass(Class1, class, class, Class1)
           parseClassHeaderOpt(Class1, class, class)
-            parseClassExtendsOpt(Class1)
+            parseClassExtendsOpt(Class1, DeclarationHeaderKind.Class)
               listener: handleNoType(Class1)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class1)
diff --git a/pkg/front_end/parser_testcases/nnbd/required_member.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/required_member.dart.intertwined.expect
index 6d68fbc..56e1bfe 100644
--- a/pkg/front_end/parser_testcases/nnbd/required_member.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/required_member.dart.intertwined.expect
@@ -334,7 +334,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, X)
         parseClass(X, class, class, X)
           parseClassHeaderOpt(X, class, class)
-            parseClassExtendsOpt(X)
+            parseClassExtendsOpt(X, DeclarationHeaderKind.Class)
               listener: handleNoType(X)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(X)
@@ -425,7 +425,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Y)
         parseClass(Y, class, class, Y)
           parseClassHeaderOpt(Y, class, class)
-            parseClassExtendsOpt(Y)
+            parseClassExtendsOpt(Y, DeclarationHeaderKind.Class)
               listener: handleNoType(Y)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Y)
diff --git a/pkg/front_end/parser_testcases/nnbd/required_modifier.dart.intertwined.expect b/pkg/front_end/parser_testcases/nnbd/required_modifier.dart.intertwined.expect
index f9abe34..a13eb06 100644
--- a/pkg/front_end/parser_testcases/nnbd/required_modifier.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/nnbd/required_modifier.dart.intertwined.expect
@@ -350,7 +350,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, X)
         parseClass(X, class, class, X)
           parseClassHeaderOpt(X, class, class)
-            parseClassExtendsOpt(X)
+            parseClassExtendsOpt(X, DeclarationHeaderKind.Class)
               listener: handleNoType(X)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(X)
@@ -441,7 +441,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Y)
         parseClass(Y, class, class, Y)
           parseClassHeaderOpt(Y, class, class)
-            parseClassExtendsOpt(Y)
+            parseClassExtendsOpt(Y, DeclarationHeaderKind.Class)
               listener: handleNoType(Y)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Y)
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.intertwined.expect b/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.intertwined.expect
index 8962f89..b8ca562 100644
--- a/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method_prime.dart.intertwined.expect b/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method_prime.dart.intertwined.expect
index 5287caf..444e359 100644
--- a/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method_prime.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/no-triple-shift/define_triple_shift_method_prime.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_not_triple_shift.dart.intertwined.expect b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_not_triple_shift.dart.intertwined.expect
index fb51426..3b29847 100644
--- a/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_not_triple_shift.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/no-triple-shift/triple_shift_not_triple_shift.dart.intertwined.expect
@@ -213,8 +213,8 @@
         listener: beginClassDeclaration(abstract, abstract, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, abstract, class, Foo)
           parseClassHeaderOpt(Foo, abstract, class)
-            parseClassExtendsOpt(Foo)
-              parseClassExtendsSeenExtendsClause(extends, Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, Foo, DeclarationHeaderKind.Class)
                 ensureIdentifier(extends, typeReference)
                   listener: handleIdentifier(List, typeReference)
                 listener: beginTypeArguments(<)
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40288.dart.intertwined.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40288.dart.intertwined.expect
index a829ecc..f06c1d3 100644
--- a/pkg/front_end/parser_testcases/non-nnbd/issue_40288.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40288.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, late)
         parseClass(late, class, class, late)
           parseClassHeaderOpt(late, class, class)
-            parseClassExtendsOpt(late)
+            parseClassExtendsOpt(late, DeclarationHeaderKind.Class)
               listener: handleNoType(late)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(late)
@@ -79,7 +79,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, required)
         parseClass(required, class, class, required)
           parseClassHeaderOpt(required, class, class)
-            parseClassExtendsOpt(required)
+            parseClassExtendsOpt(required, DeclarationHeaderKind.Class)
               listener: handleNoType(required)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(required)
@@ -143,7 +143,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/non-nnbd/issue_40288_prime.dart.intertwined.expect b/pkg/front_end/parser_testcases/non-nnbd/issue_40288_prime.dart.intertwined.expect
index 08f4a1e..878a290 100644
--- a/pkg/front_end/parser_testcases/non-nnbd/issue_40288_prime.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/non-nnbd/issue_40288_prime.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Xlate)
         parseClass(Xlate, class, class, Xlate)
           parseClassHeaderOpt(Xlate, class, class)
-            parseClassExtendsOpt(Xlate)
+            parseClassExtendsOpt(Xlate, DeclarationHeaderKind.Class)
               listener: handleNoType(Xlate)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Xlate)
@@ -79,7 +79,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Xrequired)
         parseClass(Xrequired, class, class, Xrequired)
           parseClassHeaderOpt(Xrequired, class, class)
-            parseClassExtendsOpt(Xrequired)
+            parseClassExtendsOpt(Xrequired, DeclarationHeaderKind.Class)
               listener: handleNoType(Xrequired)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Xrequired)
@@ -143,7 +143,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/non-nnbd/nullable_type_argument.dart.intertwined.expect b/pkg/front_end/parser_testcases/non-nnbd/nullable_type_argument.dart.intertwined.expect
index d51a5a2..65117ed 100644
--- a/pkg/front_end/parser_testcases/non-nnbd/nullable_type_argument.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/non-nnbd/nullable_type_argument.dart.intertwined.expect
@@ -23,7 +23,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, A)
         parseClass(>, class, class, A)
           parseClassHeaderOpt(>, class, class)
-            parseClassExtendsOpt(>)
+            parseClassExtendsOpt(>, DeclarationHeaderKind.Class)
               listener: handleNoType(>)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(>)
@@ -50,7 +50,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, B)
         parseClass(B, class, class, B)
           parseClassHeaderOpt(B, class, class)
-            parseClassExtendsOpt(B)
+            parseClassExtendsOpt(B, DeclarationHeaderKind.Class)
               listener: handleNoType(B)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(B)
diff --git a/pkg/front_end/parser_testcases/non-nnbd/use_late_in_non_nnbd.dart.intertwined.expect b/pkg/front_end/parser_testcases/non-nnbd/use_late_in_non_nnbd.dart.intertwined.expect
index c4c74fb0..cbf5286 100644
--- a/pkg/front_end/parser_testcases/non-nnbd/use_late_in_non_nnbd.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/non-nnbd/use_late_in_non_nnbd.dart.intertwined.expect
@@ -346,7 +346,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/non-nnbd/use_required_in_non_nnbd.dart.intertwined.expect b/pkg/front_end/parser_testcases/non-nnbd/use_required_in_non_nnbd.dart.intertwined.expect
index 3aac145..62a90f3 100644
--- a/pkg/front_end/parser_testcases/non-nnbd/use_required_in_non_nnbd.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/non-nnbd/use_required_in_non_nnbd.dart.intertwined.expect
@@ -262,7 +262,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/patterns/cast_inside_extractor_pattern.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/cast_inside_extractor_pattern.dart.intertwined.expect
index 8cab060..d0dcacd 100644
--- a/pkg/front_end/parser_testcases/patterns/cast_inside_extractor_pattern.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/cast_inside_extractor_pattern.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/patterns/cast_inside_extractor_pattern_implicitly_named.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/cast_inside_extractor_pattern_implicitly_named.dart.intertwined.expect
index 51f4b69..bb0d61c 100644
--- a/pkg/front_end/parser_testcases/patterns/cast_inside_extractor_pattern_implicitly_named.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/cast_inside_extractor_pattern_implicitly_named.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/patterns/const_patterns.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/const_patterns.dart.intertwined.expect
index 17909cc..0bf4aa6 100644
--- a/pkg/front_end/parser_testcases/patterns/const_patterns.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/const_patterns.dart.intertwined.expect
@@ -95,7 +95,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Class)
         parseClass(Class, class, class, Class)
           parseClassHeaderOpt(Class, class, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
@@ -3254,7 +3254,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, GenericClass)
         parseClass(>, class, class, GenericClass)
           parseClassHeaderOpt(>, class, class)
-            parseClassExtendsOpt(>)
+            parseClassExtendsOpt(>, DeclarationHeaderKind.Class)
               listener: handleNoType(>)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(>)
diff --git a/pkg/front_end/parser_testcases/patterns/const_patterns_binary.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/const_patterns_binary.dart.intertwined.expect
index 351402f..728ce4e 100644
--- a/pkg/front_end/parser_testcases/patterns/const_patterns_binary.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/const_patterns_binary.dart.intertwined.expect
@@ -66,7 +66,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Class)
         parseClass(Class, class, class, Class)
           parseClassHeaderOpt(Class, class, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
diff --git a/pkg/front_end/parser_testcases/patterns/extractor_pattern_inside_cast.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/extractor_pattern_inside_cast.dart.intertwined.expect
index 8015455..6a7287e 100644
--- a/pkg/front_end/parser_testcases/patterns/extractor_pattern_inside_cast.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/extractor_pattern_inside_cast.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/patterns/extractor_pattern_inside_null_assert.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/extractor_pattern_inside_null_assert.dart.intertwined.expect
index dcc63fc..2d0a4c9 100644
--- a/pkg/front_end/parser_testcases/patterns/extractor_pattern_inside_null_assert.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/extractor_pattern_inside_null_assert.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/patterns/extractor_pattern_inside_null_check.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/extractor_pattern_inside_null_check.dart.intertwined.expect
index 50bf308..104147e 100644
--- a/pkg/front_end/parser_testcases/patterns/extractor_pattern_inside_null_check.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/extractor_pattern_inside_null_check.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/patterns/extractor_pattern_with_type_args.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/extractor_pattern_with_type_args.dart.intertwined.expect
index b6cb688..01e7ce9 100644
--- a/pkg/front_end/parser_testcases/patterns/extractor_pattern_with_type_args.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/extractor_pattern_with_type_args.dart.intertwined.expect
@@ -23,7 +23,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(>, class, class, C)
           parseClassHeaderOpt(>, class, class)
-            parseClassExtendsOpt(>)
+            parseClassExtendsOpt(>, DeclarationHeaderKind.Class)
               listener: handleNoType(>)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(>)
diff --git a/pkg/front_end/parser_testcases/patterns/extractor_pattern_with_type_args_inside_null_assert.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/extractor_pattern_with_type_args_inside_null_assert.dart.intertwined.expect
index da1739b..9aac67b 100644
--- a/pkg/front_end/parser_testcases/patterns/extractor_pattern_with_type_args_inside_null_assert.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/extractor_pattern_with_type_args_inside_null_assert.dart.intertwined.expect
@@ -23,7 +23,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(>, class, class, C)
           parseClassHeaderOpt(>, class, class)
-            parseClassExtendsOpt(>)
+            parseClassExtendsOpt(>, DeclarationHeaderKind.Class)
               listener: handleNoType(>)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(>)
diff --git a/pkg/front_end/parser_testcases/patterns/issue_51169.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/issue_51169.dart.intertwined.expect
index 76671c1..c078050 100644
--- a/pkg/front_end/parser_testcases/patterns/issue_51169.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/issue_51169.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Class)
         parseClass(Class, class, class, Class)
           parseClassHeaderOpt(Class, class, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
diff --git a/pkg/front_end/parser_testcases/patterns/null_assert_inside_extractor_pattern.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/null_assert_inside_extractor_pattern.dart.intertwined.expect
index 20732a8..0c974b8 100644
--- a/pkg/front_end/parser_testcases/patterns/null_assert_inside_extractor_pattern.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/null_assert_inside_extractor_pattern.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/patterns/null_assert_inside_extractor_pattern_implicitly_named.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/null_assert_inside_extractor_pattern_implicitly_named.dart.intertwined.expect
index e53b08d..3d4a0de 100644
--- a/pkg/front_end/parser_testcases/patterns/null_assert_inside_extractor_pattern_implicitly_named.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/null_assert_inside_extractor_pattern_implicitly_named.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/patterns/null_check_inside_extractor_pattern.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/null_check_inside_extractor_pattern.dart.intertwined.expect
index a6a969c..4b21040 100644
--- a/pkg/front_end/parser_testcases/patterns/null_check_inside_extractor_pattern.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/null_check_inside_extractor_pattern.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/patterns/null_check_inside_extractor_pattern_implicitly_named.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/null_check_inside_extractor_pattern_implicitly_named.dart.intertwined.expect
index d44ae1c..55f9868 100644
--- a/pkg/front_end/parser_testcases/patterns/null_check_inside_extractor_pattern_implicitly_named.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/null_check_inside_extractor_pattern_implicitly_named.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/patterns/object_unprefixed_withTypeArgs_insideDeclaration.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/object_unprefixed_withTypeArgs_insideDeclaration.dart.intertwined.expect
index c29087a..1ddd34e 100644
--- a/pkg/front_end/parser_testcases/patterns/object_unprefixed_withTypeArgs_insideDeclaration.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/object_unprefixed_withTypeArgs_insideDeclaration.dart.intertwined.expect
@@ -23,7 +23,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(>, class, class, C)
           parseClassHeaderOpt(>, class, class)
-            parseClassExtendsOpt(>)
+            parseClassExtendsOpt(>, DeclarationHeaderKind.Class)
               listener: handleNoType(>)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(>)
diff --git a/pkg/front_end/parser_testcases/patterns/patternVariableDeclaration_inClass.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/patternVariableDeclaration_inClass.dart.intertwined.expect
index f08f427..f330d72 100644
--- a/pkg/front_end/parser_testcases/patterns/patternVariableDeclaration_inClass.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/patternVariableDeclaration_inClass.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/patterns/relational_inside_extractor_pattern.dart.intertwined.expect b/pkg/front_end/parser_testcases/patterns/relational_inside_extractor_pattern.dart.intertwined.expect
index 85908d4..46b7817 100644
--- a/pkg/front_end/parser_testcases/patterns/relational_inside_extractor_pattern.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/patterns/relational_inside_extractor_pattern.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/record/field_formal_parameter_with_explicit_record_type.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/field_formal_parameter_with_explicit_record_type.dart.intertwined.expect
index 8dd3d5c..0a6aeab 100644
--- a/pkg/front_end/parser_testcases/record/field_formal_parameter_with_explicit_record_type.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/record/field_formal_parameter_with_explicit_record_type.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/record/metadata.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/metadata.dart.intertwined.expect
index 0ee2b04..e92dc23 100644
--- a/pkg/front_end/parser_testcases/record/metadata.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/record/metadata.dart.intertwined.expect
@@ -405,7 +405,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, C)
         parseClass(C, class, class, C)
           parseClassHeaderOpt(C, class, class)
-            parseClassExtendsOpt(C)
+            parseClassExtendsOpt(C, DeclarationHeaderKind.Class)
               listener: handleNoType(C)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(C)
diff --git a/pkg/front_end/parser_testcases/record/modifier_before_type_question.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/modifier_before_type_question.dart.intertwined.expect
index 3740224..2969566 100644
--- a/pkg/front_end/parser_testcases/record/modifier_before_type_question.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/record/modifier_before_type_question.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(abstract, abstract, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, abstract, class, Foo)
           parseClassHeaderOpt(Foo, abstract, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/record/operator_returning_record.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/operator_returning_record.dart.intertwined.expect
index d0e325d..6db77e5 100644
--- a/pkg/front_end/parser_testcases/record/operator_returning_record.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/record/operator_returning_record.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
@@ -135,7 +135,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Bar)
         parseClass(Bar, class, class, Bar)
           parseClassHeaderOpt(Bar, class, class)
-            parseClassExtendsOpt(Bar)
+            parseClassExtendsOpt(Bar, DeclarationHeaderKind.Class)
               listener: handleNoType(Bar)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Bar)
diff --git a/pkg/front_end/parser_testcases/record/record_type_03.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_03.dart.intertwined.expect
index 934188b..5ae6adb 100644
--- a/pkg/front_end/parser_testcases/record/record_type_03.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/record/record_type_03.dart.intertwined.expect
@@ -385,7 +385,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Baz)
         parseClass(Baz, class, class, Baz)
           parseClassHeaderOpt(Baz, class, class)
-            parseClassExtendsOpt(Baz)
+            parseClassExtendsOpt(Baz, DeclarationHeaderKind.Class)
               listener: handleNoType(Baz)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Baz)
diff --git a/pkg/front_end/parser_testcases/record/record_type_getter.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_getter.dart.intertwined.expect
index f8eb9bd..81c5c86 100644
--- a/pkg/front_end/parser_testcases/record/record_type_getter.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/record/record_type_getter.dart.intertwined.expect
@@ -1746,7 +1746,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
@@ -3607,7 +3607,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Bar)
         parseClass(Bar, class, class, Bar)
           parseClassHeaderOpt(Bar, class, class)
-            parseClassExtendsOpt(Bar)
+            parseClassExtendsOpt(Bar, DeclarationHeaderKind.Class)
               listener: handleNoType(Bar)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Bar)
diff --git a/pkg/front_end/parser_testcases/record/record_type_setter.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_setter.dart.intertwined.expect
index 419319b..49c8915 100644
--- a/pkg/front_end/parser_testcases/record/record_type_setter.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/record/record_type_setter.dart.intertwined.expect
@@ -344,7 +344,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
@@ -717,7 +717,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Bar)
         parseClass(Bar, class, class, Bar)
           parseClassHeaderOpt(Bar, class, class)
-            parseClassExtendsOpt(Bar)
+            parseClassExtendsOpt(Bar, DeclarationHeaderKind.Class)
               listener: handleNoType(Bar)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Bar)
diff --git a/pkg/front_end/parser_testcases/record/record_type_with_modifiers.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/record_type_with_modifiers.dart.intertwined.expect
index ff8a50b..a2a8463b 100644
--- a/pkg/front_end/parser_testcases/record/record_type_with_modifiers.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/record/record_type_with_modifiers.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
               listener: handleNoType(Foo)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Foo)
diff --git a/pkg/front_end/parser_testcases/record/super_parameters_record_type.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/super_parameters_record_type.dart.intertwined.expect
index f6e6cad..3348f8b 100644
--- a/pkg/front_end/parser_testcases/record/super_parameters_record_type.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/record/super_parameters_record_type.dart.intertwined.expect
@@ -15,8 +15,8 @@
         listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, Foo)
         parseClass(Foo, class, class, Foo)
           parseClassHeaderOpt(Foo, class, class)
-            parseClassExtendsOpt(Foo)
-              parseClassExtendsSeenExtendsClause(extends, Foo)
+            parseClassExtendsOpt(Foo, DeclarationHeaderKind.Class)
+              parseClassExtendsSeenExtendsClause(extends, Foo, DeclarationHeaderKind.Class)
                 listener: handleIdentifier(Bar, typeReference)
                 listener: handleNoTypeArguments({)
                 listener: handleType(Bar, null)
diff --git a/pkg/front_end/parser_testcases/sealed_class/sealed_class.dart.intertwined.expect b/pkg/front_end/parser_testcases/sealed_class/sealed_class.dart.intertwined.expect
index f28225a..69858a4 100644
--- a/pkg/front_end/parser_testcases/sealed_class/sealed_class.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/sealed_class/sealed_class.dart.intertwined.expect
@@ -15,7 +15,7 @@
         listener: beginClassDeclaration(sealed, null, null, sealed, null, null, null, null, null, Class)
         parseClass(Class, sealed, class, Class)
           parseClassHeaderOpt(Class, sealed, class)
-            parseClassExtendsOpt(Class)
+            parseClassExtendsOpt(Class, DeclarationHeaderKind.Class)
               listener: handleNoType(Class)
               listener: handleClassExtends(null, 1)
             parseClassWithClauseOpt(Class)
diff --git a/pkg/front_end/test/parser_test_listener.dart b/pkg/front_end/test/parser_test_listener.dart
index 9fe04a8..e589854 100644
--- a/pkg/front_end/test/parser_test_listener.dart
+++ b/pkg/front_end/test/parser_test_listener.dart
@@ -266,8 +266,8 @@
   }
 
   @override
-  void handleRecoverClassHeader() {
-    doPrint('handleRecoverClassHeader()');
+  void handleRecoverDeclarationHeader(DeclarationHeaderKind kind) {
+    doPrint('handleRecoverDeclarationHeader(' '$kind)');
   }
 
   @override
diff --git a/pkg/front_end/test/parser_test_parser.dart b/pkg/front_end/test/parser_test_parser.dart
index 96171ea..3970d6c 100644
--- a/pkg/front_end/test/parser_test_parser.dart
+++ b/pkg/front_end/test/parser_test_parser.dart
@@ -729,21 +729,50 @@
   }
 
   @override
-  Token parseClassExtendsOpt(Token token) {
-    doPrint('parseClassExtendsOpt(' '$token)');
+  Token parseExtensionTypeHeaderRecovery(Token token, Token extensionKeyword) {
+    doPrint(
+        'parseExtensionTypeHeaderRecovery(' '$token, ' '$extensionKeyword)');
     indent++;
-    var result = super.parseClassExtendsOpt(token);
+    var result =
+        super.parseExtensionTypeHeaderRecovery(token, extensionKeyword);
     indent--;
     return result;
   }
 
   @override
-  Token parseClassExtendsSeenExtendsClause(Token extendsKeyword, Token token) {
-    doPrint(
-        'parseClassExtendsSeenExtendsClause(' '$extendsKeyword, ' '$token)');
+  Token parseDeclarationHeaderRecoveryInternal(Token token, Token begin,
+      Token declarationKeyword, DeclarationHeaderKind kind) {
+    doPrint('parseDeclarationHeaderRecoveryInternal('
+        '$token, '
+        '$begin, '
+        '$declarationKeyword, '
+        '$kind)');
+    indent++;
+    var result = super.parseDeclarationHeaderRecoveryInternal(
+        token, begin, declarationKeyword, kind);
+    indent--;
+    return result;
+  }
+
+  @override
+  Token parseClassExtendsOpt(Token token, DeclarationHeaderKind kind) {
+    doPrint('parseClassExtendsOpt(' '$token, ' '$kind)');
+    indent++;
+    var result = super.parseClassExtendsOpt(token, kind);
+    indent--;
+    return result;
+  }
+
+  @override
+  Token parseClassExtendsSeenExtendsClause(
+      Token extendsKeyword, Token token, DeclarationHeaderKind kind) {
+    doPrint('parseClassExtendsSeenExtendsClause('
+        '$extendsKeyword, '
+        '$token, '
+        '$kind)');
     indent++;
     var result =
-        super.parseClassExtendsSeenExtendsClause(extendsKeyword, token);
+        super.parseClassExtendsSeenExtendsClause(extendsKeyword, token, kind);
     indent--;
     return result;
   }
diff --git a/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.strong.expect b/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.strong.expect
index 56aa526..ed5eed8 100644
--- a/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.strong.expect
+++ b/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.strong.expect
@@ -7,32 +7,20 @@
 // extension type E on A {} // Error because of 'type'.
 //                ^
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:16: Error: A extension type declaration must have a body, even if it is empty.
-// Try adding an empty body.
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Expected 'extends' instead of this.
 // extension type E on A {} // Error because of 'type'.
-//                ^
+//                  ^^
+//
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type E on A {} // Error because of 'type'.
+//                  ^^
 //
 // pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:11: Error: This requires the experimental 'inline-class' language feature to be enabled.
 // Try passing the '--enable-experiment=inline-class' command line option.
 // extension type E on A {} // Error because of 'type'.
 //           ^^^^
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:21: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension type E on A {} // Error because of 'type'.
-//                     ^
-//
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:21: Error: 'A' is already declared in this scope.
-// extension type E on A {} // Error because of 'type'.
-//                     ^
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:7:7: Context: Previous declaration of 'A'.
-// class A {}
-//       ^
-//
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Type 'on' not found.
-// extension type E on A {} // Error because of 'type'.
-//                  ^^
-//
 import self as self;
 import "dart:core" as core;
 
diff --git a/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.strong.transformed.expect b/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.strong.transformed.expect
index 56aa526..ed5eed8 100644
--- a/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.strong.transformed.expect
@@ -7,32 +7,20 @@
 // extension type E on A {} // Error because of 'type'.
 //                ^
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:16: Error: A extension type declaration must have a body, even if it is empty.
-// Try adding an empty body.
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Expected 'extends' instead of this.
 // extension type E on A {} // Error because of 'type'.
-//                ^
+//                  ^^
+//
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type E on A {} // Error because of 'type'.
+//                  ^^
 //
 // pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:11: Error: This requires the experimental 'inline-class' language feature to be enabled.
 // Try passing the '--enable-experiment=inline-class' command line option.
 // extension type E on A {} // Error because of 'type'.
 //           ^^^^
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:21: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension type E on A {} // Error because of 'type'.
-//                     ^
-//
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:21: Error: 'A' is already declared in this scope.
-// extension type E on A {} // Error because of 'type'.
-//                     ^
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:7:7: Context: Previous declaration of 'A'.
-// class A {}
-//       ^
-//
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Type 'on' not found.
-// extension type E on A {} // Error because of 'type'.
-//                  ^^
-//
 import self as self;
 import "dart:core" as core;
 
diff --git a/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.textual_outline.expect b/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.textual_outline.expect
index 39a45ab..a4c015d 100644
--- a/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.textual_outline.expect
@@ -1,4 +1,3 @@
 class A {}
-extension type E {}
-on A (){}
+extension type E on A {}
 main() {}
diff --git a/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.expect b/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.expect
index 56aa526..ed5eed8 100644
--- a/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.expect
+++ b/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.expect
@@ -7,32 +7,20 @@
 // extension type E on A {} // Error because of 'type'.
 //                ^
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:16: Error: A extension type declaration must have a body, even if it is empty.
-// Try adding an empty body.
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Expected 'extends' instead of this.
 // extension type E on A {} // Error because of 'type'.
-//                ^
+//                  ^^
+//
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type E on A {} // Error because of 'type'.
+//                  ^^
 //
 // pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:11: Error: This requires the experimental 'inline-class' language feature to be enabled.
 // Try passing the '--enable-experiment=inline-class' command line option.
 // extension type E on A {} // Error because of 'type'.
 //           ^^^^
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:21: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension type E on A {} // Error because of 'type'.
-//                     ^
-//
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:21: Error: 'A' is already declared in this scope.
-// extension type E on A {} // Error because of 'type'.
-//                     ^
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:7:7: Context: Previous declaration of 'A'.
-// class A {}
-//       ^
-//
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Type 'on' not found.
-// extension type E on A {} // Error because of 'type'.
-//                  ^^
-//
 import self as self;
 import "dart:core" as core;
 
diff --git a/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.modular.expect b/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.modular.expect
index 56aa526..ed5eed8 100644
--- a/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.modular.expect
+++ b/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.modular.expect
@@ -7,32 +7,20 @@
 // extension type E on A {} // Error because of 'type'.
 //                ^
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:16: Error: A extension type declaration must have a body, even if it is empty.
-// Try adding an empty body.
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Expected 'extends' instead of this.
 // extension type E on A {} // Error because of 'type'.
-//                ^
+//                  ^^
+//
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type E on A {} // Error because of 'type'.
+//                  ^^
 //
 // pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:11: Error: This requires the experimental 'inline-class' language feature to be enabled.
 // Try passing the '--enable-experiment=inline-class' command line option.
 // extension type E on A {} // Error because of 'type'.
 //           ^^^^
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:21: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension type E on A {} // Error because of 'type'.
-//                     ^
-//
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:21: Error: 'A' is already declared in this scope.
-// extension type E on A {} // Error because of 'type'.
-//                     ^
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:7:7: Context: Previous declaration of 'A'.
-// class A {}
-//       ^
-//
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Type 'on' not found.
-// extension type E on A {} // Error because of 'type'.
-//                  ^^
-//
 import self as self;
 import "dart:core" as core;
 
diff --git a/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.outline.expect b/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.outline.expect
index 247413d..ec4078a 100644
--- a/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.outline.expect
@@ -7,32 +7,20 @@
 // extension type E on A {} // Error because of 'type'.
 //                ^
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:16: Error: A extension type declaration must have a body, even if it is empty.
-// Try adding an empty body.
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Expected 'extends' instead of this.
 // extension type E on A {} // Error because of 'type'.
-//                ^
+//                  ^^
+//
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type E on A {} // Error because of 'type'.
+//                  ^^
 //
 // pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:11: Error: This requires the experimental 'inline-class' language feature to be enabled.
 // Try passing the '--enable-experiment=inline-class' command line option.
 // extension type E on A {} // Error because of 'type'.
 //           ^^^^
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:21: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension type E on A {} // Error because of 'type'.
-//                     ^
-//
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:21: Error: 'A' is already declared in this scope.
-// extension type E on A {} // Error because of 'type'.
-//                     ^
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:7:7: Context: Previous declaration of 'A'.
-// class A {}
-//       ^
-//
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Type 'on' not found.
-// extension type E on A {} // Error because of 'type'.
-//                  ^^
-//
 import self as self;
 import "dart:core" as core;
 
diff --git a/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.transformed.expect b/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.transformed.expect
index 56aa526..ed5eed8 100644
--- a/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart.weak.transformed.expect
@@ -7,32 +7,20 @@
 // extension type E on A {} // Error because of 'type'.
 //                ^
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:16: Error: A extension type declaration must have a body, even if it is empty.
-// Try adding an empty body.
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Expected 'extends' instead of this.
 // extension type E on A {} // Error because of 'type'.
-//                ^
+//                  ^^
+//
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type E on A {} // Error because of 'type'.
+//                  ^^
 //
 // pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:11: Error: This requires the experimental 'inline-class' language feature to be enabled.
 // Try passing the '--enable-experiment=inline-class' command line option.
 // extension type E on A {} // Error because of 'type'.
 //           ^^^^
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:21: Error: A function declaration needs an explicit list of parameters.
-// Try adding a parameter list to the function declaration.
-// extension type E on A {} // Error because of 'type'.
-//                     ^
-//
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:21: Error: 'A' is already declared in this scope.
-// extension type E on A {} // Error because of 'type'.
-//                     ^
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:7:7: Context: Previous declaration of 'A'.
-// class A {}
-//       ^
-//
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Type 'on' not found.
-// extension type E on A {} // Error because of 'type'.
-//                  ^^
-//
 import self as self;
 import "dart:core" as core;
 
diff --git a/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart
new file mode 100644
index 0000000..856cd32
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2023, 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.
+
+class Foo {}
+class Bar {}
+class Baz {}
+class Boz {}
+class BarBaz implements BarBaz {}
+class BarBoz implements BarBoz {}
+
+extension type ET1(int i) extends Foo {}
+extension type ET2(int i) with Foo {}
+extension type ET3(int i) with Foo, Bar {}
+extension type ET4(int i) extends Foo with Bar {}
+extension type ET5(int i) extends Foo with Bar, Baz {}
+extension type ET6(Bar i) extends Foo implements Bar {}
+extension type ET7(Bar i) with Foo implements Bar {}
+extension type ET8(Baz i) with Foo, Bar implements Baz {}
+extension type ET9(Baz i) extends Foo with Bar implements Baz {}
+extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {}
+extension type ET11(Bar i) implements Bar extends Foo {}
+extension type ET12(Bar i) implements Bar with Foo {}
+extension type ET13(Bar i) implements Bar with Foo, Bar {}
+extension type ET14(Bar i) implements Bar extends Foo with Bar {}
+extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {}
+extension type ET16(Bar i) implements Bar extends Foo implements Bar {}
+extension type ET17(Bar i) implements Bar with Foo implements Bar {}
+extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+extension type ET21(Boz i) implements Bar implements Boz {}
+extension type ET22(int i) extends Bar extends Boz {}
+extension type ET23(int i) extends Bar, Boz {}
diff --git a/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.strong.expect b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.strong.expect
new file mode 100644
index 0000000..5e5c203
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.strong.expect
@@ -0,0 +1,488 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:12:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET1(int i) extends Foo {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:13:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET2(int i) with Foo {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:14:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET3(int i) with Foo, Bar {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:15:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET4(int i) extends Foo with Bar {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:15:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET4(int i) extends Foo with Bar {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:16:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET5(int i) extends Foo with Bar, Baz {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:16:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET5(int i) extends Foo with Bar, Baz {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:17:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET6(Bar i) extends Foo implements Bar {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:18:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET7(Bar i) with Foo implements Bar {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:19:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET8(Baz i) with Foo, Bar implements Baz {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:20:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET9(Baz i) extends Foo with Bar implements Baz {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:20:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET9(Baz i) extends Foo with Bar implements Baz {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:21:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:21:40: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {}
+//                                        ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:22:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET11(Bar i) implements Bar extends Foo {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:23:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET12(Bar i) implements Bar with Foo {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:24:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET13(Bar i) implements Bar with Foo, Bar {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:25:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET14(Bar i) implements Bar extends Foo with Bar {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:25:55: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET14(Bar i) implements Bar extends Foo with Bar {}
+//                                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:26:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:26:55: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {}
+//                                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:27:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET16(Bar i) implements Bar extends Foo implements Bar {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:27:55: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET16(Bar i) implements Bar extends Foo implements Bar {}
+//                                                       ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:28:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET17(Bar i) implements Bar with Foo implements Bar {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:28:52: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET17(Bar i) implements Bar with Foo implements Bar {}
+//                                                    ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:46: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                              ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:60: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                                            ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:46: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                              ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:58: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                                          ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:67: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                                                   ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:46: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                              ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:58: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                                          ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:72: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                                                        ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:32:43: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET21(Boz i) implements Bar implements Boz {}
+//                                           ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:33:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET22(int i) extends Bar extends Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:33:40: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET22(int i) extends Bar extends Boz {}
+//                                        ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:34:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET23(int i) extends Bar, Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:9:7: Error: 'BarBaz' is a supertype of itself.
+// class BarBaz implements BarBaz {}
+//       ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:10:7: Error: 'BarBoz' is a supertype of itself.
+// class BarBoz implements BarBoz {}
+//       ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET18'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET19'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET20'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:32:39: Error: The implemented interface 'Bar' must be a supertype of the representation type 'Boz' of extension type 'ET21'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'Boz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'Boz' or the representation type to a subtype of 'Bar'.
+// extension type ET21(Boz i) implements Bar implements Boz {}
+//                                       ^
+//
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+  synthetic constructor •() → self::Foo
+    : super core::Object::•()
+    ;
+}
+class Bar extends core::Object {
+  synthetic constructor •() → self::Bar
+    : super core::Object::•()
+    ;
+}
+class Baz extends core::Object {
+  synthetic constructor •() → self::Baz
+    : super core::Object::•()
+    ;
+}
+class Boz extends core::Object {
+  synthetic constructor •() → self::Boz
+    : super core::Object::•()
+    ;
+}
+class BarBaz extends core::Object {
+  synthetic constructor •() → self::BarBaz
+    : super core::Object::•()
+    ;
+}
+class BarBoz extends core::Object {
+  synthetic constructor •() → self::BarBoz
+    : super core::Object::•()
+    ;
+}
+extension type ET1(core::int i) {
+  constructor • = self::ET1|;
+  tearoff • = self::ET1|_#new#tearOff;
+}
+extension type ET2(core::int i) {
+  constructor • = self::ET2|;
+  tearoff • = self::ET2|_#new#tearOff;
+}
+extension type ET3(core::int i) {
+  constructor • = self::ET3|;
+  tearoff • = self::ET3|_#new#tearOff;
+}
+extension type ET4(core::int i) {
+  constructor • = self::ET4|;
+  tearoff • = self::ET4|_#new#tearOff;
+}
+extension type ET5(core::int i) {
+  constructor • = self::ET5|;
+  tearoff • = self::ET5|_#new#tearOff;
+}
+extension type ET6(self::Bar i) {
+  constructor • = self::ET6|;
+  tearoff • = self::ET6|_#new#tearOff;
+}
+extension type ET7(self::Bar i) {
+  constructor • = self::ET7|;
+  tearoff • = self::ET7|_#new#tearOff;
+}
+extension type ET8(self::Baz i) {
+  constructor • = self::ET8|;
+  tearoff • = self::ET8|_#new#tearOff;
+}
+extension type ET9(self::Baz i) {
+  constructor • = self::ET9|;
+  tearoff • = self::ET9|_#new#tearOff;
+}
+extension type ET10(self::Boz i) {
+  constructor • = self::ET10|;
+  tearoff • = self::ET10|_#new#tearOff;
+}
+extension type ET11(self::Bar i) implements self::Bar {
+  constructor • = self::ET11|;
+  tearoff • = self::ET11|_#new#tearOff;
+}
+extension type ET12(self::Bar i) implements self::Bar {
+  constructor • = self::ET12|;
+  tearoff • = self::ET12|_#new#tearOff;
+}
+extension type ET13(self::Bar i) implements self::Bar {
+  constructor • = self::ET13|;
+  tearoff • = self::ET13|_#new#tearOff;
+}
+extension type ET14(self::Bar i) implements self::Bar {
+  constructor • = self::ET14|;
+  tearoff • = self::ET14|_#new#tearOff;
+}
+extension type ET15(self::Bar i) implements self::Bar {
+  constructor • = self::ET15|;
+  tearoff • = self::ET15|_#new#tearOff;
+}
+extension type ET16(self::Bar i) implements self::Bar {
+  constructor • = self::ET16|;
+  tearoff • = self::ET16|_#new#tearOff;
+}
+extension type ET17(self::Bar i) implements self::Bar {
+  constructor • = self::ET17|;
+  tearoff • = self::ET17|_#new#tearOff;
+}
+extension type ET18(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET18|;
+  tearoff • = self::ET18|_#new#tearOff;
+}
+extension type ET19(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET19|;
+  tearoff • = self::ET19|_#new#tearOff;
+}
+extension type ET20(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET20|;
+  tearoff • = self::ET20|_#new#tearOff;
+}
+extension type ET21(self::Boz i) implements self::Bar {
+  constructor • = self::ET21|;
+  tearoff • = self::ET21|_#new#tearOff;
+}
+extension type ET22(core::int i) {
+  constructor • = self::ET22|;
+  tearoff • = self::ET22|_#new#tearOff;
+}
+extension type ET23(core::int i) {
+  constructor • = self::ET23|;
+  tearoff • = self::ET23|_#new#tearOff;
+}
+static inline-class-member method ET1|(core::int i) → self::ET1 /* = core::int */ {
+  lowered final self::ET1 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET1|_#new#tearOff(core::int i) → self::ET1 /* = core::int */
+  return self::ET1|(i);
+static inline-class-member method ET2|(core::int i) → self::ET2 /* = core::int */ {
+  lowered final self::ET2 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET2|_#new#tearOff(core::int i) → self::ET2 /* = core::int */
+  return self::ET2|(i);
+static inline-class-member method ET3|(core::int i) → self::ET3 /* = core::int */ {
+  lowered final self::ET3 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET3|_#new#tearOff(core::int i) → self::ET3 /* = core::int */
+  return self::ET3|(i);
+static inline-class-member method ET4|(core::int i) → self::ET4 /* = core::int */ {
+  lowered final self::ET4 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET4|_#new#tearOff(core::int i) → self::ET4 /* = core::int */
+  return self::ET4|(i);
+static inline-class-member method ET5|(core::int i) → self::ET5 /* = core::int */ {
+  lowered final self::ET5 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET5|_#new#tearOff(core::int i) → self::ET5 /* = core::int */
+  return self::ET5|(i);
+static inline-class-member method ET6|(self::Bar i) → self::ET6 /* = self::Bar */ {
+  lowered final self::ET6 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET6|_#new#tearOff(self::Bar i) → self::ET6 /* = self::Bar */
+  return self::ET6|(i);
+static inline-class-member method ET7|(self::Bar i) → self::ET7 /* = self::Bar */ {
+  lowered final self::ET7 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET7|_#new#tearOff(self::Bar i) → self::ET7 /* = self::Bar */
+  return self::ET7|(i);
+static inline-class-member method ET8|_#new#tearOff(self::Baz i) → self::ET8 /* = self::Baz */
+  return self::ET8|(i);
+static inline-class-member method ET8|(self::Baz i) → self::ET8 /* = self::Baz */ {
+  lowered final self::ET8 /* = self::Baz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET9|(self::Baz i) → self::ET9 /* = self::Baz */ {
+  lowered final self::ET9 /* = self::Baz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET9|_#new#tearOff(self::Baz i) → self::ET9 /* = self::Baz */
+  return self::ET9|(i);
+static inline-class-member method ET10|(self::Boz i) → self::ET10 /* = self::Boz */ {
+  lowered final self::ET10 /* = self::Boz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET10|_#new#tearOff(self::Boz i) → self::ET10 /* = self::Boz */
+  return self::ET10|(i);
+static inline-class-member method ET11|(self::Bar i) → self::ET11 /* = self::Bar */ {
+  lowered final self::ET11 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET11|_#new#tearOff(self::Bar i) → self::ET11 /* = self::Bar */
+  return self::ET11|(i);
+static inline-class-member method ET12|(self::Bar i) → self::ET12 /* = self::Bar */ {
+  lowered final self::ET12 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET12|_#new#tearOff(self::Bar i) → self::ET12 /* = self::Bar */
+  return self::ET12|(i);
+static inline-class-member method ET13|(self::Bar i) → self::ET13 /* = self::Bar */ {
+  lowered final self::ET13 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET13|_#new#tearOff(self::Bar i) → self::ET13 /* = self::Bar */
+  return self::ET13|(i);
+static inline-class-member method ET14|(self::Bar i) → self::ET14 /* = self::Bar */ {
+  lowered final self::ET14 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET14|_#new#tearOff(self::Bar i) → self::ET14 /* = self::Bar */
+  return self::ET14|(i);
+static inline-class-member method ET15|(self::Bar i) → self::ET15 /* = self::Bar */ {
+  lowered final self::ET15 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET15|_#new#tearOff(self::Bar i) → self::ET15 /* = self::Bar */
+  return self::ET15|(i);
+static inline-class-member method ET16|(self::Bar i) → self::ET16 /* = self::Bar */ {
+  lowered final self::ET16 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET16|_#new#tearOff(self::Bar i) → self::ET16 /* = self::Bar */
+  return self::ET16|(i);
+static inline-class-member method ET17|(self::Bar i) → self::ET17 /* = self::Bar */ {
+  lowered final self::ET17 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET17|_#new#tearOff(self::Bar i) → self::ET17 /* = self::Bar */
+  return self::ET17|(i);
+static inline-class-member method ET18|(self::BarBaz i) → self::ET18 /* = self::BarBaz */ {
+  lowered final self::ET18 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET18|_#new#tearOff(self::BarBaz i) → self::ET18 /* = self::BarBaz */
+  return self::ET18|(i);
+static inline-class-member method ET19|(self::BarBaz i) → self::ET19 /* = self::BarBaz */ {
+  lowered final self::ET19 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET19|_#new#tearOff(self::BarBaz i) → self::ET19 /* = self::BarBaz */
+  return self::ET19|(i);
+static inline-class-member method ET20|(self::BarBaz i) → self::ET20 /* = self::BarBaz */ {
+  lowered final self::ET20 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET20|_#new#tearOff(self::BarBaz i) → self::ET20 /* = self::BarBaz */
+  return self::ET20|(i);
+static inline-class-member method ET21|(self::Boz i) → self::ET21 /* = self::Boz */ {
+  lowered final self::ET21 /* = self::Boz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET21|_#new#tearOff(self::Boz i) → self::ET21 /* = self::Boz */
+  return self::ET21|(i);
+static inline-class-member method ET22|(core::int i) → self::ET22 /* = core::int */ {
+  lowered final self::ET22 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET22|_#new#tearOff(core::int i) → self::ET22 /* = core::int */
+  return self::ET22|(i);
+static inline-class-member method ET23|(core::int i) → self::ET23 /* = core::int */ {
+  lowered final self::ET23 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET23|_#new#tearOff(core::int i) → self::ET23 /* = core::int */
+  return self::ET23|(i);
diff --git a/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.strong.transformed.expect b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.strong.transformed.expect
new file mode 100644
index 0000000..5e5c203
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.strong.transformed.expect
@@ -0,0 +1,488 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:12:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET1(int i) extends Foo {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:13:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET2(int i) with Foo {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:14:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET3(int i) with Foo, Bar {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:15:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET4(int i) extends Foo with Bar {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:15:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET4(int i) extends Foo with Bar {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:16:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET5(int i) extends Foo with Bar, Baz {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:16:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET5(int i) extends Foo with Bar, Baz {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:17:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET6(Bar i) extends Foo implements Bar {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:18:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET7(Bar i) with Foo implements Bar {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:19:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET8(Baz i) with Foo, Bar implements Baz {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:20:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET9(Baz i) extends Foo with Bar implements Baz {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:20:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET9(Baz i) extends Foo with Bar implements Baz {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:21:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:21:40: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {}
+//                                        ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:22:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET11(Bar i) implements Bar extends Foo {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:23:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET12(Bar i) implements Bar with Foo {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:24:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET13(Bar i) implements Bar with Foo, Bar {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:25:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET14(Bar i) implements Bar extends Foo with Bar {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:25:55: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET14(Bar i) implements Bar extends Foo with Bar {}
+//                                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:26:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:26:55: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {}
+//                                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:27:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET16(Bar i) implements Bar extends Foo implements Bar {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:27:55: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET16(Bar i) implements Bar extends Foo implements Bar {}
+//                                                       ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:28:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET17(Bar i) implements Bar with Foo implements Bar {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:28:52: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET17(Bar i) implements Bar with Foo implements Bar {}
+//                                                    ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:46: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                              ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:60: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                                            ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:46: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                              ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:58: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                                          ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:67: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                                                   ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:46: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                              ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:58: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                                          ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:72: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                                                        ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:32:43: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET21(Boz i) implements Bar implements Boz {}
+//                                           ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:33:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET22(int i) extends Bar extends Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:33:40: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET22(int i) extends Bar extends Boz {}
+//                                        ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:34:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET23(int i) extends Bar, Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:9:7: Error: 'BarBaz' is a supertype of itself.
+// class BarBaz implements BarBaz {}
+//       ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:10:7: Error: 'BarBoz' is a supertype of itself.
+// class BarBoz implements BarBoz {}
+//       ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET18'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET19'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET20'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:32:39: Error: The implemented interface 'Bar' must be a supertype of the representation type 'Boz' of extension type 'ET21'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'Boz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'Boz' or the representation type to a subtype of 'Bar'.
+// extension type ET21(Boz i) implements Bar implements Boz {}
+//                                       ^
+//
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+  synthetic constructor •() → self::Foo
+    : super core::Object::•()
+    ;
+}
+class Bar extends core::Object {
+  synthetic constructor •() → self::Bar
+    : super core::Object::•()
+    ;
+}
+class Baz extends core::Object {
+  synthetic constructor •() → self::Baz
+    : super core::Object::•()
+    ;
+}
+class Boz extends core::Object {
+  synthetic constructor •() → self::Boz
+    : super core::Object::•()
+    ;
+}
+class BarBaz extends core::Object {
+  synthetic constructor •() → self::BarBaz
+    : super core::Object::•()
+    ;
+}
+class BarBoz extends core::Object {
+  synthetic constructor •() → self::BarBoz
+    : super core::Object::•()
+    ;
+}
+extension type ET1(core::int i) {
+  constructor • = self::ET1|;
+  tearoff • = self::ET1|_#new#tearOff;
+}
+extension type ET2(core::int i) {
+  constructor • = self::ET2|;
+  tearoff • = self::ET2|_#new#tearOff;
+}
+extension type ET3(core::int i) {
+  constructor • = self::ET3|;
+  tearoff • = self::ET3|_#new#tearOff;
+}
+extension type ET4(core::int i) {
+  constructor • = self::ET4|;
+  tearoff • = self::ET4|_#new#tearOff;
+}
+extension type ET5(core::int i) {
+  constructor • = self::ET5|;
+  tearoff • = self::ET5|_#new#tearOff;
+}
+extension type ET6(self::Bar i) {
+  constructor • = self::ET6|;
+  tearoff • = self::ET6|_#new#tearOff;
+}
+extension type ET7(self::Bar i) {
+  constructor • = self::ET7|;
+  tearoff • = self::ET7|_#new#tearOff;
+}
+extension type ET8(self::Baz i) {
+  constructor • = self::ET8|;
+  tearoff • = self::ET8|_#new#tearOff;
+}
+extension type ET9(self::Baz i) {
+  constructor • = self::ET9|;
+  tearoff • = self::ET9|_#new#tearOff;
+}
+extension type ET10(self::Boz i) {
+  constructor • = self::ET10|;
+  tearoff • = self::ET10|_#new#tearOff;
+}
+extension type ET11(self::Bar i) implements self::Bar {
+  constructor • = self::ET11|;
+  tearoff • = self::ET11|_#new#tearOff;
+}
+extension type ET12(self::Bar i) implements self::Bar {
+  constructor • = self::ET12|;
+  tearoff • = self::ET12|_#new#tearOff;
+}
+extension type ET13(self::Bar i) implements self::Bar {
+  constructor • = self::ET13|;
+  tearoff • = self::ET13|_#new#tearOff;
+}
+extension type ET14(self::Bar i) implements self::Bar {
+  constructor • = self::ET14|;
+  tearoff • = self::ET14|_#new#tearOff;
+}
+extension type ET15(self::Bar i) implements self::Bar {
+  constructor • = self::ET15|;
+  tearoff • = self::ET15|_#new#tearOff;
+}
+extension type ET16(self::Bar i) implements self::Bar {
+  constructor • = self::ET16|;
+  tearoff • = self::ET16|_#new#tearOff;
+}
+extension type ET17(self::Bar i) implements self::Bar {
+  constructor • = self::ET17|;
+  tearoff • = self::ET17|_#new#tearOff;
+}
+extension type ET18(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET18|;
+  tearoff • = self::ET18|_#new#tearOff;
+}
+extension type ET19(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET19|;
+  tearoff • = self::ET19|_#new#tearOff;
+}
+extension type ET20(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET20|;
+  tearoff • = self::ET20|_#new#tearOff;
+}
+extension type ET21(self::Boz i) implements self::Bar {
+  constructor • = self::ET21|;
+  tearoff • = self::ET21|_#new#tearOff;
+}
+extension type ET22(core::int i) {
+  constructor • = self::ET22|;
+  tearoff • = self::ET22|_#new#tearOff;
+}
+extension type ET23(core::int i) {
+  constructor • = self::ET23|;
+  tearoff • = self::ET23|_#new#tearOff;
+}
+static inline-class-member method ET1|(core::int i) → self::ET1 /* = core::int */ {
+  lowered final self::ET1 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET1|_#new#tearOff(core::int i) → self::ET1 /* = core::int */
+  return self::ET1|(i);
+static inline-class-member method ET2|(core::int i) → self::ET2 /* = core::int */ {
+  lowered final self::ET2 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET2|_#new#tearOff(core::int i) → self::ET2 /* = core::int */
+  return self::ET2|(i);
+static inline-class-member method ET3|(core::int i) → self::ET3 /* = core::int */ {
+  lowered final self::ET3 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET3|_#new#tearOff(core::int i) → self::ET3 /* = core::int */
+  return self::ET3|(i);
+static inline-class-member method ET4|(core::int i) → self::ET4 /* = core::int */ {
+  lowered final self::ET4 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET4|_#new#tearOff(core::int i) → self::ET4 /* = core::int */
+  return self::ET4|(i);
+static inline-class-member method ET5|(core::int i) → self::ET5 /* = core::int */ {
+  lowered final self::ET5 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET5|_#new#tearOff(core::int i) → self::ET5 /* = core::int */
+  return self::ET5|(i);
+static inline-class-member method ET6|(self::Bar i) → self::ET6 /* = self::Bar */ {
+  lowered final self::ET6 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET6|_#new#tearOff(self::Bar i) → self::ET6 /* = self::Bar */
+  return self::ET6|(i);
+static inline-class-member method ET7|(self::Bar i) → self::ET7 /* = self::Bar */ {
+  lowered final self::ET7 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET7|_#new#tearOff(self::Bar i) → self::ET7 /* = self::Bar */
+  return self::ET7|(i);
+static inline-class-member method ET8|_#new#tearOff(self::Baz i) → self::ET8 /* = self::Baz */
+  return self::ET8|(i);
+static inline-class-member method ET8|(self::Baz i) → self::ET8 /* = self::Baz */ {
+  lowered final self::ET8 /* = self::Baz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET9|(self::Baz i) → self::ET9 /* = self::Baz */ {
+  lowered final self::ET9 /* = self::Baz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET9|_#new#tearOff(self::Baz i) → self::ET9 /* = self::Baz */
+  return self::ET9|(i);
+static inline-class-member method ET10|(self::Boz i) → self::ET10 /* = self::Boz */ {
+  lowered final self::ET10 /* = self::Boz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET10|_#new#tearOff(self::Boz i) → self::ET10 /* = self::Boz */
+  return self::ET10|(i);
+static inline-class-member method ET11|(self::Bar i) → self::ET11 /* = self::Bar */ {
+  lowered final self::ET11 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET11|_#new#tearOff(self::Bar i) → self::ET11 /* = self::Bar */
+  return self::ET11|(i);
+static inline-class-member method ET12|(self::Bar i) → self::ET12 /* = self::Bar */ {
+  lowered final self::ET12 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET12|_#new#tearOff(self::Bar i) → self::ET12 /* = self::Bar */
+  return self::ET12|(i);
+static inline-class-member method ET13|(self::Bar i) → self::ET13 /* = self::Bar */ {
+  lowered final self::ET13 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET13|_#new#tearOff(self::Bar i) → self::ET13 /* = self::Bar */
+  return self::ET13|(i);
+static inline-class-member method ET14|(self::Bar i) → self::ET14 /* = self::Bar */ {
+  lowered final self::ET14 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET14|_#new#tearOff(self::Bar i) → self::ET14 /* = self::Bar */
+  return self::ET14|(i);
+static inline-class-member method ET15|(self::Bar i) → self::ET15 /* = self::Bar */ {
+  lowered final self::ET15 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET15|_#new#tearOff(self::Bar i) → self::ET15 /* = self::Bar */
+  return self::ET15|(i);
+static inline-class-member method ET16|(self::Bar i) → self::ET16 /* = self::Bar */ {
+  lowered final self::ET16 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET16|_#new#tearOff(self::Bar i) → self::ET16 /* = self::Bar */
+  return self::ET16|(i);
+static inline-class-member method ET17|(self::Bar i) → self::ET17 /* = self::Bar */ {
+  lowered final self::ET17 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET17|_#new#tearOff(self::Bar i) → self::ET17 /* = self::Bar */
+  return self::ET17|(i);
+static inline-class-member method ET18|(self::BarBaz i) → self::ET18 /* = self::BarBaz */ {
+  lowered final self::ET18 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET18|_#new#tearOff(self::BarBaz i) → self::ET18 /* = self::BarBaz */
+  return self::ET18|(i);
+static inline-class-member method ET19|(self::BarBaz i) → self::ET19 /* = self::BarBaz */ {
+  lowered final self::ET19 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET19|_#new#tearOff(self::BarBaz i) → self::ET19 /* = self::BarBaz */
+  return self::ET19|(i);
+static inline-class-member method ET20|(self::BarBaz i) → self::ET20 /* = self::BarBaz */ {
+  lowered final self::ET20 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET20|_#new#tearOff(self::BarBaz i) → self::ET20 /* = self::BarBaz */
+  return self::ET20|(i);
+static inline-class-member method ET21|(self::Boz i) → self::ET21 /* = self::Boz */ {
+  lowered final self::ET21 /* = self::Boz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET21|_#new#tearOff(self::Boz i) → self::ET21 /* = self::Boz */
+  return self::ET21|(i);
+static inline-class-member method ET22|(core::int i) → self::ET22 /* = core::int */ {
+  lowered final self::ET22 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET22|_#new#tearOff(core::int i) → self::ET22 /* = core::int */
+  return self::ET22|(i);
+static inline-class-member method ET23|(core::int i) → self::ET23 /* = core::int */ {
+  lowered final self::ET23 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET23|_#new#tearOff(core::int i) → self::ET23 /* = core::int */
+  return self::ET23|(i);
diff --git a/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.textual_outline.expect b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.textual_outline.expect
new file mode 100644
index 0000000..f2b8a45
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.textual_outline.expect
@@ -0,0 +1,7 @@
+class Foo {}
+class Bar {}
+class Baz {}
+class Boz {}
+class BarBaz implements BarBaz {}
+class BarBoz implements BarBoz {}
+extension type ET1(int i) extends Foo {} extension type ET2(int i) with Foo {} extension type ET3(int i) with Foo, Bar {} extension type ET4(int i) extends Foo with Bar {} extension type ET5(int i) extends Foo with Bar, Baz {} extension type ET6(Bar i) extends Foo implements Bar {} extension type ET7(Bar i) with Foo implements Bar {} extension type ET8(Baz i) with Foo, Bar implements Baz {} extension type ET9(Baz i) extends Foo with Bar implements Baz {} extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {} extension type ET11(Bar i) implements Bar extends Foo {} extension type ET12(Bar i) implements Bar with Foo {} extension type ET13(Bar i) implements Bar with Foo, Bar {} extension type ET14(Bar i) implements Bar extends Foo with Bar {} extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {} extension type ET16(Bar i) implements Bar extends Foo implements Bar {} extension type ET17(Bar i) implements Bar with Foo implements Bar {} extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {} extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {} extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {} extension type ET21(Boz i) implements Bar implements Boz {} extension type ET22(int i) extends Bar extends Boz {} extension type ET23(int i) extends Bar, Boz {}
diff --git a/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..2700c3b
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.textual_outline_modelled.expect
@@ -0,0 +1,9 @@
+class Bar {}
+class BarBaz implements BarBaz {}
+class BarBoz implements BarBoz {}
+class Baz {}
+class Boz {}
+class Foo {}
+---- unknown chunk starts ----
+extension type ET1(int i) extends Foo {} extension type ET2(int i) with Foo {} extension type ET3(int i) with Foo, Bar {} extension type ET4(int i) extends Foo with Bar {} extension type ET5(int i) extends Foo with Bar, Baz {} extension type ET6(Bar i) extends Foo implements Bar {} extension type ET7(Bar i) with Foo implements Bar {} extension type ET8(Baz i) with Foo, Bar implements Baz {} extension type ET9(Baz i) extends Foo with Bar implements Baz {} extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {} extension type ET11(Bar i) implements Bar extends Foo {} extension type ET12(Bar i) implements Bar with Foo {} extension type ET13(Bar i) implements Bar with Foo, Bar {} extension type ET14(Bar i) implements Bar extends Foo with Bar {} extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {} extension type ET16(Bar i) implements Bar extends Foo implements Bar {} extension type ET17(Bar i) implements Bar with Foo implements Bar {} extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {} extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {} extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {} extension type ET21(Boz i) implements Bar implements Boz {} extension type ET22(int i) extends Bar extends Boz {} extension type ET23(int i) extends Bar, Boz {}
+---- unknown chunk ends ----
diff --git a/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.weak.expect b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.weak.expect
new file mode 100644
index 0000000..5e5c203
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.weak.expect
@@ -0,0 +1,488 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:12:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET1(int i) extends Foo {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:13:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET2(int i) with Foo {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:14:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET3(int i) with Foo, Bar {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:15:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET4(int i) extends Foo with Bar {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:15:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET4(int i) extends Foo with Bar {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:16:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET5(int i) extends Foo with Bar, Baz {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:16:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET5(int i) extends Foo with Bar, Baz {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:17:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET6(Bar i) extends Foo implements Bar {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:18:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET7(Bar i) with Foo implements Bar {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:19:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET8(Baz i) with Foo, Bar implements Baz {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:20:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET9(Baz i) extends Foo with Bar implements Baz {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:20:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET9(Baz i) extends Foo with Bar implements Baz {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:21:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:21:40: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {}
+//                                        ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:22:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET11(Bar i) implements Bar extends Foo {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:23:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET12(Bar i) implements Bar with Foo {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:24:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET13(Bar i) implements Bar with Foo, Bar {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:25:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET14(Bar i) implements Bar extends Foo with Bar {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:25:55: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET14(Bar i) implements Bar extends Foo with Bar {}
+//                                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:26:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:26:55: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {}
+//                                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:27:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET16(Bar i) implements Bar extends Foo implements Bar {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:27:55: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET16(Bar i) implements Bar extends Foo implements Bar {}
+//                                                       ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:28:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET17(Bar i) implements Bar with Foo implements Bar {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:28:52: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET17(Bar i) implements Bar with Foo implements Bar {}
+//                                                    ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:46: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                              ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:60: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                                            ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:46: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                              ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:58: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                                          ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:67: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                                                   ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:46: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                              ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:58: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                                          ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:72: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                                                        ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:32:43: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET21(Boz i) implements Bar implements Boz {}
+//                                           ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:33:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET22(int i) extends Bar extends Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:33:40: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET22(int i) extends Bar extends Boz {}
+//                                        ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:34:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET23(int i) extends Bar, Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:9:7: Error: 'BarBaz' is a supertype of itself.
+// class BarBaz implements BarBaz {}
+//       ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:10:7: Error: 'BarBoz' is a supertype of itself.
+// class BarBoz implements BarBoz {}
+//       ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET18'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET19'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET20'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:32:39: Error: The implemented interface 'Bar' must be a supertype of the representation type 'Boz' of extension type 'ET21'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'Boz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'Boz' or the representation type to a subtype of 'Bar'.
+// extension type ET21(Boz i) implements Bar implements Boz {}
+//                                       ^
+//
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+  synthetic constructor •() → self::Foo
+    : super core::Object::•()
+    ;
+}
+class Bar extends core::Object {
+  synthetic constructor •() → self::Bar
+    : super core::Object::•()
+    ;
+}
+class Baz extends core::Object {
+  synthetic constructor •() → self::Baz
+    : super core::Object::•()
+    ;
+}
+class Boz extends core::Object {
+  synthetic constructor •() → self::Boz
+    : super core::Object::•()
+    ;
+}
+class BarBaz extends core::Object {
+  synthetic constructor •() → self::BarBaz
+    : super core::Object::•()
+    ;
+}
+class BarBoz extends core::Object {
+  synthetic constructor •() → self::BarBoz
+    : super core::Object::•()
+    ;
+}
+extension type ET1(core::int i) {
+  constructor • = self::ET1|;
+  tearoff • = self::ET1|_#new#tearOff;
+}
+extension type ET2(core::int i) {
+  constructor • = self::ET2|;
+  tearoff • = self::ET2|_#new#tearOff;
+}
+extension type ET3(core::int i) {
+  constructor • = self::ET3|;
+  tearoff • = self::ET3|_#new#tearOff;
+}
+extension type ET4(core::int i) {
+  constructor • = self::ET4|;
+  tearoff • = self::ET4|_#new#tearOff;
+}
+extension type ET5(core::int i) {
+  constructor • = self::ET5|;
+  tearoff • = self::ET5|_#new#tearOff;
+}
+extension type ET6(self::Bar i) {
+  constructor • = self::ET6|;
+  tearoff • = self::ET6|_#new#tearOff;
+}
+extension type ET7(self::Bar i) {
+  constructor • = self::ET7|;
+  tearoff • = self::ET7|_#new#tearOff;
+}
+extension type ET8(self::Baz i) {
+  constructor • = self::ET8|;
+  tearoff • = self::ET8|_#new#tearOff;
+}
+extension type ET9(self::Baz i) {
+  constructor • = self::ET9|;
+  tearoff • = self::ET9|_#new#tearOff;
+}
+extension type ET10(self::Boz i) {
+  constructor • = self::ET10|;
+  tearoff • = self::ET10|_#new#tearOff;
+}
+extension type ET11(self::Bar i) implements self::Bar {
+  constructor • = self::ET11|;
+  tearoff • = self::ET11|_#new#tearOff;
+}
+extension type ET12(self::Bar i) implements self::Bar {
+  constructor • = self::ET12|;
+  tearoff • = self::ET12|_#new#tearOff;
+}
+extension type ET13(self::Bar i) implements self::Bar {
+  constructor • = self::ET13|;
+  tearoff • = self::ET13|_#new#tearOff;
+}
+extension type ET14(self::Bar i) implements self::Bar {
+  constructor • = self::ET14|;
+  tearoff • = self::ET14|_#new#tearOff;
+}
+extension type ET15(self::Bar i) implements self::Bar {
+  constructor • = self::ET15|;
+  tearoff • = self::ET15|_#new#tearOff;
+}
+extension type ET16(self::Bar i) implements self::Bar {
+  constructor • = self::ET16|;
+  tearoff • = self::ET16|_#new#tearOff;
+}
+extension type ET17(self::Bar i) implements self::Bar {
+  constructor • = self::ET17|;
+  tearoff • = self::ET17|_#new#tearOff;
+}
+extension type ET18(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET18|;
+  tearoff • = self::ET18|_#new#tearOff;
+}
+extension type ET19(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET19|;
+  tearoff • = self::ET19|_#new#tearOff;
+}
+extension type ET20(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET20|;
+  tearoff • = self::ET20|_#new#tearOff;
+}
+extension type ET21(self::Boz i) implements self::Bar {
+  constructor • = self::ET21|;
+  tearoff • = self::ET21|_#new#tearOff;
+}
+extension type ET22(core::int i) {
+  constructor • = self::ET22|;
+  tearoff • = self::ET22|_#new#tearOff;
+}
+extension type ET23(core::int i) {
+  constructor • = self::ET23|;
+  tearoff • = self::ET23|_#new#tearOff;
+}
+static inline-class-member method ET1|(core::int i) → self::ET1 /* = core::int */ {
+  lowered final self::ET1 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET1|_#new#tearOff(core::int i) → self::ET1 /* = core::int */
+  return self::ET1|(i);
+static inline-class-member method ET2|(core::int i) → self::ET2 /* = core::int */ {
+  lowered final self::ET2 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET2|_#new#tearOff(core::int i) → self::ET2 /* = core::int */
+  return self::ET2|(i);
+static inline-class-member method ET3|(core::int i) → self::ET3 /* = core::int */ {
+  lowered final self::ET3 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET3|_#new#tearOff(core::int i) → self::ET3 /* = core::int */
+  return self::ET3|(i);
+static inline-class-member method ET4|(core::int i) → self::ET4 /* = core::int */ {
+  lowered final self::ET4 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET4|_#new#tearOff(core::int i) → self::ET4 /* = core::int */
+  return self::ET4|(i);
+static inline-class-member method ET5|(core::int i) → self::ET5 /* = core::int */ {
+  lowered final self::ET5 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET5|_#new#tearOff(core::int i) → self::ET5 /* = core::int */
+  return self::ET5|(i);
+static inline-class-member method ET6|(self::Bar i) → self::ET6 /* = self::Bar */ {
+  lowered final self::ET6 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET6|_#new#tearOff(self::Bar i) → self::ET6 /* = self::Bar */
+  return self::ET6|(i);
+static inline-class-member method ET7|(self::Bar i) → self::ET7 /* = self::Bar */ {
+  lowered final self::ET7 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET7|_#new#tearOff(self::Bar i) → self::ET7 /* = self::Bar */
+  return self::ET7|(i);
+static inline-class-member method ET8|_#new#tearOff(self::Baz i) → self::ET8 /* = self::Baz */
+  return self::ET8|(i);
+static inline-class-member method ET8|(self::Baz i) → self::ET8 /* = self::Baz */ {
+  lowered final self::ET8 /* = self::Baz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET9|(self::Baz i) → self::ET9 /* = self::Baz */ {
+  lowered final self::ET9 /* = self::Baz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET9|_#new#tearOff(self::Baz i) → self::ET9 /* = self::Baz */
+  return self::ET9|(i);
+static inline-class-member method ET10|(self::Boz i) → self::ET10 /* = self::Boz */ {
+  lowered final self::ET10 /* = self::Boz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET10|_#new#tearOff(self::Boz i) → self::ET10 /* = self::Boz */
+  return self::ET10|(i);
+static inline-class-member method ET11|(self::Bar i) → self::ET11 /* = self::Bar */ {
+  lowered final self::ET11 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET11|_#new#tearOff(self::Bar i) → self::ET11 /* = self::Bar */
+  return self::ET11|(i);
+static inline-class-member method ET12|(self::Bar i) → self::ET12 /* = self::Bar */ {
+  lowered final self::ET12 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET12|_#new#tearOff(self::Bar i) → self::ET12 /* = self::Bar */
+  return self::ET12|(i);
+static inline-class-member method ET13|(self::Bar i) → self::ET13 /* = self::Bar */ {
+  lowered final self::ET13 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET13|_#new#tearOff(self::Bar i) → self::ET13 /* = self::Bar */
+  return self::ET13|(i);
+static inline-class-member method ET14|(self::Bar i) → self::ET14 /* = self::Bar */ {
+  lowered final self::ET14 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET14|_#new#tearOff(self::Bar i) → self::ET14 /* = self::Bar */
+  return self::ET14|(i);
+static inline-class-member method ET15|(self::Bar i) → self::ET15 /* = self::Bar */ {
+  lowered final self::ET15 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET15|_#new#tearOff(self::Bar i) → self::ET15 /* = self::Bar */
+  return self::ET15|(i);
+static inline-class-member method ET16|(self::Bar i) → self::ET16 /* = self::Bar */ {
+  lowered final self::ET16 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET16|_#new#tearOff(self::Bar i) → self::ET16 /* = self::Bar */
+  return self::ET16|(i);
+static inline-class-member method ET17|(self::Bar i) → self::ET17 /* = self::Bar */ {
+  lowered final self::ET17 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET17|_#new#tearOff(self::Bar i) → self::ET17 /* = self::Bar */
+  return self::ET17|(i);
+static inline-class-member method ET18|(self::BarBaz i) → self::ET18 /* = self::BarBaz */ {
+  lowered final self::ET18 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET18|_#new#tearOff(self::BarBaz i) → self::ET18 /* = self::BarBaz */
+  return self::ET18|(i);
+static inline-class-member method ET19|(self::BarBaz i) → self::ET19 /* = self::BarBaz */ {
+  lowered final self::ET19 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET19|_#new#tearOff(self::BarBaz i) → self::ET19 /* = self::BarBaz */
+  return self::ET19|(i);
+static inline-class-member method ET20|(self::BarBaz i) → self::ET20 /* = self::BarBaz */ {
+  lowered final self::ET20 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET20|_#new#tearOff(self::BarBaz i) → self::ET20 /* = self::BarBaz */
+  return self::ET20|(i);
+static inline-class-member method ET21|(self::Boz i) → self::ET21 /* = self::Boz */ {
+  lowered final self::ET21 /* = self::Boz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET21|_#new#tearOff(self::Boz i) → self::ET21 /* = self::Boz */
+  return self::ET21|(i);
+static inline-class-member method ET22|(core::int i) → self::ET22 /* = core::int */ {
+  lowered final self::ET22 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET22|_#new#tearOff(core::int i) → self::ET22 /* = core::int */
+  return self::ET22|(i);
+static inline-class-member method ET23|(core::int i) → self::ET23 /* = core::int */ {
+  lowered final self::ET23 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET23|_#new#tearOff(core::int i) → self::ET23 /* = core::int */
+  return self::ET23|(i);
diff --git a/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.weak.modular.expect b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.weak.modular.expect
new file mode 100644
index 0000000..5e5c203
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.weak.modular.expect
@@ -0,0 +1,488 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:12:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET1(int i) extends Foo {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:13:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET2(int i) with Foo {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:14:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET3(int i) with Foo, Bar {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:15:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET4(int i) extends Foo with Bar {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:15:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET4(int i) extends Foo with Bar {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:16:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET5(int i) extends Foo with Bar, Baz {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:16:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET5(int i) extends Foo with Bar, Baz {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:17:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET6(Bar i) extends Foo implements Bar {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:18:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET7(Bar i) with Foo implements Bar {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:19:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET8(Baz i) with Foo, Bar implements Baz {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:20:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET9(Baz i) extends Foo with Bar implements Baz {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:20:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET9(Baz i) extends Foo with Bar implements Baz {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:21:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:21:40: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {}
+//                                        ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:22:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET11(Bar i) implements Bar extends Foo {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:23:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET12(Bar i) implements Bar with Foo {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:24:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET13(Bar i) implements Bar with Foo, Bar {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:25:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET14(Bar i) implements Bar extends Foo with Bar {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:25:55: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET14(Bar i) implements Bar extends Foo with Bar {}
+//                                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:26:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:26:55: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {}
+//                                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:27:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET16(Bar i) implements Bar extends Foo implements Bar {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:27:55: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET16(Bar i) implements Bar extends Foo implements Bar {}
+//                                                       ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:28:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET17(Bar i) implements Bar with Foo implements Bar {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:28:52: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET17(Bar i) implements Bar with Foo implements Bar {}
+//                                                    ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:46: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                              ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:60: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                                            ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:46: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                              ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:58: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                                          ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:67: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                                                   ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:46: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                              ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:58: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                                          ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:72: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                                                        ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:32:43: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET21(Boz i) implements Bar implements Boz {}
+//                                           ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:33:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET22(int i) extends Bar extends Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:33:40: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET22(int i) extends Bar extends Boz {}
+//                                        ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:34:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET23(int i) extends Bar, Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:9:7: Error: 'BarBaz' is a supertype of itself.
+// class BarBaz implements BarBaz {}
+//       ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:10:7: Error: 'BarBoz' is a supertype of itself.
+// class BarBoz implements BarBoz {}
+//       ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET18'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET19'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET20'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:32:39: Error: The implemented interface 'Bar' must be a supertype of the representation type 'Boz' of extension type 'ET21'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'Boz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'Boz' or the representation type to a subtype of 'Bar'.
+// extension type ET21(Boz i) implements Bar implements Boz {}
+//                                       ^
+//
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+  synthetic constructor •() → self::Foo
+    : super core::Object::•()
+    ;
+}
+class Bar extends core::Object {
+  synthetic constructor •() → self::Bar
+    : super core::Object::•()
+    ;
+}
+class Baz extends core::Object {
+  synthetic constructor •() → self::Baz
+    : super core::Object::•()
+    ;
+}
+class Boz extends core::Object {
+  synthetic constructor •() → self::Boz
+    : super core::Object::•()
+    ;
+}
+class BarBaz extends core::Object {
+  synthetic constructor •() → self::BarBaz
+    : super core::Object::•()
+    ;
+}
+class BarBoz extends core::Object {
+  synthetic constructor •() → self::BarBoz
+    : super core::Object::•()
+    ;
+}
+extension type ET1(core::int i) {
+  constructor • = self::ET1|;
+  tearoff • = self::ET1|_#new#tearOff;
+}
+extension type ET2(core::int i) {
+  constructor • = self::ET2|;
+  tearoff • = self::ET2|_#new#tearOff;
+}
+extension type ET3(core::int i) {
+  constructor • = self::ET3|;
+  tearoff • = self::ET3|_#new#tearOff;
+}
+extension type ET4(core::int i) {
+  constructor • = self::ET4|;
+  tearoff • = self::ET4|_#new#tearOff;
+}
+extension type ET5(core::int i) {
+  constructor • = self::ET5|;
+  tearoff • = self::ET5|_#new#tearOff;
+}
+extension type ET6(self::Bar i) {
+  constructor • = self::ET6|;
+  tearoff • = self::ET6|_#new#tearOff;
+}
+extension type ET7(self::Bar i) {
+  constructor • = self::ET7|;
+  tearoff • = self::ET7|_#new#tearOff;
+}
+extension type ET8(self::Baz i) {
+  constructor • = self::ET8|;
+  tearoff • = self::ET8|_#new#tearOff;
+}
+extension type ET9(self::Baz i) {
+  constructor • = self::ET9|;
+  tearoff • = self::ET9|_#new#tearOff;
+}
+extension type ET10(self::Boz i) {
+  constructor • = self::ET10|;
+  tearoff • = self::ET10|_#new#tearOff;
+}
+extension type ET11(self::Bar i) implements self::Bar {
+  constructor • = self::ET11|;
+  tearoff • = self::ET11|_#new#tearOff;
+}
+extension type ET12(self::Bar i) implements self::Bar {
+  constructor • = self::ET12|;
+  tearoff • = self::ET12|_#new#tearOff;
+}
+extension type ET13(self::Bar i) implements self::Bar {
+  constructor • = self::ET13|;
+  tearoff • = self::ET13|_#new#tearOff;
+}
+extension type ET14(self::Bar i) implements self::Bar {
+  constructor • = self::ET14|;
+  tearoff • = self::ET14|_#new#tearOff;
+}
+extension type ET15(self::Bar i) implements self::Bar {
+  constructor • = self::ET15|;
+  tearoff • = self::ET15|_#new#tearOff;
+}
+extension type ET16(self::Bar i) implements self::Bar {
+  constructor • = self::ET16|;
+  tearoff • = self::ET16|_#new#tearOff;
+}
+extension type ET17(self::Bar i) implements self::Bar {
+  constructor • = self::ET17|;
+  tearoff • = self::ET17|_#new#tearOff;
+}
+extension type ET18(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET18|;
+  tearoff • = self::ET18|_#new#tearOff;
+}
+extension type ET19(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET19|;
+  tearoff • = self::ET19|_#new#tearOff;
+}
+extension type ET20(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET20|;
+  tearoff • = self::ET20|_#new#tearOff;
+}
+extension type ET21(self::Boz i) implements self::Bar {
+  constructor • = self::ET21|;
+  tearoff • = self::ET21|_#new#tearOff;
+}
+extension type ET22(core::int i) {
+  constructor • = self::ET22|;
+  tearoff • = self::ET22|_#new#tearOff;
+}
+extension type ET23(core::int i) {
+  constructor • = self::ET23|;
+  tearoff • = self::ET23|_#new#tearOff;
+}
+static inline-class-member method ET1|(core::int i) → self::ET1 /* = core::int */ {
+  lowered final self::ET1 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET1|_#new#tearOff(core::int i) → self::ET1 /* = core::int */
+  return self::ET1|(i);
+static inline-class-member method ET2|(core::int i) → self::ET2 /* = core::int */ {
+  lowered final self::ET2 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET2|_#new#tearOff(core::int i) → self::ET2 /* = core::int */
+  return self::ET2|(i);
+static inline-class-member method ET3|(core::int i) → self::ET3 /* = core::int */ {
+  lowered final self::ET3 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET3|_#new#tearOff(core::int i) → self::ET3 /* = core::int */
+  return self::ET3|(i);
+static inline-class-member method ET4|(core::int i) → self::ET4 /* = core::int */ {
+  lowered final self::ET4 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET4|_#new#tearOff(core::int i) → self::ET4 /* = core::int */
+  return self::ET4|(i);
+static inline-class-member method ET5|(core::int i) → self::ET5 /* = core::int */ {
+  lowered final self::ET5 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET5|_#new#tearOff(core::int i) → self::ET5 /* = core::int */
+  return self::ET5|(i);
+static inline-class-member method ET6|(self::Bar i) → self::ET6 /* = self::Bar */ {
+  lowered final self::ET6 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET6|_#new#tearOff(self::Bar i) → self::ET6 /* = self::Bar */
+  return self::ET6|(i);
+static inline-class-member method ET7|(self::Bar i) → self::ET7 /* = self::Bar */ {
+  lowered final self::ET7 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET7|_#new#tearOff(self::Bar i) → self::ET7 /* = self::Bar */
+  return self::ET7|(i);
+static inline-class-member method ET8|_#new#tearOff(self::Baz i) → self::ET8 /* = self::Baz */
+  return self::ET8|(i);
+static inline-class-member method ET8|(self::Baz i) → self::ET8 /* = self::Baz */ {
+  lowered final self::ET8 /* = self::Baz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET9|(self::Baz i) → self::ET9 /* = self::Baz */ {
+  lowered final self::ET9 /* = self::Baz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET9|_#new#tearOff(self::Baz i) → self::ET9 /* = self::Baz */
+  return self::ET9|(i);
+static inline-class-member method ET10|(self::Boz i) → self::ET10 /* = self::Boz */ {
+  lowered final self::ET10 /* = self::Boz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET10|_#new#tearOff(self::Boz i) → self::ET10 /* = self::Boz */
+  return self::ET10|(i);
+static inline-class-member method ET11|(self::Bar i) → self::ET11 /* = self::Bar */ {
+  lowered final self::ET11 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET11|_#new#tearOff(self::Bar i) → self::ET11 /* = self::Bar */
+  return self::ET11|(i);
+static inline-class-member method ET12|(self::Bar i) → self::ET12 /* = self::Bar */ {
+  lowered final self::ET12 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET12|_#new#tearOff(self::Bar i) → self::ET12 /* = self::Bar */
+  return self::ET12|(i);
+static inline-class-member method ET13|(self::Bar i) → self::ET13 /* = self::Bar */ {
+  lowered final self::ET13 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET13|_#new#tearOff(self::Bar i) → self::ET13 /* = self::Bar */
+  return self::ET13|(i);
+static inline-class-member method ET14|(self::Bar i) → self::ET14 /* = self::Bar */ {
+  lowered final self::ET14 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET14|_#new#tearOff(self::Bar i) → self::ET14 /* = self::Bar */
+  return self::ET14|(i);
+static inline-class-member method ET15|(self::Bar i) → self::ET15 /* = self::Bar */ {
+  lowered final self::ET15 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET15|_#new#tearOff(self::Bar i) → self::ET15 /* = self::Bar */
+  return self::ET15|(i);
+static inline-class-member method ET16|(self::Bar i) → self::ET16 /* = self::Bar */ {
+  lowered final self::ET16 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET16|_#new#tearOff(self::Bar i) → self::ET16 /* = self::Bar */
+  return self::ET16|(i);
+static inline-class-member method ET17|(self::Bar i) → self::ET17 /* = self::Bar */ {
+  lowered final self::ET17 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET17|_#new#tearOff(self::Bar i) → self::ET17 /* = self::Bar */
+  return self::ET17|(i);
+static inline-class-member method ET18|(self::BarBaz i) → self::ET18 /* = self::BarBaz */ {
+  lowered final self::ET18 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET18|_#new#tearOff(self::BarBaz i) → self::ET18 /* = self::BarBaz */
+  return self::ET18|(i);
+static inline-class-member method ET19|(self::BarBaz i) → self::ET19 /* = self::BarBaz */ {
+  lowered final self::ET19 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET19|_#new#tearOff(self::BarBaz i) → self::ET19 /* = self::BarBaz */
+  return self::ET19|(i);
+static inline-class-member method ET20|(self::BarBaz i) → self::ET20 /* = self::BarBaz */ {
+  lowered final self::ET20 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET20|_#new#tearOff(self::BarBaz i) → self::ET20 /* = self::BarBaz */
+  return self::ET20|(i);
+static inline-class-member method ET21|(self::Boz i) → self::ET21 /* = self::Boz */ {
+  lowered final self::ET21 /* = self::Boz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET21|_#new#tearOff(self::Boz i) → self::ET21 /* = self::Boz */
+  return self::ET21|(i);
+static inline-class-member method ET22|(core::int i) → self::ET22 /* = core::int */ {
+  lowered final self::ET22 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET22|_#new#tearOff(core::int i) → self::ET22 /* = core::int */
+  return self::ET22|(i);
+static inline-class-member method ET23|(core::int i) → self::ET23 /* = core::int */ {
+  lowered final self::ET23 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET23|_#new#tearOff(core::int i) → self::ET23 /* = core::int */
+  return self::ET23|(i);
diff --git a/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.weak.outline.expect b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.weak.outline.expect
new file mode 100644
index 0000000..66d6cdf
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.weak.outline.expect
@@ -0,0 +1,436 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:12:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET1(int i) extends Foo {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:13:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET2(int i) with Foo {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:14:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET3(int i) with Foo, Bar {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:15:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET4(int i) extends Foo with Bar {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:15:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET4(int i) extends Foo with Bar {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:16:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET5(int i) extends Foo with Bar, Baz {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:16:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET5(int i) extends Foo with Bar, Baz {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:17:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET6(Bar i) extends Foo implements Bar {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:18:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET7(Bar i) with Foo implements Bar {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:19:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET8(Baz i) with Foo, Bar implements Baz {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:20:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET9(Baz i) extends Foo with Bar implements Baz {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:20:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET9(Baz i) extends Foo with Bar implements Baz {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:21:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:21:40: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {}
+//                                        ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:22:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET11(Bar i) implements Bar extends Foo {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:23:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET12(Bar i) implements Bar with Foo {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:24:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET13(Bar i) implements Bar with Foo, Bar {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:25:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET14(Bar i) implements Bar extends Foo with Bar {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:25:55: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET14(Bar i) implements Bar extends Foo with Bar {}
+//                                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:26:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:26:55: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {}
+//                                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:27:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET16(Bar i) implements Bar extends Foo implements Bar {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:27:55: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET16(Bar i) implements Bar extends Foo implements Bar {}
+//                                                       ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:28:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET17(Bar i) implements Bar with Foo implements Bar {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:28:52: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET17(Bar i) implements Bar with Foo implements Bar {}
+//                                                    ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:46: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                              ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:60: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                                            ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:46: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                              ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:58: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                                          ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:67: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                                                   ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:46: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                              ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:58: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                                          ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:72: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                                                        ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:32:43: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET21(Boz i) implements Bar implements Boz {}
+//                                           ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:33:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET22(int i) extends Bar extends Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:33:40: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET22(int i) extends Bar extends Boz {}
+//                                        ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:34:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET23(int i) extends Bar, Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:9:7: Error: 'BarBaz' is a supertype of itself.
+// class BarBaz implements BarBaz {}
+//       ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:10:7: Error: 'BarBoz' is a supertype of itself.
+// class BarBoz implements BarBoz {}
+//       ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET18'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET19'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET20'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:32:39: Error: The implemented interface 'Bar' must be a supertype of the representation type 'Boz' of extension type 'ET21'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'Boz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'Boz' or the representation type to a subtype of 'Bar'.
+// extension type ET21(Boz i) implements Bar implements Boz {}
+//                                       ^
+//
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+  synthetic constructor •() → self::Foo
+    ;
+}
+class Bar extends core::Object {
+  synthetic constructor •() → self::Bar
+    ;
+}
+class Baz extends core::Object {
+  synthetic constructor •() → self::Baz
+    ;
+}
+class Boz extends core::Object {
+  synthetic constructor •() → self::Boz
+    ;
+}
+class BarBaz extends core::Object {
+  synthetic constructor •() → self::BarBaz
+    ;
+}
+class BarBoz extends core::Object {
+  synthetic constructor •() → self::BarBoz
+    ;
+}
+extension type ET1(core::int i) {
+  constructor • = self::ET1|;
+  tearoff • = self::ET1|_#new#tearOff;
+}
+extension type ET2(core::int i) {
+  constructor • = self::ET2|;
+  tearoff • = self::ET2|_#new#tearOff;
+}
+extension type ET3(core::int i) {
+  constructor • = self::ET3|;
+  tearoff • = self::ET3|_#new#tearOff;
+}
+extension type ET4(core::int i) {
+  constructor • = self::ET4|;
+  tearoff • = self::ET4|_#new#tearOff;
+}
+extension type ET5(core::int i) {
+  constructor • = self::ET5|;
+  tearoff • = self::ET5|_#new#tearOff;
+}
+extension type ET6(self::Bar i) {
+  constructor • = self::ET6|;
+  tearoff • = self::ET6|_#new#tearOff;
+}
+extension type ET7(self::Bar i) {
+  constructor • = self::ET7|;
+  tearoff • = self::ET7|_#new#tearOff;
+}
+extension type ET8(self::Baz i) {
+  constructor • = self::ET8|;
+  tearoff • = self::ET8|_#new#tearOff;
+}
+extension type ET9(self::Baz i) {
+  constructor • = self::ET9|;
+  tearoff • = self::ET9|_#new#tearOff;
+}
+extension type ET10(self::Boz i) {
+  constructor • = self::ET10|;
+  tearoff • = self::ET10|_#new#tearOff;
+}
+extension type ET11(self::Bar i) implements self::Bar {
+  constructor • = self::ET11|;
+  tearoff • = self::ET11|_#new#tearOff;
+}
+extension type ET12(self::Bar i) implements self::Bar {
+  constructor • = self::ET12|;
+  tearoff • = self::ET12|_#new#tearOff;
+}
+extension type ET13(self::Bar i) implements self::Bar {
+  constructor • = self::ET13|;
+  tearoff • = self::ET13|_#new#tearOff;
+}
+extension type ET14(self::Bar i) implements self::Bar {
+  constructor • = self::ET14|;
+  tearoff • = self::ET14|_#new#tearOff;
+}
+extension type ET15(self::Bar i) implements self::Bar {
+  constructor • = self::ET15|;
+  tearoff • = self::ET15|_#new#tearOff;
+}
+extension type ET16(self::Bar i) implements self::Bar {
+  constructor • = self::ET16|;
+  tearoff • = self::ET16|_#new#tearOff;
+}
+extension type ET17(self::Bar i) implements self::Bar {
+  constructor • = self::ET17|;
+  tearoff • = self::ET17|_#new#tearOff;
+}
+extension type ET18(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET18|;
+  tearoff • = self::ET18|_#new#tearOff;
+}
+extension type ET19(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET19|;
+  tearoff • = self::ET19|_#new#tearOff;
+}
+extension type ET20(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET20|;
+  tearoff • = self::ET20|_#new#tearOff;
+}
+extension type ET21(self::Boz i) implements self::Bar {
+  constructor • = self::ET21|;
+  tearoff • = self::ET21|_#new#tearOff;
+}
+extension type ET22(core::int i) {
+  constructor • = self::ET22|;
+  tearoff • = self::ET22|_#new#tearOff;
+}
+extension type ET23(core::int i) {
+  constructor • = self::ET23|;
+  tearoff • = self::ET23|_#new#tearOff;
+}
+static inline-class-member method ET1|(core::int i) → self::ET1 /* = core::int */
+  ;
+static inline-class-member method ET1|_#new#tearOff(core::int i) → self::ET1 /* = core::int */
+  return self::ET1|(i);
+static inline-class-member method ET2|(core::int i) → self::ET2 /* = core::int */
+  ;
+static inline-class-member method ET2|_#new#tearOff(core::int i) → self::ET2 /* = core::int */
+  return self::ET2|(i);
+static inline-class-member method ET3|(core::int i) → self::ET3 /* = core::int */
+  ;
+static inline-class-member method ET3|_#new#tearOff(core::int i) → self::ET3 /* = core::int */
+  return self::ET3|(i);
+static inline-class-member method ET4|(core::int i) → self::ET4 /* = core::int */
+  ;
+static inline-class-member method ET4|_#new#tearOff(core::int i) → self::ET4 /* = core::int */
+  return self::ET4|(i);
+static inline-class-member method ET5|(core::int i) → self::ET5 /* = core::int */
+  ;
+static inline-class-member method ET5|_#new#tearOff(core::int i) → self::ET5 /* = core::int */
+  return self::ET5|(i);
+static inline-class-member method ET6|(self::Bar i) → self::ET6 /* = self::Bar */
+  ;
+static inline-class-member method ET6|_#new#tearOff(self::Bar i) → self::ET6 /* = self::Bar */
+  return self::ET6|(i);
+static inline-class-member method ET7|(self::Bar i) → self::ET7 /* = self::Bar */
+  ;
+static inline-class-member method ET7|_#new#tearOff(self::Bar i) → self::ET7 /* = self::Bar */
+  return self::ET7|(i);
+static inline-class-member method ET8|_#new#tearOff(self::Baz i) → self::ET8 /* = self::Baz */
+  return self::ET8|(i);
+static inline-class-member method ET8|(self::Baz i) → self::ET8 /* = self::Baz */
+  ;
+static inline-class-member method ET9|(self::Baz i) → self::ET9 /* = self::Baz */
+  ;
+static inline-class-member method ET9|_#new#tearOff(self::Baz i) → self::ET9 /* = self::Baz */
+  return self::ET9|(i);
+static inline-class-member method ET10|(self::Boz i) → self::ET10 /* = self::Boz */
+  ;
+static inline-class-member method ET10|_#new#tearOff(self::Boz i) → self::ET10 /* = self::Boz */
+  return self::ET10|(i);
+static inline-class-member method ET11|(self::Bar i) → self::ET11 /* = self::Bar */
+  ;
+static inline-class-member method ET11|_#new#tearOff(self::Bar i) → self::ET11 /* = self::Bar */
+  return self::ET11|(i);
+static inline-class-member method ET12|(self::Bar i) → self::ET12 /* = self::Bar */
+  ;
+static inline-class-member method ET12|_#new#tearOff(self::Bar i) → self::ET12 /* = self::Bar */
+  return self::ET12|(i);
+static inline-class-member method ET13|(self::Bar i) → self::ET13 /* = self::Bar */
+  ;
+static inline-class-member method ET13|_#new#tearOff(self::Bar i) → self::ET13 /* = self::Bar */
+  return self::ET13|(i);
+static inline-class-member method ET14|(self::Bar i) → self::ET14 /* = self::Bar */
+  ;
+static inline-class-member method ET14|_#new#tearOff(self::Bar i) → self::ET14 /* = self::Bar */
+  return self::ET14|(i);
+static inline-class-member method ET15|(self::Bar i) → self::ET15 /* = self::Bar */
+  ;
+static inline-class-member method ET15|_#new#tearOff(self::Bar i) → self::ET15 /* = self::Bar */
+  return self::ET15|(i);
+static inline-class-member method ET16|(self::Bar i) → self::ET16 /* = self::Bar */
+  ;
+static inline-class-member method ET16|_#new#tearOff(self::Bar i) → self::ET16 /* = self::Bar */
+  return self::ET16|(i);
+static inline-class-member method ET17|(self::Bar i) → self::ET17 /* = self::Bar */
+  ;
+static inline-class-member method ET17|_#new#tearOff(self::Bar i) → self::ET17 /* = self::Bar */
+  return self::ET17|(i);
+static inline-class-member method ET18|(self::BarBaz i) → self::ET18 /* = self::BarBaz */
+  ;
+static inline-class-member method ET18|_#new#tearOff(self::BarBaz i) → self::ET18 /* = self::BarBaz */
+  return self::ET18|(i);
+static inline-class-member method ET19|(self::BarBaz i) → self::ET19 /* = self::BarBaz */
+  ;
+static inline-class-member method ET19|_#new#tearOff(self::BarBaz i) → self::ET19 /* = self::BarBaz */
+  return self::ET19|(i);
+static inline-class-member method ET20|(self::BarBaz i) → self::ET20 /* = self::BarBaz */
+  ;
+static inline-class-member method ET20|_#new#tearOff(self::BarBaz i) → self::ET20 /* = self::BarBaz */
+  return self::ET20|(i);
+static inline-class-member method ET21|(self::Boz i) → self::ET21 /* = self::Boz */
+  ;
+static inline-class-member method ET21|_#new#tearOff(self::Boz i) → self::ET21 /* = self::Boz */
+  return self::ET21|(i);
+static inline-class-member method ET22|(core::int i) → self::ET22 /* = core::int */
+  ;
+static inline-class-member method ET22|_#new#tearOff(core::int i) → self::ET22 /* = core::int */
+  return self::ET22|(i);
+static inline-class-member method ET23|(core::int i) → self::ET23 /* = core::int */
+  ;
+static inline-class-member method ET23|_#new#tearOff(core::int i) → self::ET23 /* = core::int */
+  return self::ET23|(i);
diff --git a/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.weak.transformed.expect b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.weak.transformed.expect
new file mode 100644
index 0000000..5e5c203
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/extends_with.dart.weak.transformed.expect
@@ -0,0 +1,488 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:12:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET1(int i) extends Foo {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:13:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET2(int i) with Foo {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:14:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET3(int i) with Foo, Bar {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:15:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET4(int i) extends Foo with Bar {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:15:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET4(int i) extends Foo with Bar {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:16:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET5(int i) extends Foo with Bar, Baz {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:16:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET5(int i) extends Foo with Bar, Baz {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:17:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET6(Bar i) extends Foo implements Bar {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:18:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET7(Bar i) with Foo implements Bar {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:19:27: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET8(Baz i) with Foo, Bar implements Baz {}
+//                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:20:27: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET9(Baz i) extends Foo with Bar implements Baz {}
+//                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:20:39: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET9(Baz i) extends Foo with Bar implements Baz {}
+//                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:21:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:21:40: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET10(Boz i) extends Foo with Bar, Baz implements Boz {}
+//                                        ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:22:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET11(Bar i) implements Bar extends Foo {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:23:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET12(Bar i) implements Bar with Foo {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:24:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET13(Bar i) implements Bar with Foo, Bar {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:25:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET14(Bar i) implements Bar extends Foo with Bar {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:25:55: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET14(Bar i) implements Bar extends Foo with Bar {}
+//                                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:26:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:26:55: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET15(Bar i) implements Bar extends Foo with Bar, Baz {}
+//                                                       ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:27:43: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET16(Bar i) implements Bar extends Foo implements Bar {}
+//                                           ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:27:55: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET16(Bar i) implements Bar extends Foo implements Bar {}
+//                                                       ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:28:43: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET17(Bar i) implements Bar with Foo implements Bar {}
+//                                           ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:28:52: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET17(Bar i) implements Bar with Foo implements Bar {}
+//                                                    ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:46: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                              ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:60: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                                            ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:46: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                              ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:58: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                                          ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:67: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                                                   ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:46: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                              ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:58: Error: An extension type declaration can't have a 'with' clause.
+// Try removing the 'with' clause or replacing the 'with' with 'implements'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                                          ^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:72: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                                                        ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:32:43: Error: Each class definition can have at most one implements clause.
+// Try combining all of the implements clauses into a single clause.
+// extension type ET21(Boz i) implements Bar implements Boz {}
+//                                           ^^^^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:33:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET22(int i) extends Bar extends Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:33:40: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET22(int i) extends Bar extends Boz {}
+//                                        ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:34:28: Error: An extension type declaration can't have an 'extends' clause.
+// Try removing the 'extends' clause or replacing the 'extends' with 'implements'.
+// extension type ET23(int i) extends Bar, Boz {}
+//                            ^^^^^^^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:9:7: Error: 'BarBaz' is a supertype of itself.
+// class BarBaz implements BarBaz {}
+//       ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:10:7: Error: 'BarBoz' is a supertype of itself.
+// class BarBoz implements BarBoz {}
+//       ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:29:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET18'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET18(BarBaz i) implements Bar with Foo, Bar implements Baz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:30:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET19'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET19(BarBaz i) implements Bar extends Foo with Bar implements Baz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:31:42: Error: The implemented interface 'Bar' must be a supertype of the representation type 'BarBaz' of extension type 'ET20'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'BarBaz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'BarBaz' or the representation type to a subtype of 'Bar'.
+// extension type ET20(BarBaz i) implements Bar extends Foo with Bar, Baz implements Boz {}
+//                                          ^
+//
+// pkg/front_end/testcases/inline_class/extension_types/extends_with.dart:32:39: Error: The implemented interface 'Bar' must be a supertype of the representation type 'Boz' of extension type 'ET21'.
+//  - 'Bar' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+//  - 'Boz' is from 'pkg/front_end/testcases/inline_class/extension_types/extends_with.dart'.
+// Try changing the interface type to a supertype of 'Boz' or the representation type to a subtype of 'Bar'.
+// extension type ET21(Boz i) implements Bar implements Boz {}
+//                                       ^
+//
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+  synthetic constructor •() → self::Foo
+    : super core::Object::•()
+    ;
+}
+class Bar extends core::Object {
+  synthetic constructor •() → self::Bar
+    : super core::Object::•()
+    ;
+}
+class Baz extends core::Object {
+  synthetic constructor •() → self::Baz
+    : super core::Object::•()
+    ;
+}
+class Boz extends core::Object {
+  synthetic constructor •() → self::Boz
+    : super core::Object::•()
+    ;
+}
+class BarBaz extends core::Object {
+  synthetic constructor •() → self::BarBaz
+    : super core::Object::•()
+    ;
+}
+class BarBoz extends core::Object {
+  synthetic constructor •() → self::BarBoz
+    : super core::Object::•()
+    ;
+}
+extension type ET1(core::int i) {
+  constructor • = self::ET1|;
+  tearoff • = self::ET1|_#new#tearOff;
+}
+extension type ET2(core::int i) {
+  constructor • = self::ET2|;
+  tearoff • = self::ET2|_#new#tearOff;
+}
+extension type ET3(core::int i) {
+  constructor • = self::ET3|;
+  tearoff • = self::ET3|_#new#tearOff;
+}
+extension type ET4(core::int i) {
+  constructor • = self::ET4|;
+  tearoff • = self::ET4|_#new#tearOff;
+}
+extension type ET5(core::int i) {
+  constructor • = self::ET5|;
+  tearoff • = self::ET5|_#new#tearOff;
+}
+extension type ET6(self::Bar i) {
+  constructor • = self::ET6|;
+  tearoff • = self::ET6|_#new#tearOff;
+}
+extension type ET7(self::Bar i) {
+  constructor • = self::ET7|;
+  tearoff • = self::ET7|_#new#tearOff;
+}
+extension type ET8(self::Baz i) {
+  constructor • = self::ET8|;
+  tearoff • = self::ET8|_#new#tearOff;
+}
+extension type ET9(self::Baz i) {
+  constructor • = self::ET9|;
+  tearoff • = self::ET9|_#new#tearOff;
+}
+extension type ET10(self::Boz i) {
+  constructor • = self::ET10|;
+  tearoff • = self::ET10|_#new#tearOff;
+}
+extension type ET11(self::Bar i) implements self::Bar {
+  constructor • = self::ET11|;
+  tearoff • = self::ET11|_#new#tearOff;
+}
+extension type ET12(self::Bar i) implements self::Bar {
+  constructor • = self::ET12|;
+  tearoff • = self::ET12|_#new#tearOff;
+}
+extension type ET13(self::Bar i) implements self::Bar {
+  constructor • = self::ET13|;
+  tearoff • = self::ET13|_#new#tearOff;
+}
+extension type ET14(self::Bar i) implements self::Bar {
+  constructor • = self::ET14|;
+  tearoff • = self::ET14|_#new#tearOff;
+}
+extension type ET15(self::Bar i) implements self::Bar {
+  constructor • = self::ET15|;
+  tearoff • = self::ET15|_#new#tearOff;
+}
+extension type ET16(self::Bar i) implements self::Bar {
+  constructor • = self::ET16|;
+  tearoff • = self::ET16|_#new#tearOff;
+}
+extension type ET17(self::Bar i) implements self::Bar {
+  constructor • = self::ET17|;
+  tearoff • = self::ET17|_#new#tearOff;
+}
+extension type ET18(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET18|;
+  tearoff • = self::ET18|_#new#tearOff;
+}
+extension type ET19(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET19|;
+  tearoff • = self::ET19|_#new#tearOff;
+}
+extension type ET20(self::BarBaz i) implements self::Bar {
+  constructor • = self::ET20|;
+  tearoff • = self::ET20|_#new#tearOff;
+}
+extension type ET21(self::Boz i) implements self::Bar {
+  constructor • = self::ET21|;
+  tearoff • = self::ET21|_#new#tearOff;
+}
+extension type ET22(core::int i) {
+  constructor • = self::ET22|;
+  tearoff • = self::ET22|_#new#tearOff;
+}
+extension type ET23(core::int i) {
+  constructor • = self::ET23|;
+  tearoff • = self::ET23|_#new#tearOff;
+}
+static inline-class-member method ET1|(core::int i) → self::ET1 /* = core::int */ {
+  lowered final self::ET1 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET1|_#new#tearOff(core::int i) → self::ET1 /* = core::int */
+  return self::ET1|(i);
+static inline-class-member method ET2|(core::int i) → self::ET2 /* = core::int */ {
+  lowered final self::ET2 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET2|_#new#tearOff(core::int i) → self::ET2 /* = core::int */
+  return self::ET2|(i);
+static inline-class-member method ET3|(core::int i) → self::ET3 /* = core::int */ {
+  lowered final self::ET3 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET3|_#new#tearOff(core::int i) → self::ET3 /* = core::int */
+  return self::ET3|(i);
+static inline-class-member method ET4|(core::int i) → self::ET4 /* = core::int */ {
+  lowered final self::ET4 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET4|_#new#tearOff(core::int i) → self::ET4 /* = core::int */
+  return self::ET4|(i);
+static inline-class-member method ET5|(core::int i) → self::ET5 /* = core::int */ {
+  lowered final self::ET5 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET5|_#new#tearOff(core::int i) → self::ET5 /* = core::int */
+  return self::ET5|(i);
+static inline-class-member method ET6|(self::Bar i) → self::ET6 /* = self::Bar */ {
+  lowered final self::ET6 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET6|_#new#tearOff(self::Bar i) → self::ET6 /* = self::Bar */
+  return self::ET6|(i);
+static inline-class-member method ET7|(self::Bar i) → self::ET7 /* = self::Bar */ {
+  lowered final self::ET7 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET7|_#new#tearOff(self::Bar i) → self::ET7 /* = self::Bar */
+  return self::ET7|(i);
+static inline-class-member method ET8|_#new#tearOff(self::Baz i) → self::ET8 /* = self::Baz */
+  return self::ET8|(i);
+static inline-class-member method ET8|(self::Baz i) → self::ET8 /* = self::Baz */ {
+  lowered final self::ET8 /* = self::Baz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET9|(self::Baz i) → self::ET9 /* = self::Baz */ {
+  lowered final self::ET9 /* = self::Baz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET9|_#new#tearOff(self::Baz i) → self::ET9 /* = self::Baz */
+  return self::ET9|(i);
+static inline-class-member method ET10|(self::Boz i) → self::ET10 /* = self::Boz */ {
+  lowered final self::ET10 /* = self::Boz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET10|_#new#tearOff(self::Boz i) → self::ET10 /* = self::Boz */
+  return self::ET10|(i);
+static inline-class-member method ET11|(self::Bar i) → self::ET11 /* = self::Bar */ {
+  lowered final self::ET11 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET11|_#new#tearOff(self::Bar i) → self::ET11 /* = self::Bar */
+  return self::ET11|(i);
+static inline-class-member method ET12|(self::Bar i) → self::ET12 /* = self::Bar */ {
+  lowered final self::ET12 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET12|_#new#tearOff(self::Bar i) → self::ET12 /* = self::Bar */
+  return self::ET12|(i);
+static inline-class-member method ET13|(self::Bar i) → self::ET13 /* = self::Bar */ {
+  lowered final self::ET13 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET13|_#new#tearOff(self::Bar i) → self::ET13 /* = self::Bar */
+  return self::ET13|(i);
+static inline-class-member method ET14|(self::Bar i) → self::ET14 /* = self::Bar */ {
+  lowered final self::ET14 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET14|_#new#tearOff(self::Bar i) → self::ET14 /* = self::Bar */
+  return self::ET14|(i);
+static inline-class-member method ET15|(self::Bar i) → self::ET15 /* = self::Bar */ {
+  lowered final self::ET15 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET15|_#new#tearOff(self::Bar i) → self::ET15 /* = self::Bar */
+  return self::ET15|(i);
+static inline-class-member method ET16|(self::Bar i) → self::ET16 /* = self::Bar */ {
+  lowered final self::ET16 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET16|_#new#tearOff(self::Bar i) → self::ET16 /* = self::Bar */
+  return self::ET16|(i);
+static inline-class-member method ET17|(self::Bar i) → self::ET17 /* = self::Bar */ {
+  lowered final self::ET17 /* = self::Bar */ #this = i;
+  return #this;
+}
+static inline-class-member method ET17|_#new#tearOff(self::Bar i) → self::ET17 /* = self::Bar */
+  return self::ET17|(i);
+static inline-class-member method ET18|(self::BarBaz i) → self::ET18 /* = self::BarBaz */ {
+  lowered final self::ET18 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET18|_#new#tearOff(self::BarBaz i) → self::ET18 /* = self::BarBaz */
+  return self::ET18|(i);
+static inline-class-member method ET19|(self::BarBaz i) → self::ET19 /* = self::BarBaz */ {
+  lowered final self::ET19 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET19|_#new#tearOff(self::BarBaz i) → self::ET19 /* = self::BarBaz */
+  return self::ET19|(i);
+static inline-class-member method ET20|(self::BarBaz i) → self::ET20 /* = self::BarBaz */ {
+  lowered final self::ET20 /* = self::BarBaz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET20|_#new#tearOff(self::BarBaz i) → self::ET20 /* = self::BarBaz */
+  return self::ET20|(i);
+static inline-class-member method ET21|(self::Boz i) → self::ET21 /* = self::Boz */ {
+  lowered final self::ET21 /* = self::Boz */ #this = i;
+  return #this;
+}
+static inline-class-member method ET21|_#new#tearOff(self::Boz i) → self::ET21 /* = self::Boz */
+  return self::ET21|(i);
+static inline-class-member method ET22|(core::int i) → self::ET22 /* = core::int */ {
+  lowered final self::ET22 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET22|_#new#tearOff(core::int i) → self::ET22 /* = core::int */
+  return self::ET22|(i);
+static inline-class-member method ET23|(core::int i) → self::ET23 /* = core::int */ {
+  lowered final self::ET23 /* = core::int */ #this = i;
+  return #this;
+}
+static inline-class-member method ET23|_#new#tearOff(core::int i) → self::ET23 /* = core::int */
+  return self::ET23|(i);