[parser] Add error recovery to extension type declaration parsing

This changes the parser to always interpret `extension type` as the
start of an extension type declaration.

Recovery is added to handle missing identifier, primary constructor,
parameter constructor parameters, and extension type declaration body.

Change-Id: I98cac0b2641167c4708fa20b22f0de0a70336457
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321704
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jens Johansen <jensj@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 2c6ff48..46a19e8 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -9243,6 +9243,32 @@
         r"""Try adding a prefix to the import by adding an 'as' clause.""");
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeMissingPrimaryConstructor =
+    messageMissingPrimaryConstructor;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageMissingPrimaryConstructor = const MessageCode(
+    "MissingPrimaryConstructor",
+    index: 162,
+    problemMessage:
+        r"""An extension type declaration must have a primary constructor declaration.""",
+    correctionMessage:
+        r"""Try adding a primary constructor to the extension type declaration.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeMissingPrimaryConstructorParameters =
+    messageMissingPrimaryConstructorParameters;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageMissingPrimaryConstructorParameters = const MessageCode(
+    "MissingPrimaryConstructorParameters",
+    index: 163,
+    problemMessage:
+        r"""A primary constructor declaration must have formal parameters.""",
+    correctionMessage:
+        r"""Try adding formal parameters after the primary constructor name.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
 const Code<Null> codeMissingTypedefParameters = messageMissingTypedefParameters;
 
 // DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
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 90b29cc..db12cf7 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/forwarding_listener.dart
@@ -2148,6 +2148,11 @@
     listener?.endPrimaryConstructor(
         beginToken, constKeyword, hasConstructorName);
   }
+
+  @override
+  void handleNoPrimaryConstructor(Token token, Token? constKeyword) {
+    listener?.handleNoPrimaryConstructor(token, constKeyword);
+  }
 }
 
 class NullListener extends ForwardingListener {
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart b/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart
index cbf2423..9b961c8 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/identifier_context_impl.dart
@@ -66,6 +66,8 @@
       'implements',
       'on',
       '=',
+      '(',
+      '.',
     ];
     if (identifier.isEof ||
         (looksLikeStartOfNextTopLevelDeclaration(identifier) &&
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart b/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
index 4812379..621b2f2 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/listener.dart
@@ -298,6 +298,10 @@
     logEvent('PrimaryConstructor');
   }
 
+  /// Handle the omission of a primary constructor declaration. Currently only
+  /// occurring in extension type declarations.
+  void handleNoPrimaryConstructor(Token token, Token? constKeyword) {}
+
   void beginCombinators(Token token) {}
 
   void endCombinators(int count) {
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 8c9e6f5..6109ee9 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/parser_impl.dart
@@ -2972,36 +2972,39 @@
     return token;
   }
 
-  /// ```
-  /// 'extension' <identifier>? <typeParameters>?
-  ///     (('.' <identifier>)? <implementsClause>) | ('on' <type> '?'?)
-  //   `{'
-  //     <memberDeclaration>*
-  //   `}'
-  /// ```
+  /// Parses an extension or extension type declaration.
   Token parseExtension(Token extensionKeyword) {
     assert(optional('extension', extensionKeyword));
     Token token = extensionKeyword;
     listener.beginExtensionDeclarationPrelude(extensionKeyword);
-    Token? name = token.next!;
-    Token? typeKeyword = null;
-    Token? constKeyword = null;
-    if (name.isIdentifier && name.lexeme == 'type') {
+    if (token.next!.isIdentifier && token.next!.lexeme == 'type') {
       // 'extension' 'type'
-      if (optional('const', name.next!)) {
-        // 'extension' 'type' 'const' <identifier>
-        typeKeyword = name;
-        constKeyword = name.next!;
-        token = token.next!.next!;
-        name = token.next!;
-      } else if (name.next!.isIdentifier && !optional('on', name.next!)) {
-        // 'extension' 'type' <identifier>
-        typeKeyword = name;
-        token = token.next!;
-        name = token.next!;
-      }
+      Token typeKeyword = token.next!;
+      return parseExtensionTypeDeclaration(
+          token.next!, extensionKeyword, typeKeyword);
+    } else {
+      return parseExtensionDeclaration(token, extensionKeyword);
     }
+  }
 
+  /// Parses an extension declaration after
+  ///
+  ///    'extension'
+  ///
+  /// This parses
+  ///
+  /// ```
+  ///    <identifier>? <typeParameters>?
+  ///       (('.' <identifier>)? <implementsClause>) | ('on' <type> '?'?)
+  ///   `{'
+  ///     <memberDeclaration>*
+  ///   `}'
+  /// ```
+  ///
+  Token parseExtensionDeclaration(Token token, Token extensionKeyword) {
+    assert(optional('extension', extensionKeyword));
+    assert(!optional('type', token));
+    Token? name = token.next!;
     if (name.isIdentifier && !optional('on', name)) {
       token = name;
       if (name.type.isBuiltIn) {
@@ -3013,22 +3016,6 @@
     }
     token = computeTypeParamOrArg(token, /* inDeclaration = */ true)
         .parseVariables(token, this);
-    if (typeKeyword != null && name != null) {
-      Token next = token.next!;
-      if (optional('(', next) || optional('.', next)) {
-        return parseExtensionTypeDeclarationRest(
-            token, extensionKeyword, typeKeyword, constKeyword, name);
-      } else {
-        // TODO(johnniwinther): Change this to recover as an extension type
-        // declaration.
-        reportRecoverableError(
-            next, codes.templateUnexpectedToken.withArguments(next));
-      }
-    }
-    if (constKeyword != null) {
-      reportRecoverableError(constKeyword,
-          codes.templateUnexpectedToken.withArguments(constKeyword));
-    }
     listener.beginExtensionDeclaration(extensionKeyword, name);
     Token onKeyword = token.next!;
     if (!optional('on', onKeyword)) {
@@ -3079,27 +3066,65 @@
 
   /// Parses an extension type declaration after
   ///
-  ///    'extension' 'type' 'const'? <name> <typeParameters>?
+  ///    'extension' 'type'
   ///
   /// This parses
   ///
-  ///    ('.' <identifier>)? <formals> '{' <memberDeclaration>* '}'
+  ///    'const'? <identifier> <typeParameters>?
+  ///        ('.' <identifier>)? <formals> '{' <memberDeclaration>* '}'
   ///
-  Token parseExtensionTypeDeclarationRest(Token token, Token extensionKeyword,
-      Token typeKeyword, Token? constKeyword, Token name) {
-    assert(optional('(', token.next!) || optional('.', token.next!));
-    listener.beginExtensionTypeDeclaration(extensionKeyword, name);
-    Token beginPrimaryConstructor = token.next!;
-    listener.beginPrimaryConstructor(beginPrimaryConstructor);
-    bool hasConstructorName = optional('.', beginPrimaryConstructor);
-    if (hasConstructorName) {
-      token = ensureIdentifier(beginPrimaryConstructor,
-          IdentifierContext.primaryConstructorDeclaration);
+  Token parseExtensionTypeDeclaration(
+      Token token, Token extensionKeyword, Token typeKeyword) {
+    assert(token.isIdentifier && token.lexeme == 'type');
+    Token? constKeyword = null;
+    if (optional('const', token.next!)) {
+      // 'extension' 'type' 'const' <identifier>
+      token = constKeyword = token.next!;
     }
-    token = parseFormalParameters(token, MemberKind.PrimaryConstructor);
-    listener.endPrimaryConstructor(
-        beginPrimaryConstructor, constKeyword, hasConstructorName);
+    Token? name;
+    if (token.next!.isIdentifier) {
+      name = token.next!;
+      if (name.type.isBuiltIn) {
+        reportRecoverableErrorWithToken(
+            token, codes.templateBuiltInIdentifierInDeclaration);
+      }
+    } else {
+      name = IdentifierContext.classOrMixinOrExtensionDeclaration
+          .ensureIdentifier(token, this);
+    }
+    token = name;
+    token = computeTypeParamOrArg(token, /* inDeclaration = */ true)
+        .parseVariables(token, this);
+    listener.beginExtensionTypeDeclaration(extensionKeyword, name);
+    if (optional('(', token.next!) || optional('.', token.next!)) {
+      Token beginPrimaryConstructor = token.next!;
+      listener.beginPrimaryConstructor(beginPrimaryConstructor);
+      bool hasConstructorName = optional('.', beginPrimaryConstructor);
+      if (hasConstructorName) {
+        token = ensureIdentifier(beginPrimaryConstructor,
+            IdentifierContext.primaryConstructorDeclaration);
+      }
+      if (optional('(', token.next!)) {
+        token = parseFormalParameters(token, MemberKind.PrimaryConstructor);
+      } else {
+        reportRecoverableError(
+            token, codes.messageMissingPrimaryConstructorParameters);
+        listener.handleNoFormalParameters(token, MemberKind.PrimaryConstructor);
+      }
+      listener.endPrimaryConstructor(
+          beginPrimaryConstructor, constKeyword, hasConstructorName);
+    } else {
+      reportRecoverableError(token, codes.messageMissingPrimaryConstructor);
+      listener.handleNoPrimaryConstructor(token, constKeyword);
+    }
     token = parseClassOrMixinOrEnumImplementsOpt(token);
+    if (!optional('{', token.next!)) {
+      // TODO(johnniwinther): Reuse logic from [parseClassHeaderRecovery] to
+      // handle `extends`, `with` and out-of-order/duplicate clauses.
+
+      // Recovery
+      ensureBlock(token, /* template = */ null, 'extension type declaration');
+    }
     token = parseClassOrMixinOrExtensionBody(
         token, DeclarationKind.ExtensionType, name.lexeme);
     listener.endExtensionTypeDeclaration(extensionKeyword, typeKeyword, token);
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 50fb626..27a6086 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
@@ -3025,6 +3025,10 @@
   status: noFix
 ParserErrorCode.MISSING_PREFIX_IN_DEFERRED_IMPORT:
   status: noFix
+ParserErrorCode.MISSING_PRIMARY_CONSTRUCTOR:
+  status: needsEvaluation
+ParserErrorCode.MISSING_PRIMARY_CONSTRUCTOR_PARAMETERS:
+  status: needsEvaluation
 ParserErrorCode.MISSING_STAR_AFTER_SYNC:
   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 b692506..6bd0ffd 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart
@@ -180,6 +180,8 @@
   ParserErrorCode.ILLEGAL_PATTERN_VARIABLE_NAME,
   ParserErrorCode.ILLEGAL_PATTERN_ASSIGNMENT_VARIABLE_NAME,
   ParserErrorCode.ILLEGAL_PATTERN_IDENTIFIER_NAME,
+  ParserErrorCode.MISSING_PRIMARY_CONSTRUCTOR,
+  ParserErrorCode.MISSING_PRIMARY_CONSTRUCTOR_PARAMETERS,
 ];
 
 class ParserErrorCode extends ErrorCode {
@@ -1387,6 +1389,22 @@
         "Try adding a prefix to the import by adding an 'as' clause.",
   );
 
+  static const ParserErrorCode MISSING_PRIMARY_CONSTRUCTOR = ParserErrorCode(
+    'MISSING_PRIMARY_CONSTRUCTOR',
+    "An extension type declaration must have a primary constructor "
+        "declaration.",
+    correctionMessage:
+        "Try adding a primary constructor to the extension type declaration.",
+  );
+
+  static const ParserErrorCode MISSING_PRIMARY_CONSTRUCTOR_PARAMETERS =
+      ParserErrorCode(
+    'MISSING_PRIMARY_CONSTRUCTOR_PARAMETERS',
+    "A primary constructor declaration must have formal parameters.",
+    correctionMessage:
+        "Try adding formal parameters after the primary constructor name.",
+  );
+
   static const ParserErrorCode MISSING_STAR_AFTER_SYNC = ParserErrorCode(
     'MISSING_STAR_AFTER_SYNC',
     "The modifier 'sync' must be followed by a star ('*').",
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 85671e8..7505d86 100644
--- a/pkg/analyzer/lib/src/error/error_code_values.g.dart
+++ b/pkg/analyzer/lib/src/error/error_code_values.g.dart
@@ -805,6 +805,8 @@
   ParserErrorCode.MISSING_NAME_IN_LIBRARY_DIRECTIVE,
   ParserErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE,
   ParserErrorCode.MISSING_PREFIX_IN_DEFERRED_IMPORT,
+  ParserErrorCode.MISSING_PRIMARY_CONSTRUCTOR,
+  ParserErrorCode.MISSING_PRIMARY_CONSTRUCTOR_PARAMETERS,
   ParserErrorCode.MISSING_STAR_AFTER_SYNC,
   ParserErrorCode.MISSING_STATEMENT,
   ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMETER_GROUP,
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index ffa2615..5ffb58a 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -1632,19 +1632,23 @@
       Token extensionKeyword, Token typeKeyword, Token endToken) {
     final implementsClause =
         pop(NullValues.IdentifierList) as ImplementsClauseImpl?;
-    final representation = pop() as RepresentationDeclarationImpl;
+    final representation = pop(const NullValue<RepresentationDeclarationImpl>())
+        as RepresentationDeclarationImpl?;
     final constKeyword = pop() as Token?;
 
     if (enableInlineClass) {
       final builder = _classLikeBuilder as _ExtensionTypeDeclarationBuilder;
-      declarations.add(
-        builder.build(
-          typeKeyword: typeKeyword,
-          constKeyword: constKeyword,
-          representation: representation,
-          implementsClause: implementsClause,
-        ),
-      );
+      if (representation != null) {
+        // TODO(scheglov): Handle missing primary constructor.
+        declarations.add(
+          builder.build(
+            typeKeyword: typeKeyword,
+            constKeyword: constKeyword,
+            representation: representation,
+            implementsClause: implementsClause,
+          ),
+        );
+      }
     } else {
       _reportFeatureNotEnabled(
         feature: ExperimentalFeatures.inline_class,
@@ -4843,6 +4847,13 @@
   }
 
   @override
+  void handleNoPrimaryConstructor(Token token, Token? constKeyword) {
+    push(constKeyword ?? const NullValue<Token>());
+
+    push(const NullValue<RepresentationDeclarationImpl>());
+  }
+
+  @override
   void handleNoTypeNameInConstructorReference(Token token) {
     debugEvent("NoTypeNameInConstructorReference");
     final builder = _classLikeBuilder as _EnumDeclarationBuilder;
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 85fdee8..0965182 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
@@ -2346,4 +2346,9 @@
       Token beginToken, Token? constKeyword, bool hasName) {
     _unsupported();
   }
+
+  @override
+  void handleNoPrimaryConstructor(Token token, Token? constKeyword) {
+    _unsupported();
+  }
 }
diff --git a/pkg/front_end/lib/src/fasta/source/diet_listener.dart b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
index 8038da2..ec09839 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -1048,6 +1048,15 @@
   }
 
   @override
+  void handleNoPrimaryConstructor(Token token, Token? constKeyword) {
+    // The current declaration is set in [beginClassOrMixinOrExtensionBody],
+    // assuming that it is currently `null`, so we reset it here.
+    // TODO(johnniwinther): Normalize the setting of the current declaration.
+    currentDeclaration = null;
+    memberScope = libraryBuilder.scope;
+  }
+
+  @override
   void endExtensionTypeDeclaration(
       Token extensionKeyword, Token typeKeyword, Token endToken) {
     debugEvent("endExtensionTypeDeclaration");
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 ff27897..8e1b480 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
@@ -350,6 +350,15 @@
   }
 
   @override
+  void handleNoPrimaryConstructor(Token token, Token? constKeyword) {
+    NoPrimaryConstructorHandle data = new NoPrimaryConstructorHandle(
+        ParserAstType.HANDLE,
+        token: token,
+        constKeyword: constKeyword);
+    seen(data);
+  }
+
+  @override
   void beginCombinators(Token token) {
     CombinatorsBegin data =
         new CombinatorsBegin(ParserAstType.BEGIN, token: token);
@@ -3652,6 +3661,21 @@
       };
 }
 
+class NoPrimaryConstructorHandle extends ParserAstNode {
+  final Token token;
+  final Token? constKeyword;
+
+  NoPrimaryConstructorHandle(ParserAstType type,
+      {required this.token, this.constKeyword})
+      : super("NoPrimaryConstructor", type);
+
+  @override
+  Map<String, Object?> get deprecatedArguments => {
+        "token": token,
+        "constKeyword": constKeyword,
+      };
+}
+
 class CombinatorsBegin extends ParserAstNode {
   final Token token;
 
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 922973b..caaf2d4 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -7083,3 +7083,21 @@
 ExtensionTypeDeclarationCause:
   problemMessage: "The issue arises via this extension type declaration."
   severity: CONTEXT
+
+MissingPrimaryConstructor:
+  problemMessage: "An extension type declaration must have a primary constructor declaration."
+  correctionMessage: "Try adding a primary constructor to the extension type declaration."
+  index: 162
+  analyzerCode: ParserErrorCode.MISSING_PRIMARY_CONSTRUCTOR
+  experiments: inline-class
+  script: |
+    extension type E {}
+
+MissingPrimaryConstructorParameters:
+  problemMessage: "A primary constructor declaration must have formal parameters."
+  correctionMessage: "Try adding formal parameters after the primary constructor name."
+  index: 163
+  analyzerCode: ParserErrorCode.MISSING_PRIMARY_CONSTRUCTOR_PARAMETERS
+  experiments: inline-class
+  script: |
+    extension type E.name {}
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/error_recovery/extension_member_contributor_test_completion.dart.intertwined.expect b/pkg/front_end/parser_testcases/error_recovery/extension_member_contributor_test_completion.dart.intertwined.expect
index e457801..1861a3e 100644
--- a/pkg/front_end/parser_testcases/error_recovery/extension_member_contributor_test_completion.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/error_recovery/extension_member_contributor_test_completion.dart.intertwined.expect
@@ -9,169 +9,170 @@
     parseTopLevelKeywordDeclaration(, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: beginTypeVariables(<)
-        parseMetadataStar(<)
-          listener: beginMetadataStar(T)
-          listener: endMetadataStar(0)
-        ensureIdentifier(<, typeVariableDeclaration)
-          listener: handleIdentifier(T, typeVariableDeclaration)
-        listener: beginTypeVariable(T)
-        listener: handleTypeVariablesDefined(num, 1)
-        listener: handleIdentifier(num, typeReference)
-        listener: handleNoTypeArguments(>)
-        listener: handleType(num, null)
-        listener: endTypeVariable(>, 0, extends, null)
-        listener: endTypeVariables(<, >)
-        listener: beginExtensionDeclaration(extension, E)
-        listener: handleIdentifier(List, typeReference)
-        listener: beginTypeArguments(<)
-        listener: handleIdentifier(T, typeReference)
-        listener: handleNoTypeArguments(>)
-        listener: handleType(T, null)
-        listener: endTypeArguments(1, <, >)
-        listener: handleType(List, null)
-        parseClassOrMixinOrExtensionBody(>, DeclarationKind.Extension, E)
-          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
-          notEofOrValue(}, bool)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, E)
-            parseMetadataStar({)
-              listener: beginMetadataStar(bool)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            parseMethod({, null, null, null, null, null, null, null, {, Instance of 'SimpleType', null, a, DeclarationKind.Extension, E, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, a)
-              listener: handleIdentifier(bool, typeReference)
-              listener: handleNoTypeArguments(a)
-              listener: handleType(bool, null)
-              ensureIdentifierPotentiallyRecovered(bool, methodDeclaration, false)
-                listener: handleIdentifier(a, methodDeclaration)
-              parseQualifiedRestOpt(a, methodDeclarationContinuation)
-              parseMethodTypeVar(a)
+        parseExtensionDeclaration(extension, extension)
+          listener: beginTypeVariables(<)
+          parseMetadataStar(<)
+            listener: beginMetadataStar(T)
+            listener: endMetadataStar(0)
+          ensureIdentifier(<, typeVariableDeclaration)
+            listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(num, 1)
+          listener: handleIdentifier(num, typeReference)
+          listener: handleNoTypeArguments(>)
+          listener: handleType(num, null)
+          listener: endTypeVariable(>, 0, extends, null)
+          listener: endTypeVariables(<, >)
+          listener: beginExtensionDeclaration(extension, E)
+          listener: handleIdentifier(List, typeReference)
+          listener: beginTypeArguments(<)
+          listener: handleIdentifier(T, typeReference)
+          listener: handleNoTypeArguments(>)
+          listener: handleType(T, null)
+          listener: endTypeArguments(1, <, >)
+          listener: handleType(List, null)
+          parseClassOrMixinOrExtensionBody(>, DeclarationKind.Extension, E)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+            notEofOrValue(}, bool)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, E)
+              parseMetadataStar({)
+                listener: beginMetadataStar(bool)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              parseMethod({, null, null, null, null, null, null, null, {, Instance of 'SimpleType', null, a, DeclarationKind.Extension, E, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, a)
+                listener: handleIdentifier(bool, typeReference)
+                listener: handleNoTypeArguments(a)
+                listener: handleType(bool, null)
+                ensureIdentifierPotentiallyRecovered(bool, methodDeclaration, false)
+                  listener: handleIdentifier(a, methodDeclaration)
+                parseQualifiedRestOpt(a, methodDeclarationContinuation)
+                parseMethodTypeVar(a)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(a, a, false, MemberKind.ExtensionNonStaticMethod)
+                  parseFormalParameters(a, MemberKind.ExtensionNonStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(int)
+                          listener: endMetadataStar(0)
+                        listener: beginFormalParameter(int, MemberKind.ExtensionNonStaticMethod, null, null, null)
+                        listener: handleIdentifier(int, typeReference)
+                        listener: handleNoTypeArguments(b)
+                        listener: handleType(int, null)
+                        ensureIdentifier(int, formalParameterDeclaration)
+                          listener: handleIdentifier(b, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue(,)
+                        listener: endFormalParameter(null, null, null, b, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                      parseFormalParameter(,, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                        parseMetadataStar(,)
+                          listener: beginMetadataStar(int)
+                          listener: endMetadataStar(0)
+                        listener: beginFormalParameter(int, MemberKind.ExtensionNonStaticMethod, null, null, null)
+                        listener: handleIdentifier(int, typeReference)
+                        listener: handleNoTypeArguments(c)
+                        listener: handleType(int, null)
+                        ensureIdentifier(int, formalParameterDeclaration)
+                          listener: handleIdentifier(c, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, c, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                      listener: endFormalParameters(2, (, ), MemberKind.ExtensionNonStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
+                inPlainSync()
+                parseFunctionBody(), false, true)
+                  listener: beginBlockFunctionBody({)
+                  notEofOrValue(}, })
+                  listener: endBlockFunctionBody(0, {, })
+                listener: endExtensionMethod(null, bool, (, null, })
+              listener: endMember()
+            notEofOrValue(}, int)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Extension, E)
+              parseMetadataStar(})
+                listener: beginMetadataStar(int)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              parseMethod(}, null, null, null, null, null, null, null, }, Instance of 'SimpleType', get, b, DeclarationKind.Extension, E, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, get, b)
+                listener: handleIdentifier(int, typeReference)
+                listener: handleNoTypeArguments(get)
+                listener: handleType(int, null)
+                ensureIdentifierPotentiallyRecovered(get, methodDeclaration, false)
+                  listener: handleIdentifier(b, methodDeclaration)
+                parseQualifiedRestOpt(b, methodDeclarationContinuation)
+                listener: handleNoTypeVariables(=>)
+                parseGetterOrFormalParameters(b, b, true, MemberKind.ExtensionNonStaticMethod)
+                  listener: handleNoFormalParameters(=>, MemberKind.ExtensionNonStaticMethod)
+                parseInitializersOpt(b)
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt(b)
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
+                inPlainSync()
+                inPlainSync()
+                parseFunctionBody(b, false, true)
+                  parseExpressionFunctionBody(=>, false)
+                    parseExpression(=>)
+                      parsePrecedenceExpression(=>, 1, true, ConstantPatternContext.none)
+                        parseUnaryExpression(=>, true, ConstantPatternContext.none)
+                          parsePrimary(=>, expression, ConstantPatternContext.none)
+                            parseLiteralInt(=>)
+                              listener: handleLiteralInt(0)
+                    ensureSemicolon(0)
+                    listener: handleExpressionFunctionBody(=>, ;)
+                    inGenerator()
+                listener: endExtensionMethod(get, int, =>, null, ;)
+              listener: endMember()
+            notEofOrValue(}, set)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl(;, DeclarationKind.Extension, E)
+              parseMetadataStar(;)
+                listener: beginMetadataStar(set)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              parseMethod(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', set, c, DeclarationKind.Extension, E, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, set, c)
+                listener: handleNoType(;)
+                ensureIdentifierPotentiallyRecovered(set, methodDeclaration, false)
+                  listener: handleIdentifier(c, methodDeclaration)
+                parseQualifiedRestOpt(c, methodDeclarationContinuation)
                 listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(a, a, false, MemberKind.ExtensionNonStaticMethod)
-                parseFormalParameters(a, MemberKind.ExtensionNonStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(int)
-                        listener: endMetadataStar(0)
-                      listener: beginFormalParameter(int, MemberKind.ExtensionNonStaticMethod, null, null, null)
-                      listener: handleIdentifier(int, typeReference)
-                      listener: handleNoTypeArguments(b)
-                      listener: handleType(int, null)
-                      ensureIdentifier(int, formalParameterDeclaration)
-                        listener: handleIdentifier(b, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue(,)
-                      listener: endFormalParameter(null, null, null, b, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                    parseFormalParameter(,, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                      parseMetadataStar(,)
-                        listener: beginMetadataStar(int)
-                        listener: endMetadataStar(0)
-                      listener: beginFormalParameter(int, MemberKind.ExtensionNonStaticMethod, null, null, null)
-                      listener: handleIdentifier(int, typeReference)
-                      listener: handleNoTypeArguments(c)
-                      listener: handleType(int, null)
-                      ensureIdentifier(int, formalParameterDeclaration)
-                        listener: handleIdentifier(c, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, c, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                    listener: endFormalParameters(2, (, ), MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
+                parseGetterOrFormalParameters(c, c, false, MemberKind.ExtensionNonStaticMethod)
+                  parseFormalParameters(c, MemberKind.ExtensionNonStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(int)
+                          listener: endMetadataStar(0)
+                        listener: beginFormalParameter(int, MemberKind.ExtensionNonStaticMethod, null, null, null)
+                        listener: handleIdentifier(int, typeReference)
+                        listener: handleNoTypeArguments(d)
+                        listener: handleType(int, null)
+                        ensureIdentifier(int, formalParameterDeclaration)
+                          listener: handleIdentifier(d, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, d, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                      listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
                 inPlainSync()
-              inPlainSync()
-              parseFunctionBody(), false, true)
-                listener: beginBlockFunctionBody({)
-                notEofOrValue(}, })
-                listener: endBlockFunctionBody(0, {, })
-              listener: endExtensionMethod(null, bool, (, null, })
-            listener: endMember()
-          notEofOrValue(}, int)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Extension, E)
-            parseMetadataStar(})
-              listener: beginMetadataStar(int)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            parseMethod(}, null, null, null, null, null, null, null, }, Instance of 'SimpleType', get, b, DeclarationKind.Extension, E, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, get, b)
-              listener: handleIdentifier(int, typeReference)
-              listener: handleNoTypeArguments(get)
-              listener: handleType(int, null)
-              ensureIdentifierPotentiallyRecovered(get, methodDeclaration, false)
-                listener: handleIdentifier(b, methodDeclaration)
-              parseQualifiedRestOpt(b, methodDeclarationContinuation)
-              listener: handleNoTypeVariables(=>)
-              parseGetterOrFormalParameters(b, b, true, MemberKind.ExtensionNonStaticMethod)
-                listener: handleNoFormalParameters(=>, MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt(b)
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt(b)
-                listener: handleAsyncModifier(null, null)
                 inPlainSync()
-              inPlainSync()
-              inPlainSync()
-              parseFunctionBody(b, false, true)
-                parseExpressionFunctionBody(=>, false)
-                  parseExpression(=>)
-                    parsePrecedenceExpression(=>, 1, true, ConstantPatternContext.none)
-                      parseUnaryExpression(=>, true, ConstantPatternContext.none)
-                        parsePrimary(=>, expression, ConstantPatternContext.none)
-                          parseLiteralInt(=>)
-                            listener: handleLiteralInt(0)
-                  ensureSemicolon(0)
-                  listener: handleExpressionFunctionBody(=>, ;)
-                  inGenerator()
-              listener: endExtensionMethod(get, int, =>, null, ;)
-            listener: endMember()
-          notEofOrValue(}, set)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl(;, DeclarationKind.Extension, E)
-            parseMetadataStar(;)
-              listener: beginMetadataStar(set)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            parseMethod(;, null, null, null, null, null, null, null, ;, Instance of 'NoType', set, c, DeclarationKind.Extension, E, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, set, c)
-              listener: handleNoType(;)
-              ensureIdentifierPotentiallyRecovered(set, methodDeclaration, false)
-                listener: handleIdentifier(c, methodDeclaration)
-              parseQualifiedRestOpt(c, methodDeclarationContinuation)
-              listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(c, c, false, MemberKind.ExtensionNonStaticMethod)
-                parseFormalParameters(c, MemberKind.ExtensionNonStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(int)
-                        listener: endMetadataStar(0)
-                      listener: beginFormalParameter(int, MemberKind.ExtensionNonStaticMethod, null, null, null)
-                      listener: handleIdentifier(int, typeReference)
-                      listener: handleNoTypeArguments(d)
-                      listener: handleType(int, null)
-                      ensureIdentifier(int, formalParameterDeclaration)
-                        listener: handleIdentifier(d, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, d, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                    listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
-                inPlainSync()
-              inPlainSync()
-              inPlainSync()
-              parseFunctionBody(), false, true)
-                listener: beginBlockFunctionBody({)
-                notEofOrValue(}, })
-                listener: endBlockFunctionBody(0, {, })
-              listener: endExtensionMethod(set, set, (, null, })
-            listener: endMember()
-          notEofOrValue(}, })
-          listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 3, {, })
-        listener: endExtensionDeclaration(extension, on, })
+                parseFunctionBody(), false, true)
+                  listener: beginBlockFunctionBody({)
+                  notEofOrValue(}, })
+                  listener: endBlockFunctionBody(0, {, })
+                listener: endExtensionMethod(set, set, (, null, })
+              listener: endMember()
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 3, {, })
+          listener: endExtensionDeclaration(extension, on, })
   listener: endTopLevelDeclaration(void)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
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 685072b..809ea94 100644
--- a/pkg/front_end/parser_testcases/extension_named_type.dart.expect
+++ b/pkg/front_end/parser_testcases/extension_named_type.dart.expect
@@ -1,3 +1,17 @@
+Problems reported:
+
+parser/extension_named_type:3:16: An extension type declaration must have a primary constructor declaration.
+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.
+extension type on A {
+                  ^
+
 beginCompilationUnit(class)
   beginMetadataStar(class)
   endMetadataStar(0)
@@ -17,29 +31,45 @@
   beginMetadataStar(extension)
   endMetadataStar(0)
   beginExtensionDeclarationPrelude(extension)
-    handleNoTypeVariables(on)
-    beginExtensionDeclaration(extension, type)
-      handleIdentifier(A, typeReference)
-      handleNoTypeArguments({)
-      handleType(A, null)
-      beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+    handleNoTypeVariables(A)
+    beginExtensionTypeDeclaration(extension, on)
+      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)
+      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)
-        beginMember()
-          beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, method)
-            handleNoType({)
-            handleIdentifier(method, methodDeclaration)
-            handleNoTypeVariables(()
-            beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-            endFormalParameters(0, (, ), MemberKind.ExtensionNonStaticMethod)
-            handleNoInitializers()
-            handleAsyncModifier(null, null)
-            beginBlockFunctionBody({)
-            endBlockFunctionBody(0, {, })
-          endExtensionMethod(null, method, (, null, })
-        endMember()
-      endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 1, {, })
-    endExtensionDeclaration(extension, on, })
+        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, })
   endTopLevelDeclaration(test)
   beginMetadataStar(test)
   endMetadataStar(0)
@@ -83,4 +113,4 @@
       handleExpressionFunctionBody(=>, ;)
     endTopLevelMethod(test, null, ;)
   endTopLevelDeclaration()
-endCompilationUnit(3, )
+endCompilationUnit(4, )
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 2021d1c..dab868b 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
@@ -36,48 +36,86 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(on)
-        listener: beginExtensionDeclaration(extension, type)
-        listener: handleIdentifier(A, typeReference)
-        listener: handleNoTypeArguments({)
-        listener: handleType(A, null)
-        parseClassOrMixinOrExtensionBody(A, DeclarationKind.Extension, type)
-          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(A)
+          listener: beginExtensionTypeDeclaration(extension, on)
+          reportRecoverableError(on, MissingPrimaryConstructor)
+            listener: handleRecoverableError(MissingPrimaryConstructor, on, on)
+          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)
+            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)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, type)
-            parseMetadataStar({)
-              listener: beginMetadataStar(method)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            isReservedKeyword(()
-            parseMethod({, null, null, null, null, null, null, null, {, Instance of 'NoType', null, method, DeclarationKind.Extension, type, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, method)
-              listener: handleNoType({)
-              ensureIdentifierPotentiallyRecovered({, methodDeclaration, false)
-                listener: handleIdentifier(method, methodDeclaration)
-              parseQualifiedRestOpt(method, methodDeclarationContinuation)
-              parseMethodTypeVar(method)
+          parseStatement({)
+            parseStatementX({)
+              parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, null)
+                looksLikeLocalFunction(method)
+                listener: beginMetadataStar(method)
+                listener: endMetadataStar(0)
                 listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(method, method, false, MemberKind.ExtensionNonStaticMethod)
-                parseFormalParameters(method, MemberKind.ExtensionNonStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-                    listener: endFormalParameters(0, (, ), MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
-                inPlainSync()
-              inPlainSync()
-              parseFunctionBody(), false, true)
-                listener: beginBlockFunctionBody({)
-                notEofOrValue(}, })
-                listener: endBlockFunctionBody(0, {, })
-              listener: endExtensionMethod(null, method, (, null, })
-            listener: endMember()
+                listener: beginLocalFunctionDeclaration(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: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 1, {, })
-        listener: endExtensionDeclaration(extension, on, })
+          listener: endBlockFunctionBody(1, {, })
+        listener: endTopLevelMethod(A, null, })
   listener: endTopLevelDeclaration(test)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
@@ -173,4 +211,4 @@
         listener: endTopLevelMethod(test, null, ;)
   listener: endTopLevelDeclaration()
   reportAllErrorTokens(class)
-  listener: endCompilationUnit(3, )
+  listener: endCompilationUnit(4, )
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 04658d0..43297dc 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,6 +1,8 @@
+NOTICE: Stream was rewritten by parser!
+
 class A {}
 
-extension type on A {
+extension type on {}A (){
 method() {}
 }
 
@@ -9,7 +11,7 @@
 
 class[KeywordToken] A[StringToken] {[BeginToken]}[SimpleToken]
 
-extension[KeywordToken] type[StringToken] on[KeywordToken] A[StringToken] {[BeginToken]
+extension[KeywordToken] type[StringToken] on[KeywordToken] {[SyntheticBeginToken]}[SyntheticToken]A[StringToken] ([SyntheticBeginToken])[SyntheticToken]{[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 d5f6384..d31819a 100644
--- a/pkg/front_end/parser_testcases/extension_type.dart.expect
+++ b/pkg/front_end/parser_testcases/extension_type.dart.expect
@@ -1,8 +1,16 @@
 Problems reported:
 
-parser/extension_type:3:18: Unexpected token 'on'.
+parser/extension_type:3:16: An extension type declaration must have a primary constructor declaration.
 extension type E on A {}
-                 ^^
+               ^
+
+parser/extension_type:3:16: A extension type declaration must have a body, even if it is empty.
+extension type E on A {}
+               ^
+
+parser/extension_type:3:21: A function declaration needs an explicit list of parameters.
+extension type E on A {}
+                    ^
 
 beginCompilationUnit(class)
   beginMetadataStar(class)
@@ -24,13 +32,30 @@
   endMetadataStar(0)
   beginExtensionDeclarationPrelude(extension)
     handleNoTypeVariables(on)
-    handleRecoverableError(Message[UnexpectedToken, Unexpected token 'on'., null, {lexeme: on}], on, on)
-    beginExtensionDeclaration(extension, E)
-      handleIdentifier(A, typeReference)
-      handleNoTypeArguments({)
-      handleType(A, null)
-      beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
-      endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 0, {, })
-    endExtensionDeclaration(extension, on, })
+    beginExtensionTypeDeclaration(extension, E)
+      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)
+      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(2, )
+endCompilationUnit(3, )
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 ee148fd..ebe29da 100644
--- a/pkg/front_end/parser_testcases/extension_type.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extension_type.dart.intertwined.expect
@@ -36,18 +36,57 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(on)
-        reportRecoverableError(on, Message[UnexpectedToken, Unexpected token 'on'., null, {lexeme: on}])
-          listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token 'on'., null, {lexeme: on}], on, on)
-        listener: beginExtensionDeclaration(extension, E)
-        listener: handleIdentifier(A, typeReference)
-        listener: handleNoTypeArguments({)
-        listener: handleType(A, null)
-        parseClassOrMixinOrExtensionBody(A, DeclarationKind.Extension, E)
-          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(on)
+          listener: beginExtensionTypeDeclaration(extension, E)
+          reportRecoverableError(E, MissingPrimaryConstructor)
+            listener: handleRecoverableError(MissingPrimaryConstructor, E, E)
+          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)
+            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: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 0, {, })
-        listener: endExtensionDeclaration(extension, on, })
+          listener: endBlockFunctionBody(0, {, })
+        listener: endTopLevelMethod(on, null, })
   listener: endTopLevelDeclaration()
   reportAllErrorTokens(class)
-  listener: endCompilationUnit(2, )
+  listener: endCompilationUnit(3, )
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 0a015a7..5418181 100644
--- a/pkg/front_end/parser_testcases/extension_type.dart.parser.expect
+++ b/pkg/front_end/parser_testcases/extension_type.dart.parser.expect
@@ -1,9 +1,11 @@
+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] on[KeywordToken] A[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] E[StringToken] {[SyntheticBeginToken]}[SyntheticToken]on[KeywordToken] A[StringToken] ([SyntheticBeginToken])[SyntheticToken]{[BeginToken]}[SimpleToken]
 [SimpleToken]
diff --git a/pkg/front_end/parser_testcases/extensions/const.dart.intertwined.expect b/pkg/front_end/parser_testcases/extensions/const.dart.intertwined.expect
index 6fdee83..fae3c4d 100644
--- a/pkg/front_end/parser_testcases/extensions/const.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extensions/const.dart.intertwined.expect
@@ -9,28 +9,29 @@
     parseTopLevelKeywordDeclaration(, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(const)
-        listener: beginExtensionDeclaration(extension, null)
-        reportRecoverableError(extension, Message[ExpectedAfterButGot, Expected 'on' after this., null, {string: on}])
-          listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected 'on' after this., null, {string: on}], extension, extension)
-        rewriter()
-        reportRecoverableErrorWithToken(const, Instance of 'Template<(Token) => Message>')
-          listener: handleRecoverableError(Message[ExpectedType, Expected a type, but got 'const'., null, {lexeme: const}], const, const)
-        rewriter()
-        listener: handleIdentifier(, typeReference)
-        listener: handleNoTypeArguments(const)
-        listener: handleType(, null)
-        ensureBlock(, null, extension declaration)
-          reportRecoverableError(, Message[ExpectedClassOrMixinBody, A extension declaration must have a body, even if it is empty., Try adding an empty body., {string: extension declaration}])
-            listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension declaration must have a body, even if it is empty., Try adding an empty body., {string: extension declaration}], const, const)
-          insertBlock()
-            rewriter()
-            rewriter()
-        parseClassOrMixinOrExtensionBody(, DeclarationKind.Extension, null)
-          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
-          notEofOrValue(}, })
-          listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 0, {, })
-        listener: endExtensionDeclaration(extension, on, })
+        parseExtensionDeclaration(extension, extension)
+          listener: handleNoTypeVariables(const)
+          listener: beginExtensionDeclaration(extension, null)
+          reportRecoverableError(extension, Message[ExpectedAfterButGot, Expected 'on' after this., null, {string: on}])
+            listener: handleRecoverableError(Message[ExpectedAfterButGot, Expected 'on' after this., null, {string: on}], extension, extension)
+          rewriter()
+          reportRecoverableErrorWithToken(const, Instance of 'Template<(Token) => Message>')
+            listener: handleRecoverableError(Message[ExpectedType, Expected a type, but got 'const'., null, {lexeme: const}], const, const)
+          rewriter()
+          listener: handleIdentifier(, typeReference)
+          listener: handleNoTypeArguments(const)
+          listener: handleType(, null)
+          ensureBlock(, null, extension declaration)
+            reportRecoverableError(, Message[ExpectedClassOrMixinBody, A extension declaration must have a body, even if it is empty., Try adding an empty body., {string: extension declaration}])
+              listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension declaration must have a body, even if it is empty., Try adding an empty body., {string: extension declaration}], const, const)
+            insertBlock()
+              rewriter()
+              rewriter()
+          parseClassOrMixinOrExtensionBody(, DeclarationKind.Extension, null)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 0, {, })
+          listener: endExtensionDeclaration(extension, on, })
   listener: endTopLevelDeclaration(const)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
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 c6b3538..1242442 100644
--- a/pkg/front_end/parser_testcases/extensions/covariant.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extensions/covariant.dart.intertwined.expect
@@ -66,62 +66,63 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(on)
-        listener: beginExtensionDeclaration(extension, null)
-        listener: handleIdentifier(C, typeReference)
-        listener: handleNoTypeArguments({)
-        listener: handleType(C, null)
-        parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
-          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
-          notEofOrValue(}, addChild)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, null)
-            parseMetadataStar({)
-              listener: beginMetadataStar(addChild)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            isReservedKeyword(()
-            parseMethod({, null, null, null, null, null, null, null, {, Instance of 'NoType', null, addChild, DeclarationKind.Extension, null, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, addChild)
-              listener: handleNoType({)
-              ensureIdentifierPotentiallyRecovered({, methodDeclaration, false)
-                listener: handleIdentifier(addChild, methodDeclaration)
-              parseQualifiedRestOpt(addChild, methodDeclarationContinuation)
-              parseMethodTypeVar(addChild)
-                listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(addChild, addChild, false, MemberKind.ExtensionNonStaticMethod)
-                parseFormalParameters(addChild, MemberKind.ExtensionNonStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(covariant)
-                        listener: endMetadataStar(0)
-                      reportRecoverableErrorWithToken(covariant, Instance of 'Template<(Token) => Message>')
-                        listener: handleRecoverableError(Message[ExtraneousModifierInExtension, Can't have modifier 'covariant' in an extension., Try removing 'covariant'., {lexeme: covariant}], covariant, covariant)
-                      listener: beginFormalParameter(covariant, MemberKind.ExtensionNonStaticMethod, null, covariant, null)
-                      listener: handleIdentifier(A, typeReference)
-                      listener: handleNoTypeArguments(child)
-                      listener: handleType(A, null)
-                      ensureIdentifier(A, formalParameterDeclaration)
-                        listener: handleIdentifier(child, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, child, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                    listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
+        parseExtensionDeclaration(extension, extension)
+          listener: handleNoTypeVariables(on)
+          listener: beginExtensionDeclaration(extension, null)
+          listener: handleIdentifier(C, typeReference)
+          listener: handleNoTypeArguments({)
+          listener: handleType(C, null)
+          parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+            notEofOrValue(}, addChild)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, null)
+              parseMetadataStar({)
+                listener: beginMetadataStar(addChild)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              isReservedKeyword(()
+              parseMethod({, null, null, null, null, null, null, null, {, Instance of 'NoType', null, addChild, DeclarationKind.Extension, null, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, addChild)
+                listener: handleNoType({)
+                ensureIdentifierPotentiallyRecovered({, methodDeclaration, false)
+                  listener: handleIdentifier(addChild, methodDeclaration)
+                parseQualifiedRestOpt(addChild, methodDeclarationContinuation)
+                parseMethodTypeVar(addChild)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(addChild, addChild, false, MemberKind.ExtensionNonStaticMethod)
+                  parseFormalParameters(addChild, MemberKind.ExtensionNonStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(covariant)
+                          listener: endMetadataStar(0)
+                        reportRecoverableErrorWithToken(covariant, Instance of 'Template<(Token) => Message>')
+                          listener: handleRecoverableError(Message[ExtraneousModifierInExtension, Can't have modifier 'covariant' in an extension., Try removing 'covariant'., {lexeme: covariant}], covariant, covariant)
+                        listener: beginFormalParameter(covariant, MemberKind.ExtensionNonStaticMethod, null, covariant, null)
+                        listener: handleIdentifier(A, typeReference)
+                        listener: handleNoTypeArguments(child)
+                        listener: handleType(A, null)
+                        ensureIdentifier(A, formalParameterDeclaration)
+                          listener: handleIdentifier(child, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, child, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                      listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
                 inPlainSync()
-              inPlainSync()
-              parseFunctionBody(), false, true)
-                listener: beginBlockFunctionBody({)
-                notEofOrValue(}, })
-                listener: endBlockFunctionBody(0, {, })
-              listener: endExtensionMethod(null, addChild, (, null, })
-            listener: endMember()
-          notEofOrValue(}, })
-          listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 1, {, })
-        listener: endExtensionDeclaration(extension, on, })
+                parseFunctionBody(), false, true)
+                  listener: beginBlockFunctionBody({)
+                  notEofOrValue(}, })
+                  listener: endBlockFunctionBody(0, {, })
+                listener: endExtensionMethod(null, addChild, (, null, })
+              listener: endMember()
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 1, {, })
+          listener: endExtensionDeclaration(extension, on, })
   listener: endTopLevelDeclaration()
   reportAllErrorTokens(class)
   listener: endCompilationUnit(3, )
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 77ca98a..97aaf20 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
@@ -66,60 +66,61 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(on)
-        listener: beginExtensionDeclaration(extension, null)
-        listener: handleIdentifier(C, typeReference)
-        listener: handleNoTypeArguments({)
-        listener: handleType(C, null)
-        parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
-          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
-          notEofOrValue(}, addChild)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, null)
-            parseMetadataStar({)
-              listener: beginMetadataStar(addChild)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            isReservedKeyword(()
-            parseMethod({, null, null, null, null, null, null, null, {, Instance of 'NoType', null, addChild, DeclarationKind.Extension, null, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, addChild)
-              listener: handleNoType({)
-              ensureIdentifierPotentiallyRecovered({, methodDeclaration, false)
-                listener: handleIdentifier(addChild, methodDeclaration)
-              parseQualifiedRestOpt(addChild, methodDeclarationContinuation)
-              parseMethodTypeVar(addChild)
-                listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(addChild, addChild, false, MemberKind.ExtensionNonStaticMethod)
-                parseFormalParameters(addChild, MemberKind.ExtensionNonStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(A)
-                        listener: endMetadataStar(0)
-                      listener: beginFormalParameter(A, MemberKind.ExtensionNonStaticMethod, null, null, null)
-                      listener: handleIdentifier(A, typeReference)
-                      listener: handleNoTypeArguments(child)
-                      listener: handleType(A, null)
-                      ensureIdentifier(A, formalParameterDeclaration)
-                        listener: handleIdentifier(child, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, child, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                    listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
+        parseExtensionDeclaration(extension, extension)
+          listener: handleNoTypeVariables(on)
+          listener: beginExtensionDeclaration(extension, null)
+          listener: handleIdentifier(C, typeReference)
+          listener: handleNoTypeArguments({)
+          listener: handleType(C, null)
+          parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+            notEofOrValue(}, addChild)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, null)
+              parseMetadataStar({)
+                listener: beginMetadataStar(addChild)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              isReservedKeyword(()
+              parseMethod({, null, null, null, null, null, null, null, {, Instance of 'NoType', null, addChild, DeclarationKind.Extension, null, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, addChild)
+                listener: handleNoType({)
+                ensureIdentifierPotentiallyRecovered({, methodDeclaration, false)
+                  listener: handleIdentifier(addChild, methodDeclaration)
+                parseQualifiedRestOpt(addChild, methodDeclarationContinuation)
+                parseMethodTypeVar(addChild)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(addChild, addChild, false, MemberKind.ExtensionNonStaticMethod)
+                  parseFormalParameters(addChild, MemberKind.ExtensionNonStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(A)
+                          listener: endMetadataStar(0)
+                        listener: beginFormalParameter(A, MemberKind.ExtensionNonStaticMethod, null, null, null)
+                        listener: handleIdentifier(A, typeReference)
+                        listener: handleNoTypeArguments(child)
+                        listener: handleType(A, null)
+                        ensureIdentifier(A, formalParameterDeclaration)
+                          listener: handleIdentifier(child, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, child, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                      listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
                 inPlainSync()
-              inPlainSync()
-              parseFunctionBody(), false, true)
-                listener: beginBlockFunctionBody({)
-                notEofOrValue(}, })
-                listener: endBlockFunctionBody(0, {, })
-              listener: endExtensionMethod(null, addChild, (, null, })
-            listener: endMember()
-          notEofOrValue(}, })
-          listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 1, {, })
-        listener: endExtensionDeclaration(extension, on, })
+                parseFunctionBody(), false, true)
+                  listener: beginBlockFunctionBody({)
+                  notEofOrValue(}, })
+                  listener: endBlockFunctionBody(0, {, })
+                listener: endExtensionMethod(null, addChild, (, null, })
+              listener: endMember()
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 1, {, })
+          listener: endExtensionDeclaration(extension, on, })
   listener: endTopLevelDeclaration()
   reportAllErrorTokens(class)
   listener: endCompilationUnit(3, )
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 cb51159..7f15cee 100644
--- a/pkg/front_end/parser_testcases/extensions/static.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/extensions/static.dart.intertwined.expect
@@ -66,59 +66,60 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(on)
-        listener: beginExtensionDeclaration(extension, null)
-        listener: handleIdentifier(C, typeReference)
-        listener: handleNoTypeArguments({)
-        listener: handleType(C, null)
-        parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
-          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
-          notEofOrValue(}, static)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, null)
-            parseMetadataStar({)
-              listener: beginMetadataStar(static)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            isReservedKeyword(()
-            parseMethod({, null, null, null, static, null, null, null, static, Instance of 'NoType', null, addChild, DeclarationKind.Extension, null, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, static, null, null, null, addChild)
-              listener: handleNoType(static)
-              ensureIdentifierPotentiallyRecovered(static, methodDeclaration, false)
-                listener: handleIdentifier(addChild, methodDeclaration)
-              parseQualifiedRestOpt(addChild, methodDeclarationContinuation)
-              parseMethodTypeVar(addChild)
-                listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(addChild, addChild, false, MemberKind.ExtensionStaticMethod)
-                parseFormalParameters(addChild, MemberKind.ExtensionStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(A)
-                        listener: endMetadataStar(0)
-                      listener: beginFormalParameter(A, MemberKind.ExtensionStaticMethod, null, null, null)
-                      listener: handleIdentifier(A, typeReference)
-                      listener: handleNoTypeArguments(child)
-                      listener: handleType(A, null)
-                      ensureIdentifier(A, formalParameterDeclaration)
-                        listener: handleIdentifier(child, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, child, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionStaticMethod)
-                    listener: endFormalParameters(1, (, ), MemberKind.ExtensionStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
-                inPlainSync()
-              parseFunctionBody(), false, false)
-                listener: beginBlockFunctionBody({)
-                notEofOrValue(}, })
-                listener: endBlockFunctionBody(0, {, })
-              listener: endExtensionMethod(null, static, (, null, })
-            listener: endMember()
-          notEofOrValue(}, })
-          listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 1, {, })
-        listener: endExtensionDeclaration(extension, on, })
+        parseExtensionDeclaration(extension, extension)
+          listener: handleNoTypeVariables(on)
+          listener: beginExtensionDeclaration(extension, null)
+          listener: handleIdentifier(C, typeReference)
+          listener: handleNoTypeArguments({)
+          listener: handleType(C, null)
+          parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+            notEofOrValue(}, static)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, null)
+              parseMetadataStar({)
+                listener: beginMetadataStar(static)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              isReservedKeyword(()
+              parseMethod({, null, null, null, static, null, null, null, static, Instance of 'NoType', null, addChild, DeclarationKind.Extension, null, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, static, null, null, null, addChild)
+                listener: handleNoType(static)
+                ensureIdentifierPotentiallyRecovered(static, methodDeclaration, false)
+                  listener: handleIdentifier(addChild, methodDeclaration)
+                parseQualifiedRestOpt(addChild, methodDeclarationContinuation)
+                parseMethodTypeVar(addChild)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(addChild, addChild, false, MemberKind.ExtensionStaticMethod)
+                  parseFormalParameters(addChild, MemberKind.ExtensionStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(A)
+                          listener: endMetadataStar(0)
+                        listener: beginFormalParameter(A, MemberKind.ExtensionStaticMethod, null, null, null)
+                        listener: handleIdentifier(A, typeReference)
+                        listener: handleNoTypeArguments(child)
+                        listener: handleType(A, null)
+                        ensureIdentifier(A, formalParameterDeclaration)
+                          listener: handleIdentifier(child, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, child, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionStaticMethod)
+                      listener: endFormalParameters(1, (, ), MemberKind.ExtensionStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
+                parseFunctionBody(), false, false)
+                  listener: beginBlockFunctionBody({)
+                  notEofOrValue(}, })
+                  listener: endBlockFunctionBody(0, {, })
+                listener: endExtensionMethod(null, static, (, null, })
+              listener: endMember()
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 1, {, })
+          listener: endExtensionDeclaration(extension, on, })
   listener: endTopLevelDeclaration()
   reportAllErrorTokens(class)
   listener: endCompilationUnit(3, )
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 302d09a..e9464fa 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
@@ -66,61 +66,62 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(on)
-        listener: beginExtensionDeclaration(extension, null)
-        listener: handleIdentifier(C, typeReference)
-        listener: handleNoTypeArguments({)
-        listener: handleType(C, null)
-        parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
-          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
-          notEofOrValue(}, static)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, null)
-            parseMetadataStar({)
-              listener: beginMetadataStar(static)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            isReservedKeyword(()
-            parseMethod({, null, null, null, static, null, null, null, static, Instance of 'NoType', null, addChild, DeclarationKind.Extension, null, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, static, null, null, null, addChild)
-              listener: handleNoType(static)
-              ensureIdentifierPotentiallyRecovered(static, methodDeclaration, false)
-                listener: handleIdentifier(addChild, methodDeclaration)
-              parseQualifiedRestOpt(addChild, methodDeclarationContinuation)
-              parseMethodTypeVar(addChild)
-                listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(addChild, addChild, false, MemberKind.ExtensionStaticMethod)
-                parseFormalParameters(addChild, MemberKind.ExtensionStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(covariant)
-                        listener: endMetadataStar(0)
-                      reportRecoverableErrorWithToken(covariant, Instance of 'Template<(Token) => Message>')
-                        listener: handleRecoverableError(Message[ExtraneousModifierInExtension, Can't have modifier 'covariant' in an extension., Try removing 'covariant'., {lexeme: covariant}], covariant, covariant)
-                      listener: beginFormalParameter(covariant, MemberKind.ExtensionStaticMethod, null, covariant, null)
-                      listener: handleIdentifier(A, typeReference)
-                      listener: handleNoTypeArguments(child)
-                      listener: handleType(A, null)
-                      ensureIdentifier(A, formalParameterDeclaration)
-                        listener: handleIdentifier(child, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, child, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionStaticMethod)
-                    listener: endFormalParameters(1, (, ), MemberKind.ExtensionStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
-                inPlainSync()
-              parseFunctionBody(), false, false)
-                listener: beginBlockFunctionBody({)
-                notEofOrValue(}, })
-                listener: endBlockFunctionBody(0, {, })
-              listener: endExtensionMethod(null, static, (, null, })
-            listener: endMember()
-          notEofOrValue(}, })
-          listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 1, {, })
-        listener: endExtensionDeclaration(extension, on, })
+        parseExtensionDeclaration(extension, extension)
+          listener: handleNoTypeVariables(on)
+          listener: beginExtensionDeclaration(extension, null)
+          listener: handleIdentifier(C, typeReference)
+          listener: handleNoTypeArguments({)
+          listener: handleType(C, null)
+          parseClassOrMixinOrExtensionBody(C, DeclarationKind.Extension, null)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+            notEofOrValue(}, static)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, null)
+              parseMetadataStar({)
+                listener: beginMetadataStar(static)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              isReservedKeyword(()
+              parseMethod({, null, null, null, static, null, null, null, static, Instance of 'NoType', null, addChild, DeclarationKind.Extension, null, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, static, null, null, null, addChild)
+                listener: handleNoType(static)
+                ensureIdentifierPotentiallyRecovered(static, methodDeclaration, false)
+                  listener: handleIdentifier(addChild, methodDeclaration)
+                parseQualifiedRestOpt(addChild, methodDeclarationContinuation)
+                parseMethodTypeVar(addChild)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(addChild, addChild, false, MemberKind.ExtensionStaticMethod)
+                  parseFormalParameters(addChild, MemberKind.ExtensionStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(covariant)
+                          listener: endMetadataStar(0)
+                        reportRecoverableErrorWithToken(covariant, Instance of 'Template<(Token) => Message>')
+                          listener: handleRecoverableError(Message[ExtraneousModifierInExtension, Can't have modifier 'covariant' in an extension., Try removing 'covariant'., {lexeme: covariant}], covariant, covariant)
+                        listener: beginFormalParameter(covariant, MemberKind.ExtensionStaticMethod, null, covariant, null)
+                        listener: handleIdentifier(A, typeReference)
+                        listener: handleNoTypeArguments(child)
+                        listener: handleType(A, null)
+                        ensureIdentifier(A, formalParameterDeclaration)
+                          listener: handleIdentifier(child, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, child, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionStaticMethod)
+                      listener: endFormalParameters(1, (, ), MemberKind.ExtensionStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
+                parseFunctionBody(), false, false)
+                  listener: beginBlockFunctionBody({)
+                  notEofOrValue(}, })
+                  listener: endBlockFunctionBody(0, {, })
+                listener: endExtensionMethod(null, static, (, null, })
+              listener: endMember()
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 1, {, })
+          listener: endExtensionDeclaration(extension, on, })
   listener: endTopLevelDeclaration()
   reportAllErrorTokens(class)
   listener: endCompilationUnit(3, )
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 834157b..90a3382 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
@@ -125,18 +125,19 @@
     parseTopLevelKeywordDeclaration(;, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        reportRecoverableErrorWithToken(Function, Instance of 'Template<(Token) => Message>')
-          listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'Function' as a name here., null, {lexeme: Function}], Function, Function)
-        listener: handleNoTypeVariables(on)
-        listener: beginExtensionDeclaration(extension, Function)
-        listener: handleIdentifier(List, typeReference)
-        listener: handleNoTypeArguments({)
-        listener: handleType(List, null)
-        parseClassOrMixinOrExtensionBody(List, DeclarationKind.Extension, Function)
-          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
-          notEofOrValue(}, })
-          listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 0, {, })
-        listener: endExtensionDeclaration(extension, on, })
+        parseExtensionDeclaration(extension, extension)
+          reportRecoverableErrorWithToken(Function, Instance of 'Template<(Token) => Message>')
+            listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'Function' as a name here., null, {lexeme: Function}], Function, Function)
+          listener: handleNoTypeVariables(on)
+          listener: beginExtensionDeclaration(extension, Function)
+          listener: handleIdentifier(List, typeReference)
+          listener: handleNoTypeArguments({)
+          listener: handleType(List, null)
+          parseClassOrMixinOrExtensionBody(List, DeclarationKind.Extension, Function)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 0, {, })
+          listener: endExtensionDeclaration(extension, on, })
   listener: endTopLevelDeclaration(extension)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
@@ -145,33 +146,34 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: beginTypeVariables(<)
-        parseMetadataStar(<)
-          listener: beginMetadataStar(Function)
-          listener: endMetadataStar(0)
-        ensureIdentifier(<, typeVariableDeclaration)
-          reportRecoverableErrorWithToken(Function, Instance of 'Template<(Token) => Message>')
-            listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'Function' as a name here., null, {lexeme: Function}], Function, Function)
-          listener: handleIdentifier(Function, typeVariableDeclaration)
-        listener: beginTypeVariable(Function)
-        listener: handleTypeVariablesDefined(Function, 1)
-        listener: handleNoType(Function)
-        listener: endTypeVariable(>, 0, null, null)
-        listener: endTypeVariables(<, >)
-        listener: beginExtensionDeclaration(extension, E)
-        ensureIdentifier(on, typeReference)
-          listener: handleIdentifier(List, typeReference)
-        listener: beginTypeArguments(<)
-        listener: handleIdentifier(Function, typeReference)
-        listener: handleNoTypeArguments(>)
-        listener: handleType(Function, null)
-        listener: endTypeArguments(1, <, >)
-        listener: handleType(List, null)
-        parseClassOrMixinOrExtensionBody(>, DeclarationKind.Extension, E)
-          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
-          notEofOrValue(}, })
-          listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 0, {, })
-        listener: endExtensionDeclaration(extension, on, })
+        parseExtensionDeclaration(extension, extension)
+          listener: beginTypeVariables(<)
+          parseMetadataStar(<)
+            listener: beginMetadataStar(Function)
+            listener: endMetadataStar(0)
+          ensureIdentifier(<, typeVariableDeclaration)
+            reportRecoverableErrorWithToken(Function, Instance of 'Template<(Token) => Message>')
+              listener: handleRecoverableError(Message[BuiltInIdentifierInDeclaration, Can't use 'Function' as a name here., null, {lexeme: Function}], Function, Function)
+            listener: handleIdentifier(Function, typeVariableDeclaration)
+          listener: beginTypeVariable(Function)
+          listener: handleTypeVariablesDefined(Function, 1)
+          listener: handleNoType(Function)
+          listener: endTypeVariable(>, 0, null, null)
+          listener: endTypeVariables(<, >)
+          listener: beginExtensionDeclaration(extension, E)
+          ensureIdentifier(on, typeReference)
+            listener: handleIdentifier(List, typeReference)
+          listener: beginTypeArguments(<)
+          listener: handleIdentifier(Function, typeReference)
+          listener: handleNoTypeArguments(>)
+          listener: handleType(Function, null)
+          listener: endTypeArguments(1, <, >)
+          listener: handleType(List, null)
+          parseClassOrMixinOrExtensionBody(>, DeclarationKind.Extension, E)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 0, {, })
+          listener: endExtensionDeclaration(extension, on, })
   listener: endTopLevelDeclaration(mixin)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
diff --git a/pkg/front_end/parser_testcases/general/issue_45848_06.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/issue_45848_06.dart.intertwined.expect
index 191ff57..a13feab 100644
--- a/pkg/front_end/parser_testcases/general/issue_45848_06.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/issue_45848_06.dart.intertwined.expect
@@ -350,74 +350,75 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(on)
-        listener: beginExtensionDeclaration(extension, null)
-        listener: handleIdentifier(Map, typeReference)
-        listener: handleNoTypeArguments({)
-        listener: handleType(Map, null)
-        parseClassOrMixinOrExtensionBody(Map, DeclarationKind.Extension, null)
-          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
-          notEofOrValue(}, bool)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, null)
-            parseMetadataStar({)
-              listener: beginMetadataStar(bool)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            parseMethod({, null, null, null, null, null, null, null, {, Instance of 'SimpleType', null, operator, DeclarationKind.Extension, null, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
-              listener: handleIdentifier(bool, typeReference)
-              listener: handleNoTypeArguments(operator)
-              listener: handleType(bool, null)
-              parseOperatorName(bool)
-                listener: handleOperatorName(operator, >)
-              parseMethodTypeVar(>)
-                listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(>, operator, false, MemberKind.ExtensionNonStaticMethod)
-                parseFormalParameters(>, MemberKind.ExtensionNonStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(dynamic)
-                        listener: endMetadataStar(0)
-                      listener: beginFormalParameter(dynamic, MemberKind.ExtensionNonStaticMethod, null, null, null)
-                      listener: handleIdentifier(dynamic, typeReference)
-                      listener: handleNoTypeArguments(whatever)
-                      listener: handleType(dynamic, null)
-                      ensureIdentifier(dynamic, formalParameterDeclaration)
-                        listener: handleIdentifier(whatever, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, whatever, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                    listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
+        parseExtensionDeclaration(extension, extension)
+          listener: handleNoTypeVariables(on)
+          listener: beginExtensionDeclaration(extension, null)
+          listener: handleIdentifier(Map, typeReference)
+          listener: handleNoTypeArguments({)
+          listener: handleType(Map, null)
+          parseClassOrMixinOrExtensionBody(Map, DeclarationKind.Extension, null)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+            notEofOrValue(}, bool)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, null)
+              parseMetadataStar({)
+                listener: beginMetadataStar(bool)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              parseMethod({, null, null, null, null, null, null, null, {, Instance of 'SimpleType', null, operator, DeclarationKind.Extension, null, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
+                listener: handleIdentifier(bool, typeReference)
+                listener: handleNoTypeArguments(operator)
+                listener: handleType(bool, null)
+                parseOperatorName(bool)
+                  listener: handleOperatorName(operator, >)
+                parseMethodTypeVar(>)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(>, operator, false, MemberKind.ExtensionNonStaticMethod)
+                  parseFormalParameters(>, MemberKind.ExtensionNonStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(dynamic)
+                          listener: endMetadataStar(0)
+                        listener: beginFormalParameter(dynamic, MemberKind.ExtensionNonStaticMethod, null, null, null)
+                        listener: handleIdentifier(dynamic, typeReference)
+                        listener: handleNoTypeArguments(whatever)
+                        listener: handleType(dynamic, null)
+                        ensureIdentifier(dynamic, formalParameterDeclaration)
+                          listener: handleIdentifier(whatever, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, whatever, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                      listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
                 inPlainSync()
-              inPlainSync()
-              parseFunctionBody(), false, true)
-                listener: beginBlockFunctionBody({)
-                notEofOrValue(}, return)
-                parseStatement({)
-                  parseStatementX({)
-                    parseReturnStatement({)
-                      listener: beginReturnStatement(return)
-                      parseExpression(return)
-                        parsePrecedenceExpression(return, 1, true, ConstantPatternContext.none)
-                          parseUnaryExpression(return, true, ConstantPatternContext.none)
-                            parsePrimary(return, expression, ConstantPatternContext.none)
-                              parseLiteralBool(return)
-                                listener: handleLiteralBool(true)
-                      ensureSemicolon(true)
-                      listener: endReturnStatement(true, return, ;)
-                      inGenerator()
-                notEofOrValue(}, })
-                listener: endBlockFunctionBody(1, {, })
-              listener: endExtensionMethod(null, bool, (, null, })
-            listener: endMember()
-          notEofOrValue(}, })
-          listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 1, {, })
-        listener: endExtensionDeclaration(extension, on, })
+                parseFunctionBody(), false, true)
+                  listener: beginBlockFunctionBody({)
+                  notEofOrValue(}, return)
+                  parseStatement({)
+                    parseStatementX({)
+                      parseReturnStatement({)
+                        listener: beginReturnStatement(return)
+                        parseExpression(return)
+                          parsePrecedenceExpression(return, 1, true, ConstantPatternContext.none)
+                            parseUnaryExpression(return, true, ConstantPatternContext.none)
+                              parsePrimary(return, expression, ConstantPatternContext.none)
+                                parseLiteralBool(return)
+                                  listener: handleLiteralBool(true)
+                        ensureSemicolon(true)
+                        listener: endReturnStatement(true, return, ;)
+                        inGenerator()
+                  notEofOrValue(}, })
+                  listener: endBlockFunctionBody(1, {, })
+                listener: endExtensionMethod(null, bool, (, null, })
+              listener: endMember()
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 1, {, })
+          listener: endExtensionDeclaration(extension, on, })
   listener: endTopLevelDeclaration()
   reportAllErrorTokens(void)
   listener: endCompilationUnit(4, )
diff --git a/pkg/front_end/parser_testcases/inline_class/extends_with.dart b/pkg/front_end/parser_testcases/inline_class/extends_with.dart
new file mode 100644
index 0000000..3e4c552
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extends_with.dart
@@ -0,0 +1,10 @@
+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 {}
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
new file mode 100644
index 0000000..f457b13
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.expect
@@ -0,0 +1,1044 @@
+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.
+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.
+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.
+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.
+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.
+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.
+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.
+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.
+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.
+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.
+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.
+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.
+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.
+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.
+extension type ET10(int i) extends Foo with Bar, Baz implements 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: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)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET1)
+      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)
+      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)
+    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)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET2)
+      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)
+      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(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)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET3)
+      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)
+      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(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)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET4)
+      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)
+      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, ;)
+      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)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET5)
+      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)
+      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, ;)
+      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)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET6)
+      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)
+      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, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET7)
+      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)
+      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(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)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET8)
+      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)
+      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(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)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET9)
+      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)
+      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, ;)
+      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)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET10)
+      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)
+      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, ;)
+      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(implements)
+      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], Baz, Baz)
+    endTopLevelFields(null, null, null, null, null, 2, Bar, ;)
+  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(Boz)
+      handleRecoverableError(Message[ExpectedAfterButGot, Expected ';' after this., null, {string: ;}], implements, implements)
+    endTopLevelFields(null, null, null, null, null, 1, implements, ;)
+  endTopLevelDeclaration(Boz)
+  beginMetadataStar(Boz)
+  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, })
+  endTopLevelDeclaration()
+endCompilationUnit(47, )
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
new file mode 100644
index 0000000..eba7e9d
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.intertwined.expect
@@ -0,0 +1,1347 @@
+parseUnit(extension)
+  skipErrorTokens(extension)
+  listener: beginCompilationUnit(extension)
+  syntheticPreviousToken(extension)
+  parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+    parseMetadataStar()
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET1)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET1, 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)
+          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)
+            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(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET2)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET2, 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)
+          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)
+            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(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET3)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET3, 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)
+          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)
+            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(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET4)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET4, 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)
+          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)
+            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(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET5)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET5, 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)
+          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)
+            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(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET6)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET6, 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)
+          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)
+            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(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET7)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET7, 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)
+          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)
+            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(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET8)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET8, 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)
+          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)
+            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(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET9)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET9, 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)
+          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)
+            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(})
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET10)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET10, 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)
+          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)
+            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(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)
+      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)
+      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, })
+  listener: endTopLevelDeclaration()
+  reportAllErrorTokens(extension)
+  listener: endCompilationUnit(47, )
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
new file mode 100644
index 0000000..cc8b256
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.parser.expect
@@ -0,0 +1,25 @@
+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[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]
+[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
new file mode 100644
index 0000000..7c24840
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extends_with.dart.scanner.expect
@@ -0,0 +1,23 @@
+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[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]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/extension_type.dart.intertwined.expect
index dc700e1..bf6b198 100644
--- a/pkg/front_end/parser_testcases/inline_class/extension_type.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/inline_class/extension_type.dart.intertwined.expect
@@ -9,8 +9,8 @@
     parseTopLevelKeywordDeclaration(, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(()
-        parseExtensionTypeDeclarationRest(ExtensionType1, extension, type, null, ExtensionType1)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
           listener: beginExtensionTypeDeclaration(extension, ExtensionType1)
           listener: beginPrimaryConstructor(()
           parseFormalParameters(ExtensionType1, MemberKind.PrimaryConstructor)
@@ -45,8 +45,8 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(()
-        parseExtensionTypeDeclarationRest(ExtensionType2, extension, type, null, ExtensionType2)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
           listener: beginExtensionTypeDeclaration(extension, ExtensionType2)
           listener: beginPrimaryConstructor(()
           parseFormalParameters(ExtensionType2, MemberKind.PrimaryConstructor)
@@ -87,20 +87,20 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: beginTypeVariables(<)
-        parseMetadataStar(<)
-          listener: beginMetadataStar(T)
-          listener: endMetadataStar(0)
-        ensureIdentifier(<, typeVariableDeclaration)
-          listener: handleIdentifier(T, typeVariableDeclaration)
-        listener: beginTypeVariable(T)
-        listener: handleTypeVariablesDefined(num, 1)
-        listener: handleIdentifier(num, typeReference)
-        listener: handleNoTypeArguments(>)
-        listener: handleType(num, null)
-        listener: endTypeVariable(>, 0, extends, null)
-        listener: endTypeVariables(<, >)
-        parseExtensionTypeDeclarationRest(>, extension, type, null, ExtensionType3)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: beginTypeVariables(<)
+          parseMetadataStar(<)
+            listener: beginMetadataStar(T)
+            listener: endMetadataStar(0)
+          ensureIdentifier(<, typeVariableDeclaration)
+            listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(num, 1)
+          listener: handleIdentifier(num, typeReference)
+          listener: handleNoTypeArguments(>)
+          listener: handleType(num, null)
+          listener: endTypeVariable(>, 0, extends, null)
+          listener: endTypeVariables(<, >)
           listener: beginExtensionTypeDeclaration(extension, ExtensionType3)
           listener: beginPrimaryConstructor(()
           parseFormalParameters(>, MemberKind.PrimaryConstructor)
@@ -135,8 +135,8 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(()
-        parseExtensionTypeDeclarationRest(ExtensionType4, extension, type, null, ExtensionType4)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
           listener: beginExtensionTypeDeclaration(extension, ExtensionType4)
           listener: beginPrimaryConstructor(()
           parseFormalParameters(ExtensionType4, MemberKind.PrimaryConstructor)
@@ -828,8 +828,8 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(.)
-        parseExtensionTypeDeclarationRest(ExtensionType5, extension, type, null, ExtensionType5)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(.)
           listener: beginExtensionTypeDeclaration(extension, ExtensionType5)
           listener: beginPrimaryConstructor(.)
           ensureIdentifier(., primaryConstructorDeclaration)
@@ -868,8 +868,8 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(.)
-        parseExtensionTypeDeclarationRest(ExtensionType6, extension, type, null, ExtensionType6)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(.)
           listener: beginExtensionTypeDeclaration(extension, ExtensionType6)
           listener: beginPrimaryConstructor(.)
           ensureIdentifier(., primaryConstructorDeclaration)
@@ -906,20 +906,20 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: beginTypeVariables(<)
-        parseMetadataStar(<)
-          listener: beginMetadataStar(T)
-          listener: endMetadataStar(0)
-        ensureIdentifier(<, typeVariableDeclaration)
-          listener: handleIdentifier(T, typeVariableDeclaration)
-        listener: beginTypeVariable(T)
-        listener: handleTypeVariablesDefined(num, 1)
-        listener: handleIdentifier(num, typeReference)
-        listener: handleNoTypeArguments(>)
-        listener: handleType(num, null)
-        listener: endTypeVariable(>, 0, extends, null)
-        listener: endTypeVariables(<, >)
-        parseExtensionTypeDeclarationRest(>, extension, type, null, ExtensionType7)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: beginTypeVariables(<)
+          parseMetadataStar(<)
+            listener: beginMetadataStar(T)
+            listener: endMetadataStar(0)
+          ensureIdentifier(<, typeVariableDeclaration)
+            listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(num, 1)
+          listener: handleIdentifier(num, typeReference)
+          listener: handleNoTypeArguments(>)
+          listener: handleType(num, null)
+          listener: endTypeVariable(>, 0, extends, null)
+          listener: endTypeVariables(<, >)
           listener: beginExtensionTypeDeclaration(extension, ExtensionType7)
           listener: beginPrimaryConstructor(.)
           ensureIdentifier(., primaryConstructorDeclaration)
diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_const.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_const.dart.intertwined.expect
index c6fbe1e..57c8d7d 100644
--- a/pkg/front_end/parser_testcases/inline_class/extension_type_const.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/inline_class/extension_type_const.dart.intertwined.expect
@@ -9,8 +9,8 @@
     parseTopLevelKeywordDeclaration(, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(()
-        parseExtensionTypeDeclarationRest(ExtensionType1, extension, type, const, ExtensionType1)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
           listener: beginExtensionTypeDeclaration(extension, ExtensionType1)
           listener: beginPrimaryConstructor(()
           parseFormalParameters(ExtensionType1, MemberKind.PrimaryConstructor)
@@ -45,8 +45,8 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(()
-        parseExtensionTypeDeclarationRest(ExtensionType2, extension, type, const, ExtensionType2)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
           listener: beginExtensionTypeDeclaration(extension, ExtensionType2)
           listener: beginPrimaryConstructor(()
           parseFormalParameters(ExtensionType2, MemberKind.PrimaryConstructor)
@@ -87,20 +87,20 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: beginTypeVariables(<)
-        parseMetadataStar(<)
-          listener: beginMetadataStar(T)
-          listener: endMetadataStar(0)
-        ensureIdentifier(<, typeVariableDeclaration)
-          listener: handleIdentifier(T, typeVariableDeclaration)
-        listener: beginTypeVariable(T)
-        listener: handleTypeVariablesDefined(num, 1)
-        listener: handleIdentifier(num, typeReference)
-        listener: handleNoTypeArguments(>)
-        listener: handleType(num, null)
-        listener: endTypeVariable(>, 0, extends, null)
-        listener: endTypeVariables(<, >)
-        parseExtensionTypeDeclarationRest(>, extension, type, const, ExtensionType3)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: beginTypeVariables(<)
+          parseMetadataStar(<)
+            listener: beginMetadataStar(T)
+            listener: endMetadataStar(0)
+          ensureIdentifier(<, typeVariableDeclaration)
+            listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(num, 1)
+          listener: handleIdentifier(num, typeReference)
+          listener: handleNoTypeArguments(>)
+          listener: handleType(num, null)
+          listener: endTypeVariable(>, 0, extends, null)
+          listener: endTypeVariables(<, >)
           listener: beginExtensionTypeDeclaration(extension, ExtensionType3)
           listener: beginPrimaryConstructor(()
           parseFormalParameters(>, MemberKind.PrimaryConstructor)
@@ -135,8 +135,8 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(()
-        parseExtensionTypeDeclarationRest(ExtensionType4, extension, type, const, ExtensionType4)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
           listener: beginExtensionTypeDeclaration(extension, ExtensionType4)
           listener: beginPrimaryConstructor(()
           parseFormalParameters(ExtensionType4, MemberKind.PrimaryConstructor)
@@ -832,8 +832,8 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(.)
-        parseExtensionTypeDeclarationRest(ExtensionType5, extension, type, const, ExtensionType5)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(.)
           listener: beginExtensionTypeDeclaration(extension, ExtensionType5)
           listener: beginPrimaryConstructor(.)
           ensureIdentifier(., primaryConstructorDeclaration)
@@ -872,8 +872,8 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(.)
-        parseExtensionTypeDeclarationRest(ExtensionType6, extension, type, const, ExtensionType6)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(.)
           listener: beginExtensionTypeDeclaration(extension, ExtensionType6)
           listener: beginPrimaryConstructor(.)
           ensureIdentifier(., primaryConstructorDeclaration)
@@ -910,20 +910,20 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: beginTypeVariables(<)
-        parseMetadataStar(<)
-          listener: beginMetadataStar(T)
-          listener: endMetadataStar(0)
-        ensureIdentifier(<, typeVariableDeclaration)
-          listener: handleIdentifier(T, typeVariableDeclaration)
-        listener: beginTypeVariable(T)
-        listener: handleTypeVariablesDefined(num, 1)
-        listener: handleIdentifier(num, typeReference)
-        listener: handleNoTypeArguments(>)
-        listener: handleType(num, null)
-        listener: endTypeVariable(>, 0, extends, null)
-        listener: endTypeVariables(<, >)
-        parseExtensionTypeDeclarationRest(>, extension, type, const, ExtensionType7)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: beginTypeVariables(<)
+          parseMetadataStar(<)
+            listener: beginMetadataStar(T)
+            listener: endMetadataStar(0)
+          ensureIdentifier(<, typeVariableDeclaration)
+            listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(num, 1)
+          listener: handleIdentifier(num, typeReference)
+          listener: handleNoTypeArguments(>)
+          listener: handleType(num, null)
+          listener: endTypeVariable(>, 0, extends, null)
+          listener: endTypeVariables(<, >)
           listener: beginExtensionTypeDeclaration(extension, ExtensionType7)
           listener: beginPrimaryConstructor(.)
           ensureIdentifier(., primaryConstructorDeclaration)
diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart b/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart
new file mode 100644
index 0000000..9e3ce61
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart
@@ -0,0 +1,8 @@
+extension type (int i) {}
+extension type const (int i) {}
+extension type .name(int i) {}
+extension type const .name(int i) {}
+extension type <T>(int i) {}
+extension type const <T>(int i) {}
+extension type <T>.name(int i) {}
+extension type const <T>.name(int i) {}
diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.expect
new file mode 100644
index 0000000..55cb6de
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.expect
@@ -0,0 +1,264 @@
+Problems reported:
+
+parser/inline_class/extension_type_missing_name:1:16: Expected an identifier, but got '('.
+extension type (int i) {}
+               ^
+
+parser/inline_class/extension_type_missing_name:2:22: Expected an identifier, but got '('.
+extension type const (int i) {}
+                     ^
+
+parser/inline_class/extension_type_missing_name:3:16: Expected an identifier, but got '.'.
+extension type .name(int i) {}
+               ^
+
+parser/inline_class/extension_type_missing_name:4:22: Expected an identifier, but got '.'.
+extension type const .name(int i) {}
+                     ^
+
+parser/inline_class/extension_type_missing_name:5:16: Expected an identifier, but got '<'.
+extension type <T>(int i) {}
+               ^
+
+parser/inline_class/extension_type_missing_name:6:22: Expected an identifier, but got '<'.
+extension type const <T>(int i) {}
+                     ^
+
+parser/inline_class/extension_type_missing_name:7:16: Expected an identifier, but got '<'.
+extension type <T>.name(int i) {}
+               ^
+
+parser/inline_class/extension_type_missing_name:8:22: Expected an identifier, but got '<'.
+extension type const <T>.name(int i) {}
+                     ^
+
+beginCompilationUnit(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}], (, ()
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, )
+      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)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}], (, ()
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, )
+      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((, const, false)
+      handleImplements(null, 0)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}], ., .)
+    handleNoTypeVariables(.)
+    beginExtensionTypeDeclaration(extension, )
+      beginPrimaryConstructor(.)
+        handleIdentifier(name, primaryConstructorDeclaration)
+        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, true)
+      handleImplements(null, 0)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}], ., .)
+    handleNoTypeVariables(.)
+    beginExtensionTypeDeclaration(extension, )
+      beginPrimaryConstructor(.)
+        handleIdentifier(name, primaryConstructorDeclaration)
+        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(., const, true)
+      handleImplements(null, 0)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], <, <)
+    beginTypeVariables(<)
+      beginMetadataStar(T)
+      endMetadataStar(0)
+      handleIdentifier(T, typeVariableDeclaration)
+      beginTypeVariable(T)
+        handleTypeVariablesDefined(T, 1)
+        handleNoType(T)
+      endTypeVariable(>, 0, null, null)
+    endTypeVariables(<, >)
+    beginExtensionTypeDeclaration(extension, )
+      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)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], <, <)
+    beginTypeVariables(<)
+      beginMetadataStar(T)
+      endMetadataStar(0)
+      handleIdentifier(T, typeVariableDeclaration)
+      beginTypeVariable(T)
+        handleTypeVariablesDefined(T, 1)
+        handleNoType(T)
+      endTypeVariable(>, 0, null, null)
+    endTypeVariables(<, >)
+    beginExtensionTypeDeclaration(extension, )
+      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((, const, false)
+      handleImplements(null, 0)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], <, <)
+    beginTypeVariables(<)
+      beginMetadataStar(T)
+      endMetadataStar(0)
+      handleIdentifier(T, typeVariableDeclaration)
+      beginTypeVariable(T)
+        handleTypeVariablesDefined(T, 1)
+        handleNoType(T)
+      endTypeVariable(>, 0, null, null)
+    endTypeVariables(<, >)
+    beginExtensionTypeDeclaration(extension, )
+      beginPrimaryConstructor(.)
+        handleIdentifier(name, primaryConstructorDeclaration)
+        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, true)
+      handleImplements(null, 0)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], <, <)
+    beginTypeVariables(<)
+      beginMetadataStar(T)
+      endMetadataStar(0)
+      handleIdentifier(T, typeVariableDeclaration)
+      beginTypeVariable(T)
+        handleTypeVariablesDefined(T, 1)
+        handleNoType(T)
+      endTypeVariable(>, 0, null, null)
+    endTypeVariables(<, >)
+    beginExtensionTypeDeclaration(extension, )
+      beginPrimaryConstructor(.)
+        handleIdentifier(name, primaryConstructorDeclaration)
+        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(., const, true)
+      handleImplements(null, 0)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration()
+endCompilationUnit(8, )
diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.intertwined.expect
new file mode 100644
index 0000000..5b75447
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.intertwined.expect
@@ -0,0 +1,366 @@
+parseUnit(extension)
+  skipErrorTokens(extension)
+  listener: beginCompilationUnit(extension)
+  syntheticPreviousToken(extension)
+  parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+    parseMetadataStar()
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          insertSyntheticIdentifier(type, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}], messageOnToken: null)
+            reportRecoverableError((, Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}])
+              listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}], (, ()
+            rewriter()
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, )
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(, 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)
+          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, )
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          insertSyntheticIdentifier(const, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}], messageOnToken: null)
+            reportRecoverableError((, Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}])
+              listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '('., Try inserting an identifier before '('., {lexeme: (}], (, ()
+            rewriter()
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, )
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(, 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((, const, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleImplements(null, 0)
+          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, )
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          insertSyntheticIdentifier(type, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}], messageOnToken: null)
+            reportRecoverableError(., Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}])
+              listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}], ., .)
+            rewriter()
+          listener: handleNoTypeVariables(.)
+          listener: beginExtensionTypeDeclaration(extension, )
+          listener: beginPrimaryConstructor(.)
+          ensureIdentifier(., primaryConstructorDeclaration)
+            listener: handleIdentifier(name, primaryConstructorDeclaration)
+          parseFormalParameters(name, 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, true)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleImplements(null, 0)
+          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, )
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          insertSyntheticIdentifier(const, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}], messageOnToken: null)
+            reportRecoverableError(., Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}])
+              listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '.'., Try inserting an identifier before '.'., {lexeme: .}], ., .)
+            rewriter()
+          listener: handleNoTypeVariables(.)
+          listener: beginExtensionTypeDeclaration(extension, )
+          listener: beginPrimaryConstructor(.)
+          ensureIdentifier(., primaryConstructorDeclaration)
+            listener: handleIdentifier(name, primaryConstructorDeclaration)
+          parseFormalParameters(name, 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(., const, true)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleImplements(null, 0)
+          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, )
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          insertSyntheticIdentifier(type, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], messageOnToken: null)
+            reportRecoverableError(<, Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}])
+              listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], <, <)
+            rewriter()
+          listener: beginTypeVariables(<)
+          listener: beginMetadataStar(T)
+          listener: endMetadataStar(0)
+          listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(T, 1)
+          listener: handleNoType(T)
+          listener: endTypeVariable(>, 0, null, null)
+          listener: endTypeVariables(<, >)
+          listener: beginExtensionTypeDeclaration(extension, )
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(>, 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)
+          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, )
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          insertSyntheticIdentifier(const, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], messageOnToken: null)
+            reportRecoverableError(<, Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}])
+              listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], <, <)
+            rewriter()
+          listener: beginTypeVariables(<)
+          listener: beginMetadataStar(T)
+          listener: endMetadataStar(0)
+          listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(T, 1)
+          listener: handleNoType(T)
+          listener: endTypeVariable(>, 0, null, null)
+          listener: endTypeVariables(<, >)
+          listener: beginExtensionTypeDeclaration(extension, )
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(>, 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((, const, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleImplements(null, 0)
+          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, )
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          insertSyntheticIdentifier(type, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], messageOnToken: null)
+            reportRecoverableError(<, Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}])
+              listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], <, <)
+            rewriter()
+          listener: beginTypeVariables(<)
+          listener: beginMetadataStar(T)
+          listener: endMetadataStar(0)
+          listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(T, 1)
+          listener: handleNoType(T)
+          listener: endTypeVariable(>, 0, null, null)
+          listener: endTypeVariables(<, >)
+          listener: beginExtensionTypeDeclaration(extension, )
+          listener: beginPrimaryConstructor(.)
+          ensureIdentifier(., primaryConstructorDeclaration)
+            listener: handleIdentifier(name, primaryConstructorDeclaration)
+          parseFormalParameters(name, 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, true)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleImplements(null, 0)
+          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, )
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          insertSyntheticIdentifier(const, classOrMixinDeclaration, message: Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], messageOnToken: null)
+            reportRecoverableError(<, Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}])
+              listener: handleRecoverableError(Message[ExpectedIdentifier, Expected an identifier, but got '<'., Try inserting an identifier before '<'., {lexeme: <}], <, <)
+            rewriter()
+          listener: beginTypeVariables(<)
+          listener: beginMetadataStar(T)
+          listener: endMetadataStar(0)
+          listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(T, 1)
+          listener: handleNoType(T)
+          listener: endTypeVariable(>, 0, null, null)
+          listener: endTypeVariables(<, >)
+          listener: beginExtensionTypeDeclaration(extension, )
+          listener: beginPrimaryConstructor(.)
+          ensureIdentifier(., primaryConstructorDeclaration)
+            listener: handleIdentifier(name, primaryConstructorDeclaration)
+          parseFormalParameters(name, 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(., const, true)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleImplements(null, 0)
+          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, )
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration()
+  reportAllErrorTokens(extension)
+  listener: endCompilationUnit(8, )
diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.parser.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.parser.expect
new file mode 100644
index 0000000..d6be814
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.parser.expect
@@ -0,0 +1,21 @@
+NOTICE: Stream was rewritten by parser!
+
+extension type *synthetic*(int i) {}
+extension type const *synthetic*(int i) {}
+extension type *synthetic*.name(int i) {}
+extension type const *synthetic*.name(int i) {}
+extension type *synthetic*<T>(int i) {}
+extension type const *synthetic*<T>(int i) {}
+extension type *synthetic*<T>.name(int i) {}
+extension type const *synthetic*<T>.name(int i) {}
+
+
+extension[KeywordToken] type[StringToken] [SyntheticStringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] const[KeywordToken] [SyntheticStringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] [SyntheticStringToken].[SimpleToken]name[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] const[KeywordToken] [SyntheticStringToken].[SimpleToken]name[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] [SyntheticStringToken]<[BeginToken]T[StringToken]>[SimpleToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] const[KeywordToken] [SyntheticStringToken]<[BeginToken]T[StringToken]>[SimpleToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] [SyntheticStringToken]<[BeginToken]T[StringToken]>[SimpleToken].[SimpleToken]name[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] const[KeywordToken] [SyntheticStringToken]<[BeginToken]T[StringToken]>[SimpleToken].[SimpleToken]name[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.scanner.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.scanner.expect
new file mode 100644
index 0000000..20057e5
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extension_type_missing_name.dart.scanner.expect
@@ -0,0 +1,19 @@
+extension type (int i) {}
+extension type const (int i) {}
+extension type .name(int i) {}
+extension type const .name(int i) {}
+extension type <T>(int i) {}
+extension type const <T>(int i) {}
+extension type <T>.name(int i) {}
+extension type const <T>.name(int i) {}
+
+
+extension[KeywordToken] type[StringToken] ([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] const[KeywordToken] ([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] .[SimpleToken]name[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] const[KeywordToken] .[SimpleToken]name[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] <[BeginToken]T[StringToken]>[SimpleToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] const[KeywordToken] <[BeginToken]T[StringToken]>[SimpleToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] <[BeginToken]T[StringToken]>[SimpleToken].[SimpleToken]name[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] const[KeywordToken] <[BeginToken]T[StringToken]>[SimpleToken].[SimpleToken]name[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart b/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart
new file mode 100644
index 0000000..83fe6fc
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart
@@ -0,0 +1,4 @@
+extension type on (int i) {}
+extension type on (int i,) {}
+extension type on (int i, int j) {}
+extension type on (i, j) {}
diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.expect
new file mode 100644
index 0000000..53a35f2
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.expect
@@ -0,0 +1,108 @@
+beginCompilationUnit(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, on)
+      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)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, on)
+      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)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, on)
+      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)
+          beginMetadataStar(int)
+          endMetadataStar(0)
+          beginFormalParameter(int, MemberKind.PrimaryConstructor, null, null, null)
+            handleIdentifier(int, typeReference)
+            handleNoTypeArguments(j)
+            handleType(int, null)
+            handleIdentifier(j, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, j, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(2, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleImplements(null, 0)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, on)
+      beginPrimaryConstructor(()
+        beginFormalParameters((, MemberKind.PrimaryConstructor)
+          beginMetadataStar(i)
+          endMetadataStar(0)
+          beginFormalParameter(i, MemberKind.PrimaryConstructor, null, null, null)
+            handleNoType(()
+            handleIdentifier(i, formalParameterDeclaration)
+            handleFormalParameterWithoutValue(,)
+          endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+          beginMetadataStar(j)
+          endMetadataStar(0)
+          beginFormalParameter(j, MemberKind.PrimaryConstructor, null, null, null)
+            handleNoType(,)
+            handleIdentifier(j, formalParameterDeclaration)
+            handleFormalParameterWithoutValue())
+          endFormalParameter(null, null, null, j, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+        endFormalParameters(2, (, ), MemberKind.PrimaryConstructor)
+      endPrimaryConstructor((, null, false)
+      handleImplements(null, 0)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration()
+endCompilationUnit(4, )
diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.intertwined.expect
new file mode 100644
index 0000000..86b43ac
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.intertwined.expect
@@ -0,0 +1,170 @@
+parseUnit(extension)
+  skipErrorTokens(extension)
+  listener: beginCompilationUnit(extension)
+  syntheticPreviousToken(extension)
+  parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+    parseMetadataStar()
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, on)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(on, 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)
+          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, on)
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, on)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(on, 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)
+          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, on)
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, on)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(on, 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)
+              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(j)
+                listener: handleType(int, null)
+                ensureIdentifier(int, formalParameterDeclaration)
+                  listener: handleIdentifier(j, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, j, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(2, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleImplements(null, 0)
+          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, on)
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, on)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(on, MemberKind.PrimaryConstructor)
+            parseFormalParametersRest((, MemberKind.PrimaryConstructor)
+              listener: beginFormalParameters((, MemberKind.PrimaryConstructor)
+              parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(()
+                  listener: beginMetadataStar(i)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(i, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleNoType(()
+                ensureIdentifier((, formalParameterDeclaration)
+                  listener: handleIdentifier(i, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue(,)
+                listener: endFormalParameter(null, null, null, i, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              parseFormalParameter(,, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+                parseMetadataStar(,)
+                  listener: beginMetadataStar(j)
+                  listener: endMetadataStar(0)
+                listener: beginFormalParameter(j, MemberKind.PrimaryConstructor, null, null, null)
+                listener: handleNoType(,)
+                ensureIdentifier(,, formalParameterDeclaration)
+                  listener: handleIdentifier(j, formalParameterDeclaration)
+                listener: handleFormalParameterWithoutValue())
+                listener: endFormalParameter(null, null, null, j, null, null, FormalParameterKind.requiredPositional, MemberKind.PrimaryConstructor)
+              listener: endFormalParameters(2, (, ), MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor((, null, false)
+          parseClassOrMixinOrEnumImplementsOpt())
+            listener: handleImplements(null, 0)
+          parseClassOrMixinOrExtensionBody(), DeclarationKind.ExtensionType, on)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration()
+  reportAllErrorTokens(extension)
+  listener: endCompilationUnit(4, )
diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.parser.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.parser.expect
new file mode 100644
index 0000000..6357a76
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.parser.expect
@@ -0,0 +1,11 @@
+extension type on (int i) {}
+extension type on (int i,) {}
+extension type on (int i, int j) {}
+extension type on (i, j) {}
+
+
+extension[KeywordToken] type[StringToken] on[KeywordToken] ([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] on[KeywordToken] ([BeginToken]int[StringToken] i[StringToken],[SimpleToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] on[KeywordToken] ([BeginToken]int[StringToken] i[StringToken],[SimpleToken] int[StringToken] j[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] on[KeywordToken] ([BeginToken]i[StringToken],[SimpleToken] j[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.scanner.expect b/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.scanner.expect
new file mode 100644
index 0000000..6357a76
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/extension_type_on.dart.scanner.expect
@@ -0,0 +1,11 @@
+extension type on (int i) {}
+extension type on (int i,) {}
+extension type on (int i, int j) {}
+extension type on (i, j) {}
+
+
+extension[KeywordToken] type[StringToken] on[KeywordToken] ([BeginToken]int[StringToken] i[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] on[KeywordToken] ([BeginToken]int[StringToken] i[StringToken],[SimpleToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] on[KeywordToken] ([BeginToken]int[StringToken] i[StringToken],[SimpleToken] int[StringToken] j[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] on[KeywordToken] ([BeginToken]i[StringToken],[SimpleToken] j[StringToken])[SimpleToken] {[BeginToken]}[SimpleToken]
+[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/inline_class/no_body.dart b/pkg/front_end/parser_testcases/inline_class/no_body.dart
new file mode 100644
index 0000000..2f920fb
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/no_body.dart
@@ -0,0 +1,6 @@
+class C;
+mixin M;
+extension E on int;
+extension type ET1(int i);
+extension type ET2(int i) implements Foo;
+extension type ET3(int i) implements Foo, Bar;
\ No newline at end of file
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
new file mode 100644
index 0000000..aecf6e9
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/no_body.dart.expect
@@ -0,0 +1,220 @@
+Problems reported:
+
+parser/inline_class/no_body:1:7: A class declaration must have a body, even if it is empty.
+class C;
+      ^
+
+parser/inline_class/no_body:1:8: Unexpected token ';'.
+class C;
+       ^
+
+parser/inline_class/no_body:2:7: A mixin declaration must have a body, even if it is empty.
+mixin M;
+      ^
+
+parser/inline_class/no_body:2:8: Unexpected token ';'.
+mixin M;
+       ^
+
+parser/inline_class/no_body:3:16: A extension declaration must have a body, even if it is empty.
+extension E on int;
+               ^^^
+
+parser/inline_class/no_body:3:19: Unexpected token ';'.
+extension E on int;
+                  ^
+
+parser/inline_class/no_body:4:25: A extension type declaration must have a body, even if it is empty.
+extension type ET1(int i);
+                        ^
+
+parser/inline_class/no_body:4:26: Unexpected token ';'.
+extension type ET1(int i);
+                         ^
+
+parser/inline_class/no_body:5:38: A extension type declaration must have a body, even if it is empty.
+extension type ET2(int i) implements Foo;
+                                     ^^^
+
+parser/inline_class/no_body:5:41: Unexpected token ';'.
+extension type ET2(int i) implements Foo;
+                                        ^
+
+parser/inline_class/no_body:6:43: A extension type declaration must have a body, even if it is empty.
+extension type ET3(int i) implements Foo, Bar;
+                                          ^^^
+
+parser/inline_class/no_body:6:46: Unexpected token ';'.
+extension type ET3(int i) implements Foo, Bar;
+                                             ^
+
+beginCompilationUnit(class)
+  beginMetadataStar(class)
+  endMetadataStar(0)
+  beginClassOrMixinOrNamedMixinApplicationPrelude(class)
+    handleIdentifier(C, classOrMixinDeclaration)
+    handleNoTypeVariables(;)
+    beginClassDeclaration(class, null, null, null, null, null, null, null, null, null, C)
+      handleNoType(C)
+      handleClassExtends(null, 1)
+      handleClassNoWithClause()
+      handleImplements(null, 0)
+      handleClassHeader(class, class, null)
+      handleNoType(C)
+      handleClassExtends(null, 1)
+      handleClassNoWithClause()
+      handleImplements(null, 0)
+      handleRecoverClassHeader()
+      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, {, })
+    endClassDeclaration(class, })
+  endTopLevelDeclaration(;)
+  beginMetadataStar(;)
+  endMetadataStar(0)
+  beginTopLevelMember(;)
+    handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {lexeme: ;}], ;, ;)
+    handleInvalidTopLevelDeclaration(;)
+  endTopLevelDeclaration(mixin)
+  beginMetadataStar(mixin)
+  endMetadataStar(0)
+  beginClassOrMixinOrNamedMixinApplicationPrelude(mixin)
+    handleIdentifier(M, classOrMixinDeclaration)
+    handleNoTypeVariables(;)
+    beginMixinDeclaration(null, null, mixin, M)
+      handleMixinOn(null, 0)
+      handleImplements(null, 0)
+      handleMixinHeader(mixin)
+      handleMixinOn(null, 0)
+      handleImplements(null, 0)
+      handleRecoverMixinHeader()
+      handleRecoverableError(Message[ExpectedClassOrMixinBody, A mixin declaration must have a body, even if it is empty., Try adding an empty body., {string: mixin declaration}], M, M)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.Mixin, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.Mixin, 0, {, })
+    endMixinDeclaration(mixin, })
+  endTopLevelDeclaration(;)
+  beginMetadataStar(;)
+  endMetadataStar(0)
+  beginTopLevelMember(;)
+    handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {lexeme: ;}], ;, ;)
+    handleInvalidTopLevelDeclaration(;)
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(on)
+    beginExtensionDeclaration(extension, E)
+      handleIdentifier(int, typeReference)
+      handleNoTypeArguments(;)
+      handleType(int, null)
+      handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension declaration must have a body, even if it is empty., Try adding an empty body., {string: extension declaration}], int, int)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 0, {, })
+    endExtensionDeclaration(extension, on, })
+  endTopLevelDeclaration(;)
+  beginMetadataStar(;)
+  endMetadataStar(0)
+  beginTopLevelMember(;)
+    handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {lexeme: ;}], ;, ;)
+    handleInvalidTopLevelDeclaration(;)
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET1)
+      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)
+      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(;)
+  beginMetadataStar(;)
+  endMetadataStar(0)
+  beginTopLevelMember(;)
+    handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {lexeme: ;}], ;, ;)
+    handleInvalidTopLevelDeclaration(;)
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET2)
+      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(Foo, typeReference)
+      handleNoTypeArguments(;)
+      handleType(Foo, null)
+      handleImplements(implements, 1)
+      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, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(;)
+  beginMetadataStar(;)
+  endMetadataStar(0)
+  beginTopLevelMember(;)
+    handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {lexeme: ;}], ;, ;)
+    handleInvalidTopLevelDeclaration(;)
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(()
+    beginExtensionTypeDeclaration(extension, ET3)
+      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(Foo, typeReference)
+      handleNoTypeArguments(,)
+      handleType(Foo, null)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments(;)
+      handleType(Bar, null)
+      handleImplements(implements, 2)
+      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, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(;)
+  beginMetadataStar(;)
+  endMetadataStar(0)
+  beginTopLevelMember(;)
+    handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {lexeme: ;}], ;, ;)
+    handleInvalidTopLevelDeclaration(;)
+  endTopLevelDeclaration()
+endCompilationUnit(12, )
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
new file mode 100644
index 0000000..fb14082
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/no_body.dart.intertwined.expect
@@ -0,0 +1,312 @@
+parseUnit(class)
+  skipErrorTokens(class)
+  listener: beginCompilationUnit(class)
+  syntheticPreviousToken(class)
+  parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+    parseMetadataStar()
+      listener: beginMetadataStar(class)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(, class, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseClassOrNamedMixinApplication(null, null, null, null, null, null, null, null, null, class)
+        listener: beginClassOrMixinOrNamedMixinApplicationPrelude(class)
+        ensureIdentifier(class, classOrMixinDeclaration)
+          listener: handleIdentifier(C, classOrMixinDeclaration)
+        listener: handleNoTypeVariables(;)
+        listener: beginClassDeclaration(class, null, null, null, null, null, null, null, null, null, C)
+        parseClass(C, class, class, C)
+          parseClassHeaderOpt(C, class, class)
+            parseClassExtendsOpt(C)
+              listener: handleNoType(C)
+              listener: handleClassExtends(null, 1)
+            parseClassWithClauseOpt(C)
+              listener: handleClassNoWithClause()
+            parseClassOrMixinOrEnumImplementsOpt(C)
+              listener: handleImplements(null, 0)
+            listener: handleClassHeader(class, class, null)
+          parseClassHeaderRecovery(C, class, class)
+            parseClassHeaderOpt(C, class, class)
+              parseClassExtendsOpt(C)
+              parseClassWithClauseOpt(C)
+              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()
+          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)
+            insertBlock(C)
+              rewriter()
+              rewriter()
+          parseClassOrMixinOrExtensionBody(C, DeclarationKind.Class, C)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Class, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.Class, 0, {, })
+          listener: endClassDeclaration(class, })
+  listener: endTopLevelDeclaration(;)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(;)
+      listener: endMetadataStar(0)
+    listener: beginTopLevelMember(;)
+    parseInvalidTopLevelDeclaration(})
+      reportRecoverableErrorWithToken(;, Instance of 'Template<(Token) => Message>')
+        listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {lexeme: ;}], ;, ;)
+      listener: handleInvalidTopLevelDeclaration(;)
+  listener: endTopLevelDeclaration(mixin)
+  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
+    parseMetadataStar(;)
+      listener: beginMetadataStar(mixin)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(;, mixin, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseMixin(null, null, mixin)
+        listener: beginClassOrMixinOrNamedMixinApplicationPrelude(mixin)
+        ensureIdentifier(mixin, classOrMixinDeclaration)
+          listener: handleIdentifier(M, classOrMixinDeclaration)
+        listener: handleNoTypeVariables(;)
+        listener: beginMixinDeclaration(null, null, mixin, M)
+        parseMixinHeaderOpt(M, mixin)
+          parseMixinOnOpt(M)
+            listener: handleMixinOn(null, 0)
+          parseClassOrMixinOrEnumImplementsOpt(M)
+            listener: handleImplements(null, 0)
+          listener: handleMixinHeader(mixin)
+        parseMixinHeaderRecovery(M, mixin, M)
+          parseMixinHeaderOpt(M, mixin)
+            parseMixinOnOpt(M)
+            parseClassOrMixinOrEnumImplementsOpt(M)
+          skipUnexpectedTokenOpt(M, [on, implements, {])
+          parseMixinOnOpt(M)
+            listener: handleMixinOn(null, 0)
+          parseClassOrMixinOrEnumImplementsOpt(M)
+            listener: handleImplements(null, 0)
+          listener: handleRecoverMixinHeader()
+        ensureBlock(M, null, mixin declaration)
+          reportRecoverableError(M, Message[ExpectedClassOrMixinBody, A mixin declaration must have a body, even if it is empty., Try adding an empty body., {string: mixin declaration}])
+            listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A mixin declaration must have a body, even if it is empty., Try adding an empty body., {string: mixin declaration}], M, M)
+          insertBlock(M)
+            rewriter()
+            rewriter()
+        parseClassOrMixinOrExtensionBody(M, DeclarationKind.Mixin, M)
+          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Mixin, {)
+          notEofOrValue(}, })
+          listener: endClassOrMixinOrExtensionBody(DeclarationKind.Mixin, 0, {, })
+        listener: endMixinDeclaration(mixin, })
+  listener: endTopLevelDeclaration(;)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(;)
+      listener: endMetadataStar(0)
+    listener: beginTopLevelMember(;)
+    parseInvalidTopLevelDeclaration(})
+      reportRecoverableErrorWithToken(;, Instance of 'Template<(Token) => Message>')
+        listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {lexeme: ;}], ;, ;)
+      listener: handleInvalidTopLevelDeclaration(;)
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
+    parseMetadataStar(;)
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(;, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionDeclaration(extension, extension)
+          listener: handleNoTypeVariables(on)
+          listener: beginExtensionDeclaration(extension, E)
+          listener: handleIdentifier(int, typeReference)
+          listener: handleNoTypeArguments(;)
+          listener: handleType(int, null)
+          ensureBlock(int, null, extension declaration)
+            reportRecoverableError(int, Message[ExpectedClassOrMixinBody, A extension declaration must have a body, even if it is empty., Try adding an empty body., {string: extension declaration}])
+              listener: handleRecoverableError(Message[ExpectedClassOrMixinBody, A extension declaration must have a body, even if it is empty., Try adding an empty body., {string: extension declaration}], int, int)
+            insertBlock(int)
+              rewriter()
+              rewriter()
+          parseClassOrMixinOrExtensionBody(int, DeclarationKind.Extension, E)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 0, {, })
+          listener: endExtensionDeclaration(extension, on, })
+  listener: endTopLevelDeclaration(;)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(;)
+      listener: endMetadataStar(0)
+    listener: beginTopLevelMember(;)
+    parseInvalidTopLevelDeclaration(})
+      reportRecoverableErrorWithToken(;, Instance of 'Template<(Token) => Message>')
+        listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {lexeme: ;}], ;, ;)
+      listener: handleInvalidTopLevelDeclaration(;)
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
+    parseMetadataStar(;)
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(;, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET1)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET1, 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)
+          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)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(;)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(;)
+      listener: endMetadataStar(0)
+    listener: beginTopLevelMember(;)
+    parseInvalidTopLevelDeclaration(})
+      reportRecoverableErrorWithToken(;, Instance of 'Template<(Token) => Message>')
+        listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {lexeme: ;}], ;, ;)
+      listener: handleInvalidTopLevelDeclaration(;)
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
+    parseMetadataStar(;)
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(;, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET2)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET2, 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(Foo, typeReference)
+            listener: handleNoTypeArguments(;)
+            listener: handleType(Foo, null)
+            listener: handleImplements(implements, 1)
+          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)
+            insertBlock(Foo)
+              rewriter()
+              rewriter()
+          parseClassOrMixinOrExtensionBody(Foo, DeclarationKind.ExtensionType, ET2)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(;)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(;)
+      listener: endMetadataStar(0)
+    listener: beginTopLevelMember(;)
+    parseInvalidTopLevelDeclaration(})
+      reportRecoverableErrorWithToken(;, Instance of 'Template<(Token) => Message>')
+        listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {lexeme: ;}], ;, ;)
+      listener: handleInvalidTopLevelDeclaration(;)
+  listener: endTopLevelDeclaration(extension)
+  parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
+    parseMetadataStar(;)
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(;, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(()
+          listener: beginExtensionTypeDeclaration(extension, ET3)
+          listener: beginPrimaryConstructor(()
+          parseFormalParameters(ET3, 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(Foo, typeReference)
+            listener: handleNoTypeArguments(,)
+            listener: handleType(Foo, null)
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments(;)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 2)
+          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)
+            insertBlock(Bar)
+              rewriter()
+              rewriter()
+          parseClassOrMixinOrExtensionBody(Bar, DeclarationKind.ExtensionType, ET3)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration(;)
+  parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
+    parseMetadataStar(})
+      listener: beginMetadataStar(;)
+      listener: endMetadataStar(0)
+    listener: beginTopLevelMember(;)
+    parseInvalidTopLevelDeclaration(})
+      reportRecoverableErrorWithToken(;, Instance of 'Template<(Token) => Message>')
+        listener: handleRecoverableError(Message[UnexpectedToken, Unexpected token ';'., null, {lexeme: ;}], ;, ;)
+      listener: handleInvalidTopLevelDeclaration(;)
+  listener: endTopLevelDeclaration()
+  reportAllErrorTokens(class)
+  listener: endCompilationUnit(12, )
diff --git a/pkg/front_end/parser_testcases/inline_class/no_body.dart.parser.expect b/pkg/front_end/parser_testcases/inline_class/no_body.dart.parser.expect
new file mode 100644
index 0000000..44b388b
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/no_body.dart.parser.expect
@@ -0,0 +1,15 @@
+NOTICE: Stream was rewritten by parser!
+
+class C{};
+mixin M{};
+extension E on int{};
+extension type ET1(int i){};
+extension type ET2(int i) implements Foo{};
+extension type ET3(int i) implements Foo, Bar{};
+
+class[KeywordToken] C[StringToken]{[SyntheticBeginToken]}[SyntheticToken];[SimpleToken]
+mixin[KeywordToken] M[StringToken]{[SyntheticBeginToken]}[SyntheticToken];[SimpleToken]
+extension[KeywordToken] E[StringToken] on[KeywordToken] int[StringToken]{[SyntheticBeginToken]}[SyntheticToken];[SimpleToken]
+extension[KeywordToken] type[StringToken] ET1[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken]{[SyntheticBeginToken]}[SyntheticToken];[SimpleToken]
+extension[KeywordToken] type[StringToken] ET2[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Foo[StringToken]{[SyntheticBeginToken]}[SyntheticToken];[SimpleToken]
+extension[KeywordToken] type[StringToken] ET3[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken]{[SyntheticBeginToken]}[SyntheticToken];[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/inline_class/no_body.dart.scanner.expect b/pkg/front_end/parser_testcases/inline_class/no_body.dart.scanner.expect
new file mode 100644
index 0000000..ba9eb68
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/no_body.dart.scanner.expect
@@ -0,0 +1,13 @@
+class C;
+mixin M;
+extension E on int;
+extension type ET1(int i);
+extension type ET2(int i) implements Foo;
+extension type ET3(int i) implements Foo, Bar;
+
+class[KeywordToken] C[StringToken];[SimpleToken]
+mixin[KeywordToken] M[StringToken];[SimpleToken]
+extension[KeywordToken] E[StringToken] on[KeywordToken] int[StringToken];[SimpleToken]
+extension[KeywordToken] type[StringToken] ET1[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken];[SimpleToken]
+extension[KeywordToken] type[StringToken] ET2[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Foo[StringToken];[SimpleToken]
+extension[KeywordToken] type[StringToken] ET3[StringToken]([BeginToken]int[StringToken] i[StringToken])[SimpleToken] implements[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken];[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart b/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart
new file mode 100644
index 0000000..4f7e954
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart
@@ -0,0 +1,9 @@
+extension type ET1 {}
+extension type ET2 implements Foo {}
+extension type ET3 implements Foo, Bar {}
+extension type ET4<T> {}
+extension type ET5<T> implements Foo {}
+extension type ET6<T> implements Foo, Bar {}
+extension type ET7<T>.name {}
+extension type ET8<T>.name implements Foo {}
+extension type ET9<T>.name implements Foo, Bar {}
\ No newline at end of file
diff --git a/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.expect b/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.expect
new file mode 100644
index 0000000..a363ae6
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.expect
@@ -0,0 +1,232 @@
+Problems reported:
+
+parser/inline_class/no_primary_constructor:1:16: An extension type declaration must have a primary constructor declaration.
+extension type ET1 {}
+               ^^^
+
+parser/inline_class/no_primary_constructor:2:16: An extension type declaration must have a primary constructor declaration.
+extension type ET2 implements Foo {}
+               ^^^
+
+parser/inline_class/no_primary_constructor:3:16: An extension type declaration must have a primary constructor declaration.
+extension type ET3 implements Foo, Bar {}
+               ^^^
+
+parser/inline_class/no_primary_constructor:4:21: An extension type declaration must have a primary constructor declaration.
+extension type ET4<T> {}
+                    ^
+
+parser/inline_class/no_primary_constructor:5:21: An extension type declaration must have a primary constructor declaration.
+extension type ET5<T> implements Foo {}
+                    ^
+
+parser/inline_class/no_primary_constructor:6:21: An extension type declaration must have a primary constructor declaration.
+extension type ET6<T> implements Foo, Bar {}
+                    ^
+
+parser/inline_class/no_primary_constructor:7:23: A primary constructor declaration must have formal parameters.
+extension type ET7<T>.name {}
+                      ^^^^
+
+parser/inline_class/no_primary_constructor:8:23: A primary constructor declaration must have formal parameters.
+extension type ET8<T>.name implements Foo {}
+                      ^^^^
+
+parser/inline_class/no_primary_constructor:9:23: A primary constructor declaration must have formal parameters.
+extension type ET9<T>.name implements Foo, Bar {}
+                      ^^^^
+
+beginCompilationUnit(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables({)
+    beginExtensionTypeDeclaration(extension, ET1)
+      handleRecoverableError(MissingPrimaryConstructor, ET1, ET1)
+      handleNoPrimaryConstructor(ET1, null)
+      handleImplements(null, 0)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(implements)
+    beginExtensionTypeDeclaration(extension, ET2)
+      handleRecoverableError(MissingPrimaryConstructor, ET2, ET2)
+      handleNoPrimaryConstructor(ET2, null)
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments({)
+      handleType(Foo, null)
+      handleImplements(implements, 1)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    handleNoTypeVariables(implements)
+    beginExtensionTypeDeclaration(extension, ET3)
+      handleRecoverableError(MissingPrimaryConstructor, ET3, ET3)
+      handleNoPrimaryConstructor(ET3, null)
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments(,)
+      handleType(Foo, null)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments({)
+      handleType(Bar, null)
+      handleImplements(implements, 2)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    beginTypeVariables(<)
+      beginMetadataStar(T)
+      endMetadataStar(0)
+      handleIdentifier(T, typeVariableDeclaration)
+      beginTypeVariable(T)
+        handleTypeVariablesDefined(T, 1)
+        handleNoType(T)
+      endTypeVariable(>, 0, null, null)
+    endTypeVariables(<, >)
+    beginExtensionTypeDeclaration(extension, ET4)
+      handleRecoverableError(MissingPrimaryConstructor, >, >)
+      handleNoPrimaryConstructor(>, null)
+      handleImplements(null, 0)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    beginTypeVariables(<)
+      beginMetadataStar(T)
+      endMetadataStar(0)
+      handleIdentifier(T, typeVariableDeclaration)
+      beginTypeVariable(T)
+        handleTypeVariablesDefined(T, 1)
+        handleNoType(T)
+      endTypeVariable(>, 0, null, null)
+    endTypeVariables(<, >)
+    beginExtensionTypeDeclaration(extension, ET5)
+      handleRecoverableError(MissingPrimaryConstructor, >, >)
+      handleNoPrimaryConstructor(>, null)
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments({)
+      handleType(Foo, null)
+      handleImplements(implements, 1)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    beginTypeVariables(<)
+      beginMetadataStar(T)
+      endMetadataStar(0)
+      handleIdentifier(T, typeVariableDeclaration)
+      beginTypeVariable(T)
+        handleTypeVariablesDefined(T, 1)
+        handleNoType(T)
+      endTypeVariable(>, 0, null, null)
+    endTypeVariables(<, >)
+    beginExtensionTypeDeclaration(extension, ET6)
+      handleRecoverableError(MissingPrimaryConstructor, >, >)
+      handleNoPrimaryConstructor(>, null)
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments(,)
+      handleType(Foo, null)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments({)
+      handleType(Bar, null)
+      handleImplements(implements, 2)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    beginTypeVariables(<)
+      beginMetadataStar(T)
+      endMetadataStar(0)
+      handleIdentifier(T, typeVariableDeclaration)
+      beginTypeVariable(T)
+        handleTypeVariablesDefined(T, 1)
+        handleNoType(T)
+      endTypeVariable(>, 0, null, null)
+    endTypeVariables(<, >)
+    beginExtensionTypeDeclaration(extension, ET7)
+      beginPrimaryConstructor(.)
+        handleIdentifier(name, primaryConstructorDeclaration)
+        handleRecoverableError(MissingPrimaryConstructorParameters, name, name)
+        handleNoFormalParameters(name, MemberKind.PrimaryConstructor)
+      endPrimaryConstructor(., null, true)
+      handleImplements(null, 0)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    beginTypeVariables(<)
+      beginMetadataStar(T)
+      endMetadataStar(0)
+      handleIdentifier(T, typeVariableDeclaration)
+      beginTypeVariable(T)
+        handleTypeVariablesDefined(T, 1)
+        handleNoType(T)
+      endTypeVariable(>, 0, null, null)
+    endTypeVariables(<, >)
+    beginExtensionTypeDeclaration(extension, ET8)
+      beginPrimaryConstructor(.)
+        handleIdentifier(name, primaryConstructorDeclaration)
+        handleRecoverableError(MissingPrimaryConstructorParameters, name, name)
+        handleNoFormalParameters(name, MemberKind.PrimaryConstructor)
+      endPrimaryConstructor(., null, true)
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments({)
+      handleType(Foo, null)
+      handleImplements(implements, 1)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration(extension)
+  beginMetadataStar(extension)
+  endMetadataStar(0)
+  beginExtensionDeclarationPrelude(extension)
+    beginTypeVariables(<)
+      beginMetadataStar(T)
+      endMetadataStar(0)
+      handleIdentifier(T, typeVariableDeclaration)
+      beginTypeVariable(T)
+        handleTypeVariablesDefined(T, 1)
+        handleNoType(T)
+      endTypeVariable(>, 0, null, null)
+    endTypeVariables(<, >)
+    beginExtensionTypeDeclaration(extension, ET9)
+      beginPrimaryConstructor(.)
+        handleIdentifier(name, primaryConstructorDeclaration)
+        handleRecoverableError(MissingPrimaryConstructorParameters, name, name)
+        handleNoFormalParameters(name, MemberKind.PrimaryConstructor)
+      endPrimaryConstructor(., null, true)
+      handleIdentifier(Foo, typeReference)
+      handleNoTypeArguments(,)
+      handleType(Foo, null)
+      handleIdentifier(Bar, typeReference)
+      handleNoTypeArguments({)
+      handleType(Bar, null)
+      handleImplements(implements, 2)
+      beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+      endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+    endExtensionTypeDeclaration(extension, type, })
+  endTopLevelDeclaration()
+endCompilationUnit(9, )
diff --git a/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.intertwined.expect b/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.intertwined.expect
new file mode 100644
index 0000000..7cbe733
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.intertwined.expect
@@ -0,0 +1,282 @@
+parseUnit(extension)
+  skipErrorTokens(extension)
+  listener: beginCompilationUnit(extension)
+  syntheticPreviousToken(extension)
+  parseTopLevelDeclarationImpl(, Instance of 'DirectiveContext')
+    parseMetadataStar()
+      listener: beginMetadataStar(extension)
+      listener: endMetadataStar(0)
+    parseTopLevelKeywordDeclaration(, extension, null, null, null, null, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables({)
+          listener: beginExtensionTypeDeclaration(extension, ET1)
+          reportRecoverableError(ET1, MissingPrimaryConstructor)
+            listener: handleRecoverableError(MissingPrimaryConstructor, ET1, ET1)
+          listener: handleNoPrimaryConstructor(ET1, null)
+          parseClassOrMixinOrEnumImplementsOpt(ET1)
+            listener: handleImplements(null, 0)
+          parseClassOrMixinOrExtensionBody(ET1, DeclarationKind.ExtensionType, ET1)
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(implements)
+          listener: beginExtensionTypeDeclaration(extension, ET2)
+          reportRecoverableError(ET2, MissingPrimaryConstructor)
+            listener: handleRecoverableError(MissingPrimaryConstructor, ET2, ET2)
+          listener: handleNoPrimaryConstructor(ET2, null)
+          parseClassOrMixinOrEnumImplementsOpt(ET2)
+            listener: handleIdentifier(Foo, typeReference)
+            listener: handleNoTypeArguments({)
+            listener: handleType(Foo, null)
+            listener: handleImplements(implements, 1)
+          parseClassOrMixinOrExtensionBody(Foo, DeclarationKind.ExtensionType, ET2)
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: handleNoTypeVariables(implements)
+          listener: beginExtensionTypeDeclaration(extension, ET3)
+          reportRecoverableError(ET3, MissingPrimaryConstructor)
+            listener: handleRecoverableError(MissingPrimaryConstructor, ET3, ET3)
+          listener: handleNoPrimaryConstructor(ET3, null)
+          parseClassOrMixinOrEnumImplementsOpt(ET3)
+            listener: handleIdentifier(Foo, typeReference)
+            listener: handleNoTypeArguments(,)
+            listener: handleType(Foo, null)
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments({)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 2)
+          parseClassOrMixinOrExtensionBody(Bar, DeclarationKind.ExtensionType, ET3)
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: beginTypeVariables(<)
+          listener: beginMetadataStar(T)
+          listener: endMetadataStar(0)
+          listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(T, 1)
+          listener: handleNoType(T)
+          listener: endTypeVariable(>, 0, null, null)
+          listener: endTypeVariables(<, >)
+          listener: beginExtensionTypeDeclaration(extension, ET4)
+          reportRecoverableError(>, MissingPrimaryConstructor)
+            listener: handleRecoverableError(MissingPrimaryConstructor, >, >)
+          listener: handleNoPrimaryConstructor(>, null)
+          parseClassOrMixinOrEnumImplementsOpt(>)
+            listener: handleImplements(null, 0)
+          parseClassOrMixinOrExtensionBody(>, DeclarationKind.ExtensionType, ET4)
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: beginTypeVariables(<)
+          listener: beginMetadataStar(T)
+          listener: endMetadataStar(0)
+          listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(T, 1)
+          listener: handleNoType(T)
+          listener: endTypeVariable(>, 0, null, null)
+          listener: endTypeVariables(<, >)
+          listener: beginExtensionTypeDeclaration(extension, ET5)
+          reportRecoverableError(>, MissingPrimaryConstructor)
+            listener: handleRecoverableError(MissingPrimaryConstructor, >, >)
+          listener: handleNoPrimaryConstructor(>, null)
+          parseClassOrMixinOrEnumImplementsOpt(>)
+            listener: handleIdentifier(Foo, typeReference)
+            listener: handleNoTypeArguments({)
+            listener: handleType(Foo, null)
+            listener: handleImplements(implements, 1)
+          parseClassOrMixinOrExtensionBody(Foo, DeclarationKind.ExtensionType, ET5)
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: beginTypeVariables(<)
+          listener: beginMetadataStar(T)
+          listener: endMetadataStar(0)
+          listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(T, 1)
+          listener: handleNoType(T)
+          listener: endTypeVariable(>, 0, null, null)
+          listener: endTypeVariables(<, >)
+          listener: beginExtensionTypeDeclaration(extension, ET6)
+          reportRecoverableError(>, MissingPrimaryConstructor)
+            listener: handleRecoverableError(MissingPrimaryConstructor, >, >)
+          listener: handleNoPrimaryConstructor(>, null)
+          parseClassOrMixinOrEnumImplementsOpt(>)
+            listener: handleIdentifier(Foo, typeReference)
+            listener: handleNoTypeArguments(,)
+            listener: handleType(Foo, null)
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments({)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 2)
+          parseClassOrMixinOrExtensionBody(Bar, DeclarationKind.ExtensionType, ET6)
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: beginTypeVariables(<)
+          listener: beginMetadataStar(T)
+          listener: endMetadataStar(0)
+          listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(T, 1)
+          listener: handleNoType(T)
+          listener: endTypeVariable(>, 0, null, null)
+          listener: endTypeVariables(<, >)
+          listener: beginExtensionTypeDeclaration(extension, ET7)
+          listener: beginPrimaryConstructor(.)
+          ensureIdentifier(., primaryConstructorDeclaration)
+            listener: handleIdentifier(name, primaryConstructorDeclaration)
+          reportRecoverableError(name, MissingPrimaryConstructorParameters)
+            listener: handleRecoverableError(MissingPrimaryConstructorParameters, name, name)
+          listener: handleNoFormalParameters(name, MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor(., null, true)
+          parseClassOrMixinOrEnumImplementsOpt(name)
+            listener: handleImplements(null, 0)
+          parseClassOrMixinOrExtensionBody(name, DeclarationKind.ExtensionType, ET7)
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: beginTypeVariables(<)
+          listener: beginMetadataStar(T)
+          listener: endMetadataStar(0)
+          listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(T, 1)
+          listener: handleNoType(T)
+          listener: endTypeVariable(>, 0, null, null)
+          listener: endTypeVariables(<, >)
+          listener: beginExtensionTypeDeclaration(extension, ET8)
+          listener: beginPrimaryConstructor(.)
+          ensureIdentifier(., primaryConstructorDeclaration)
+            listener: handleIdentifier(name, primaryConstructorDeclaration)
+          reportRecoverableError(name, MissingPrimaryConstructorParameters)
+            listener: handleRecoverableError(MissingPrimaryConstructorParameters, name, name)
+          listener: handleNoFormalParameters(name, MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor(., null, true)
+          parseClassOrMixinOrEnumImplementsOpt(name)
+            listener: handleIdentifier(Foo, typeReference)
+            listener: handleNoTypeArguments({)
+            listener: handleType(Foo, null)
+            listener: handleImplements(implements, 1)
+          parseClassOrMixinOrExtensionBody(Foo, DeclarationKind.ExtensionType, ET8)
+            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, null, Instance of 'DirectiveContext')
+      parseExtension(extension)
+        listener: beginExtensionDeclarationPrelude(extension)
+        parseExtensionTypeDeclaration(type, extension, type)
+          listener: beginTypeVariables(<)
+          listener: beginMetadataStar(T)
+          listener: endMetadataStar(0)
+          listener: handleIdentifier(T, typeVariableDeclaration)
+          listener: beginTypeVariable(T)
+          listener: handleTypeVariablesDefined(T, 1)
+          listener: handleNoType(T)
+          listener: endTypeVariable(>, 0, null, null)
+          listener: endTypeVariables(<, >)
+          listener: beginExtensionTypeDeclaration(extension, ET9)
+          listener: beginPrimaryConstructor(.)
+          ensureIdentifier(., primaryConstructorDeclaration)
+            listener: handleIdentifier(name, primaryConstructorDeclaration)
+          reportRecoverableError(name, MissingPrimaryConstructorParameters)
+            listener: handleRecoverableError(MissingPrimaryConstructorParameters, name, name)
+          listener: handleNoFormalParameters(name, MemberKind.PrimaryConstructor)
+          listener: endPrimaryConstructor(., null, true)
+          parseClassOrMixinOrEnumImplementsOpt(name)
+            listener: handleIdentifier(Foo, typeReference)
+            listener: handleNoTypeArguments(,)
+            listener: handleType(Foo, null)
+            listener: handleIdentifier(Bar, typeReference)
+            listener: handleNoTypeArguments({)
+            listener: handleType(Bar, null)
+            listener: handleImplements(implements, 2)
+          parseClassOrMixinOrExtensionBody(Bar, DeclarationKind.ExtensionType, ET9)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, {)
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.ExtensionType, 0, {, })
+          listener: endExtensionTypeDeclaration(extension, type, })
+  listener: endTopLevelDeclaration()
+  reportAllErrorTokens(extension)
+  listener: endCompilationUnit(9, )
diff --git a/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.parser.expect b/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.parser.expect
new file mode 100644
index 0000000..ca5d554
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.parser.expect
@@ -0,0 +1,19 @@
+extension type ET1 {}
+extension type ET2 implements Foo {}
+extension type ET3 implements Foo, Bar {}
+extension type ET4<T> {}
+extension type ET5<T> implements Foo {}
+extension type ET6<T> implements Foo, Bar {}
+extension type ET7<T>.name {}
+extension type ET8<T>.name implements Foo {}
+extension type ET9<T>.name implements Foo, Bar {}
+
+extension[KeywordToken] type[StringToken] ET1[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET2[StringToken] implements[KeywordToken] Foo[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET3[StringToken] implements[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET4[StringToken]<[BeginToken]T[StringToken]>[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET5[StringToken]<[BeginToken]T[StringToken]>[SimpleToken] implements[KeywordToken] Foo[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET6[StringToken]<[BeginToken]T[StringToken]>[SimpleToken] implements[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET7[StringToken]<[BeginToken]T[StringToken]>[SimpleToken].[SimpleToken]name[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET8[StringToken]<[BeginToken]T[StringToken]>[SimpleToken].[SimpleToken]name[StringToken] implements[KeywordToken] Foo[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET9[StringToken]<[BeginToken]T[StringToken]>[SimpleToken].[SimpleToken]name[StringToken] implements[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken] {[BeginToken]}[SimpleToken][SimpleToken]
diff --git a/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.scanner.expect b/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.scanner.expect
new file mode 100644
index 0000000..ca5d554
--- /dev/null
+++ b/pkg/front_end/parser_testcases/inline_class/no_primary_constructor.dart.scanner.expect
@@ -0,0 +1,19 @@
+extension type ET1 {}
+extension type ET2 implements Foo {}
+extension type ET3 implements Foo, Bar {}
+extension type ET4<T> {}
+extension type ET5<T> implements Foo {}
+extension type ET6<T> implements Foo, Bar {}
+extension type ET7<T>.name {}
+extension type ET8<T>.name implements Foo {}
+extension type ET9<T>.name implements Foo, Bar {}
+
+extension[KeywordToken] type[StringToken] ET1[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET2[StringToken] implements[KeywordToken] Foo[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET3[StringToken] implements[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET4[StringToken]<[BeginToken]T[StringToken]>[SimpleToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET5[StringToken]<[BeginToken]T[StringToken]>[SimpleToken] implements[KeywordToken] Foo[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET6[StringToken]<[BeginToken]T[StringToken]>[SimpleToken] implements[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET7[StringToken]<[BeginToken]T[StringToken]>[SimpleToken].[SimpleToken]name[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET8[StringToken]<[BeginToken]T[StringToken]>[SimpleToken].[SimpleToken]name[StringToken] implements[KeywordToken] Foo[StringToken] {[BeginToken]}[SimpleToken]
+extension[KeywordToken] type[StringToken] ET9[StringToken]<[BeginToken]T[StringToken]>[SimpleToken].[SimpleToken]name[StringToken] implements[KeywordToken] Foo[StringToken],[SimpleToken] Bar[StringToken] {[BeginToken]}[SimpleToken][SimpleToken]
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 9668fef..fb51426 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
@@ -9,119 +9,120 @@
     parseTopLevelKeywordDeclaration(, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(on)
-        listener: beginExtensionDeclaration(extension, null)
-        listener: handleIdentifier(Symbol, typeReference)
-        listener: handleNoTypeArguments({)
-        listener: handleType(Symbol, null)
-        parseClassOrMixinOrExtensionBody(Symbol, DeclarationKind.Extension, null)
-          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
-          notEofOrValue(}, String)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, null)
-            parseMetadataStar({)
-              listener: beginMetadataStar(String)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            parseMethod({, null, null, null, null, null, null, null, {, Instance of 'SimpleType', null, operator, DeclarationKind.Extension, null, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
-              listener: handleIdentifier(String, typeReference)
-              listener: handleNoTypeArguments(operator)
-              listener: handleType(String, null)
-              parseOperatorName(String)
-                listener: handleOperatorName(operator, >)
-              parseMethodTypeVar(>)
-                listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(>, operator, false, MemberKind.ExtensionNonStaticMethod)
-                parseFormalParameters(>, MemberKind.ExtensionNonStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(_)
-                        listener: endMetadataStar(0)
-                      listener: beginFormalParameter(_, MemberKind.ExtensionNonStaticMethod, null, null, null)
-                      listener: handleNoType(()
-                      ensureIdentifier((, formalParameterDeclaration)
-                        listener: handleIdentifier(_, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, _, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                    listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
+        parseExtensionDeclaration(extension, extension)
+          listener: handleNoTypeVariables(on)
+          listener: beginExtensionDeclaration(extension, null)
+          listener: handleIdentifier(Symbol, typeReference)
+          listener: handleNoTypeArguments({)
+          listener: handleType(Symbol, null)
+          parseClassOrMixinOrExtensionBody(Symbol, DeclarationKind.Extension, null)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+            notEofOrValue(}, String)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, null)
+              parseMetadataStar({)
+                listener: beginMetadataStar(String)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              parseMethod({, null, null, null, null, null, null, null, {, Instance of 'SimpleType', null, operator, DeclarationKind.Extension, null, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
+                listener: handleIdentifier(String, typeReference)
+                listener: handleNoTypeArguments(operator)
+                listener: handleType(String, null)
+                parseOperatorName(String)
+                  listener: handleOperatorName(operator, >)
+                parseMethodTypeVar(>)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(>, operator, false, MemberKind.ExtensionNonStaticMethod)
+                  parseFormalParameters(>, MemberKind.ExtensionNonStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(_)
+                          listener: endMetadataStar(0)
+                        listener: beginFormalParameter(_, MemberKind.ExtensionNonStaticMethod, null, null, null)
+                        listener: handleNoType(()
+                        ensureIdentifier((, formalParameterDeclaration)
+                          listener: handleIdentifier(_, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, _, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                      listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
                 inPlainSync()
-              inPlainSync()
-              parseFunctionBody(), false, true)
-                parseExpressionFunctionBody(=>, false)
-                  parseExpression(=>)
-                    parsePrecedenceExpression(=>, 1, true, ConstantPatternContext.none)
-                      parseUnaryExpression(=>, true, ConstantPatternContext.none)
-                        parsePrimary(=>, expression, ConstantPatternContext.none)
-                          parseLiteralString(=>)
-                            parseSingleLiteralString(=>)
-                              listener: beginLiteralString("Greater Than used")
-                              listener: endLiteralString(0, ;)
-                  ensureSemicolon("Greater Than used")
-                  listener: handleExpressionFunctionBody(=>, ;)
-                  inGenerator()
-              listener: endExtensionMethod(null, String, (, null, ;)
-            listener: endMember()
-          notEofOrValue(}, String)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl(;, DeclarationKind.Extension, null)
-            parseMetadataStar(;)
-              listener: beginMetadataStar(String)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            parseMethod(;, null, null, null, null, null, null, null, ;, Instance of 'SimpleType', null, call, DeclarationKind.Extension, null, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, call)
-              listener: handleIdentifier(String, typeReference)
-              listener: handleNoTypeArguments(call)
-              listener: handleType(String, null)
-              ensureIdentifierPotentiallyRecovered(String, methodDeclaration, false)
-                listener: handleIdentifier(call, methodDeclaration)
-              parseQualifiedRestOpt(call, methodDeclarationContinuation)
-              parseMethodTypeVar(call)
-                listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(call, call, false, MemberKind.ExtensionNonStaticMethod)
-                parseFormalParameters(call, MemberKind.ExtensionNonStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(_)
-                        listener: endMetadataStar(0)
-                      listener: beginFormalParameter(_, MemberKind.ExtensionNonStaticMethod, null, null, null)
-                      listener: handleNoType(()
-                      ensureIdentifier((, formalParameterDeclaration)
-                        listener: handleIdentifier(_, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, _, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                    listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
+                parseFunctionBody(), false, true)
+                  parseExpressionFunctionBody(=>, false)
+                    parseExpression(=>)
+                      parsePrecedenceExpression(=>, 1, true, ConstantPatternContext.none)
+                        parseUnaryExpression(=>, true, ConstantPatternContext.none)
+                          parsePrimary(=>, expression, ConstantPatternContext.none)
+                            parseLiteralString(=>)
+                              parseSingleLiteralString(=>)
+                                listener: beginLiteralString("Greater Than used")
+                                listener: endLiteralString(0, ;)
+                    ensureSemicolon("Greater Than used")
+                    listener: handleExpressionFunctionBody(=>, ;)
+                    inGenerator()
+                listener: endExtensionMethod(null, String, (, null, ;)
+              listener: endMember()
+            notEofOrValue(}, String)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl(;, DeclarationKind.Extension, null)
+              parseMetadataStar(;)
+                listener: beginMetadataStar(String)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              parseMethod(;, null, null, null, null, null, null, null, ;, Instance of 'SimpleType', null, call, DeclarationKind.Extension, null, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, call)
+                listener: handleIdentifier(String, typeReference)
+                listener: handleNoTypeArguments(call)
+                listener: handleType(String, null)
+                ensureIdentifierPotentiallyRecovered(String, methodDeclaration, false)
+                  listener: handleIdentifier(call, methodDeclaration)
+                parseQualifiedRestOpt(call, methodDeclarationContinuation)
+                parseMethodTypeVar(call)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(call, call, false, MemberKind.ExtensionNonStaticMethod)
+                  parseFormalParameters(call, MemberKind.ExtensionNonStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(_)
+                          listener: endMetadataStar(0)
+                        listener: beginFormalParameter(_, MemberKind.ExtensionNonStaticMethod, null, null, null)
+                        listener: handleNoType(()
+                        ensureIdentifier((, formalParameterDeclaration)
+                          listener: handleIdentifier(_, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, _, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                      listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
                 inPlainSync()
-              inPlainSync()
-              parseFunctionBody(), false, true)
-                parseExpressionFunctionBody(=>, false)
-                  parseExpression(=>)
-                    parsePrecedenceExpression(=>, 1, true, ConstantPatternContext.none)
-                      parseUnaryExpression(=>, true, ConstantPatternContext.none)
-                        parsePrimary(=>, expression, ConstantPatternContext.none)
-                          parseLiteralString(=>)
-                            parseSingleLiteralString(=>)
-                              listener: beginLiteralString("Called")
-                              listener: endLiteralString(0, ;)
-                  ensureSemicolon("Called")
-                  listener: handleExpressionFunctionBody(=>, ;)
-                  inGenerator()
-              listener: endExtensionMethod(null, String, (, null, ;)
-            listener: endMember()
-          notEofOrValue(}, })
-          listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 2, {, })
-        listener: endExtensionDeclaration(extension, on, })
+                parseFunctionBody(), false, true)
+                  parseExpressionFunctionBody(=>, false)
+                    parseExpression(=>)
+                      parsePrecedenceExpression(=>, 1, true, ConstantPatternContext.none)
+                        parseUnaryExpression(=>, true, ConstantPatternContext.none)
+                          parsePrimary(=>, expression, ConstantPatternContext.none)
+                            parseLiteralString(=>)
+                              parseSingleLiteralString(=>)
+                                listener: beginLiteralString("Called")
+                                listener: endLiteralString(0, ;)
+                    ensureSemicolon("Called")
+                    listener: handleExpressionFunctionBody(=>, ;)
+                    inGenerator()
+                listener: endExtensionMethod(null, String, (, null, ;)
+              listener: endMember()
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 2, {, })
+          listener: endExtensionDeclaration(extension, on, })
   listener: endTopLevelDeclaration(void)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
diff --git a/pkg/front_end/parser_testcases/record/issue_52365.dart.intertwined.expect b/pkg/front_end/parser_testcases/record/issue_52365.dart.intertwined.expect
index 0fe6692..c0d163b 100644
--- a/pkg/front_end/parser_testcases/record/issue_52365.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/record/issue_52365.dart.intertwined.expect
@@ -1953,292 +1953,293 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(on)
-        listener: beginExtensionDeclaration(extension, FunctionExtension)
-        listener: handleIdentifier(Function, typeReference)
-        listener: handleNoTypeArguments({)
-        listener: handleType(Function, null)
-        parseClassOrMixinOrExtensionBody(Function, DeclarationKind.Extension, FunctionExtension)
-          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
-          notEofOrValue(}, operator)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, FunctionExtension)
-            parseMetadataStar({)
-              listener: beginMetadataStar(operator)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            parseMethod({, null, null, null, null, null, null, null, {, Instance of 'NoType', null, operator, DeclarationKind.Extension, FunctionExtension, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
-              listener: handleNoType({)
-              parseOperatorName({)
-                listener: handleOperatorName(operator, >)
-              parseMethodTypeVar(>)
-                listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(>, operator, false, MemberKind.ExtensionNonStaticMethod)
-                parseFormalParameters(>, MemberKind.ExtensionNonStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(dynamic)
-                        listener: endMetadataStar(0)
-                      listener: beginFormalParameter(dynamic, MemberKind.ExtensionNonStaticMethod, null, null, null)
-                      listener: handleIdentifier(dynamic, typeReference)
-                      listener: handleNoTypeArguments(x)
-                      listener: handleType(dynamic, null)
-                      ensureIdentifier(dynamic, formalParameterDeclaration)
-                        listener: handleIdentifier(x, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                    listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
+        parseExtensionDeclaration(extension, extension)
+          listener: handleNoTypeVariables(on)
+          listener: beginExtensionDeclaration(extension, FunctionExtension)
+          listener: handleIdentifier(Function, typeReference)
+          listener: handleNoTypeArguments({)
+          listener: handleType(Function, null)
+          parseClassOrMixinOrExtensionBody(Function, DeclarationKind.Extension, FunctionExtension)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+            notEofOrValue(}, operator)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, FunctionExtension)
+              parseMetadataStar({)
+                listener: beginMetadataStar(operator)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              parseMethod({, null, null, null, null, null, null, null, {, Instance of 'NoType', null, operator, DeclarationKind.Extension, FunctionExtension, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
+                listener: handleNoType({)
+                parseOperatorName({)
+                  listener: handleOperatorName(operator, >)
+                parseMethodTypeVar(>)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(>, operator, false, MemberKind.ExtensionNonStaticMethod)
+                  parseFormalParameters(>, MemberKind.ExtensionNonStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(dynamic)
+                          listener: endMetadataStar(0)
+                        listener: beginFormalParameter(dynamic, MemberKind.ExtensionNonStaticMethod, null, null, null)
+                        listener: handleIdentifier(dynamic, typeReference)
+                        listener: handleNoTypeArguments(x)
+                        listener: handleType(dynamic, null)
+                        ensureIdentifier(dynamic, formalParameterDeclaration)
+                          listener: handleIdentifier(x, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                      listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
                 inPlainSync()
-              inPlainSync()
-              parseFunctionBody(), false, true)
-                listener: beginBlockFunctionBody({)
-                notEofOrValue(}, print)
-                parseStatement({)
-                  parseStatementX({)
-                    parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, null)
-                      looksLikeLocalFunction(print)
-                      parseExpressionStatement({)
-                        parseExpression({)
-                          parsePrecedenceExpression({, 1, true, ConstantPatternContext.none)
-                            parseUnaryExpression({, true, ConstantPatternContext.none)
-                              parsePrimary({, expression, ConstantPatternContext.none)
-                                parseSendOrFunctionLiteral({, expression, ConstantPatternContext.none)
-                                  looksLikeFunctionBody(;)
-                                  parseSend({, expression, ConstantPatternContext.none)
-                                    isNextIdentifier({)
-                                    ensureIdentifier({, expression)
-                                      listener: handleIdentifier(print, expression)
-                                    listener: handleNoTypeArguments(()
-                                    parseArgumentsOpt(print)
-                                      parseArguments(print)
-                                        parseArgumentsRest(()
-                                          listener: beginArguments(()
-                                          parseExpression(()
-                                            parsePrecedenceExpression((, 1, true, ConstantPatternContext.none)
-                                              parseUnaryExpression((, true, ConstantPatternContext.none)
-                                                parsePrimary((, expression, ConstantPatternContext.none)
-                                                  parseLiteralString(()
-                                                    parseSingleLiteralString(()
-                                                      listener: beginLiteralString("You did > with ')
-                                                      parseIdentifierExpression($)
-                                                        parseSend($, expression, ConstantPatternContext.none)
-                                                          isNextIdentifier($)
-                                                          ensureIdentifier($, expression)
-                                                            listener: handleIdentifier(x, expression)
-                                                          listener: handleNoTypeArguments(' on ')
-                                                          parseArgumentsOpt(x)
-                                                            listener: handleNoArguments(' on ')
-                                                          listener: handleSend(x, ' on ')
-                                                      listener: handleInterpolationExpression($, null)
-                                                      parseStringPart(x)
-                                                        listener: handleStringPart(' on ')
-                                                      parseIdentifierExpression($)
-                                                        listener: handleThisExpression(this, expression)
-                                                      listener: handleInterpolationExpression($, null)
-                                                      parseStringPart(this)
-                                                        listener: handleStringPart(' (Function)")
-                                                      listener: endLiteralString(2, ))
-                                          listener: endArguments(1, (, ))
-                                    listener: handleSend(print, ;)
-                        ensureSemicolon())
-                        listener: handleExpressionStatement(;)
-                notEofOrValue(}, })
-                listener: endBlockFunctionBody(1, {, })
-              listener: endExtensionMethod(null, operator, (, null, })
-            listener: endMember()
-          notEofOrValue(}, operator)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Extension, FunctionExtension)
-            parseMetadataStar(})
-              listener: beginMetadataStar(operator)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            parseMethod(}, null, null, null, null, null, null, null, }, Instance of 'NoType', null, operator, DeclarationKind.Extension, FunctionExtension, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
-              listener: handleNoType(})
-              parseOperatorName(})
-                listener: handleOperatorName(operator, >>)
-              parseMethodTypeVar(>>)
-                listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(>>, operator, false, MemberKind.ExtensionNonStaticMethod)
-                parseFormalParameters(>>, MemberKind.ExtensionNonStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(dynamic)
-                        listener: endMetadataStar(0)
-                      listener: beginFormalParameter(dynamic, MemberKind.ExtensionNonStaticMethod, null, null, null)
-                      listener: handleIdentifier(dynamic, typeReference)
-                      listener: handleNoTypeArguments(x)
-                      listener: handleType(dynamic, null)
-                      ensureIdentifier(dynamic, formalParameterDeclaration)
-                        listener: handleIdentifier(x, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                    listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
+                parseFunctionBody(), false, true)
+                  listener: beginBlockFunctionBody({)
+                  notEofOrValue(}, print)
+                  parseStatement({)
+                    parseStatementX({)
+                      parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, null)
+                        looksLikeLocalFunction(print)
+                        parseExpressionStatement({)
+                          parseExpression({)
+                            parsePrecedenceExpression({, 1, true, ConstantPatternContext.none)
+                              parseUnaryExpression({, true, ConstantPatternContext.none)
+                                parsePrimary({, expression, ConstantPatternContext.none)
+                                  parseSendOrFunctionLiteral({, expression, ConstantPatternContext.none)
+                                    looksLikeFunctionBody(;)
+                                    parseSend({, expression, ConstantPatternContext.none)
+                                      isNextIdentifier({)
+                                      ensureIdentifier({, expression)
+                                        listener: handleIdentifier(print, expression)
+                                      listener: handleNoTypeArguments(()
+                                      parseArgumentsOpt(print)
+                                        parseArguments(print)
+                                          parseArgumentsRest(()
+                                            listener: beginArguments(()
+                                            parseExpression(()
+                                              parsePrecedenceExpression((, 1, true, ConstantPatternContext.none)
+                                                parseUnaryExpression((, true, ConstantPatternContext.none)
+                                                  parsePrimary((, expression, ConstantPatternContext.none)
+                                                    parseLiteralString(()
+                                                      parseSingleLiteralString(()
+                                                        listener: beginLiteralString("You did > with ')
+                                                        parseIdentifierExpression($)
+                                                          parseSend($, expression, ConstantPatternContext.none)
+                                                            isNextIdentifier($)
+                                                            ensureIdentifier($, expression)
+                                                              listener: handleIdentifier(x, expression)
+                                                            listener: handleNoTypeArguments(' on ')
+                                                            parseArgumentsOpt(x)
+                                                              listener: handleNoArguments(' on ')
+                                                            listener: handleSend(x, ' on ')
+                                                        listener: handleInterpolationExpression($, null)
+                                                        parseStringPart(x)
+                                                          listener: handleStringPart(' on ')
+                                                        parseIdentifierExpression($)
+                                                          listener: handleThisExpression(this, expression)
+                                                        listener: handleInterpolationExpression($, null)
+                                                        parseStringPart(this)
+                                                          listener: handleStringPart(' (Function)")
+                                                        listener: endLiteralString(2, ))
+                                            listener: endArguments(1, (, ))
+                                      listener: handleSend(print, ;)
+                          ensureSemicolon())
+                          listener: handleExpressionStatement(;)
+                  notEofOrValue(}, })
+                  listener: endBlockFunctionBody(1, {, })
+                listener: endExtensionMethod(null, operator, (, null, })
+              listener: endMember()
+            notEofOrValue(}, operator)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Extension, FunctionExtension)
+              parseMetadataStar(})
+                listener: beginMetadataStar(operator)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              parseMethod(}, null, null, null, null, null, null, null, }, Instance of 'NoType', null, operator, DeclarationKind.Extension, FunctionExtension, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
+                listener: handleNoType(})
+                parseOperatorName(})
+                  listener: handleOperatorName(operator, >>)
+                parseMethodTypeVar(>>)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(>>, operator, false, MemberKind.ExtensionNonStaticMethod)
+                  parseFormalParameters(>>, MemberKind.ExtensionNonStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(dynamic)
+                          listener: endMetadataStar(0)
+                        listener: beginFormalParameter(dynamic, MemberKind.ExtensionNonStaticMethod, null, null, null)
+                        listener: handleIdentifier(dynamic, typeReference)
+                        listener: handleNoTypeArguments(x)
+                        listener: handleType(dynamic, null)
+                        ensureIdentifier(dynamic, formalParameterDeclaration)
+                          listener: handleIdentifier(x, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                      listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
                 inPlainSync()
-              inPlainSync()
-              parseFunctionBody(), false, true)
-                listener: beginBlockFunctionBody({)
-                notEofOrValue(}, print)
-                parseStatement({)
-                  parseStatementX({)
-                    parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, null)
-                      looksLikeLocalFunction(print)
-                      parseExpressionStatement({)
-                        parseExpression({)
-                          parsePrecedenceExpression({, 1, true, ConstantPatternContext.none)
-                            parseUnaryExpression({, true, ConstantPatternContext.none)
-                              parsePrimary({, expression, ConstantPatternContext.none)
-                                parseSendOrFunctionLiteral({, expression, ConstantPatternContext.none)
-                                  looksLikeFunctionBody(;)
-                                  parseSend({, expression, ConstantPatternContext.none)
-                                    isNextIdentifier({)
-                                    ensureIdentifier({, expression)
-                                      listener: handleIdentifier(print, expression)
-                                    listener: handleNoTypeArguments(()
-                                    parseArgumentsOpt(print)
-                                      parseArguments(print)
-                                        parseArgumentsRest(()
-                                          listener: beginArguments(()
-                                          parseExpression(()
-                                            parsePrecedenceExpression((, 1, true, ConstantPatternContext.none)
-                                              parseUnaryExpression((, true, ConstantPatternContext.none)
-                                                parsePrimary((, expression, ConstantPatternContext.none)
-                                                  parseLiteralString(()
-                                                    parseSingleLiteralString(()
-                                                      listener: beginLiteralString("You did >> with ')
-                                                      parseIdentifierExpression($)
-                                                        parseSend($, expression, ConstantPatternContext.none)
-                                                          isNextIdentifier($)
-                                                          ensureIdentifier($, expression)
-                                                            listener: handleIdentifier(x, expression)
-                                                          listener: handleNoTypeArguments(' on ')
-                                                          parseArgumentsOpt(x)
-                                                            listener: handleNoArguments(' on ')
-                                                          listener: handleSend(x, ' on ')
-                                                      listener: handleInterpolationExpression($, null)
-                                                      parseStringPart(x)
-                                                        listener: handleStringPart(' on ')
-                                                      parseIdentifierExpression($)
-                                                        listener: handleThisExpression(this, expression)
-                                                      listener: handleInterpolationExpression($, null)
-                                                      parseStringPart(this)
-                                                        listener: handleStringPart(' (Function)")
-                                                      listener: endLiteralString(2, ))
-                                          listener: endArguments(1, (, ))
-                                    listener: handleSend(print, ;)
-                        ensureSemicolon())
-                        listener: handleExpressionStatement(;)
-                notEofOrValue(}, })
-                listener: endBlockFunctionBody(1, {, })
-              listener: endExtensionMethod(null, operator, (, null, })
-            listener: endMember()
-          notEofOrValue(}, operator)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Extension, FunctionExtension)
-            parseMetadataStar(})
-              listener: beginMetadataStar(operator)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            parseMethod(}, null, null, null, null, null, null, null, }, Instance of 'NoType', null, operator, DeclarationKind.Extension, FunctionExtension, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
-              listener: handleNoType(})
-              parseOperatorName(})
-                listener: handleOperatorName(operator, >>>)
-              parseMethodTypeVar(>>>)
-                listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(>>>, operator, false, MemberKind.ExtensionNonStaticMethod)
-                parseFormalParameters(>>>, MemberKind.ExtensionNonStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(dynamic)
-                        listener: endMetadataStar(0)
-                      listener: beginFormalParameter(dynamic, MemberKind.ExtensionNonStaticMethod, null, null, null)
-                      listener: handleIdentifier(dynamic, typeReference)
-                      listener: handleNoTypeArguments(x)
-                      listener: handleType(dynamic, null)
-                      ensureIdentifier(dynamic, formalParameterDeclaration)
-                        listener: handleIdentifier(x, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                    listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
+                parseFunctionBody(), false, true)
+                  listener: beginBlockFunctionBody({)
+                  notEofOrValue(}, print)
+                  parseStatement({)
+                    parseStatementX({)
+                      parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, null)
+                        looksLikeLocalFunction(print)
+                        parseExpressionStatement({)
+                          parseExpression({)
+                            parsePrecedenceExpression({, 1, true, ConstantPatternContext.none)
+                              parseUnaryExpression({, true, ConstantPatternContext.none)
+                                parsePrimary({, expression, ConstantPatternContext.none)
+                                  parseSendOrFunctionLiteral({, expression, ConstantPatternContext.none)
+                                    looksLikeFunctionBody(;)
+                                    parseSend({, expression, ConstantPatternContext.none)
+                                      isNextIdentifier({)
+                                      ensureIdentifier({, expression)
+                                        listener: handleIdentifier(print, expression)
+                                      listener: handleNoTypeArguments(()
+                                      parseArgumentsOpt(print)
+                                        parseArguments(print)
+                                          parseArgumentsRest(()
+                                            listener: beginArguments(()
+                                            parseExpression(()
+                                              parsePrecedenceExpression((, 1, true, ConstantPatternContext.none)
+                                                parseUnaryExpression((, true, ConstantPatternContext.none)
+                                                  parsePrimary((, expression, ConstantPatternContext.none)
+                                                    parseLiteralString(()
+                                                      parseSingleLiteralString(()
+                                                        listener: beginLiteralString("You did >> with ')
+                                                        parseIdentifierExpression($)
+                                                          parseSend($, expression, ConstantPatternContext.none)
+                                                            isNextIdentifier($)
+                                                            ensureIdentifier($, expression)
+                                                              listener: handleIdentifier(x, expression)
+                                                            listener: handleNoTypeArguments(' on ')
+                                                            parseArgumentsOpt(x)
+                                                              listener: handleNoArguments(' on ')
+                                                            listener: handleSend(x, ' on ')
+                                                        listener: handleInterpolationExpression($, null)
+                                                        parseStringPart(x)
+                                                          listener: handleStringPart(' on ')
+                                                        parseIdentifierExpression($)
+                                                          listener: handleThisExpression(this, expression)
+                                                        listener: handleInterpolationExpression($, null)
+                                                        parseStringPart(this)
+                                                          listener: handleStringPart(' (Function)")
+                                                        listener: endLiteralString(2, ))
+                                            listener: endArguments(1, (, ))
+                                      listener: handleSend(print, ;)
+                          ensureSemicolon())
+                          listener: handleExpressionStatement(;)
+                  notEofOrValue(}, })
+                  listener: endBlockFunctionBody(1, {, })
+                listener: endExtensionMethod(null, operator, (, null, })
+              listener: endMember()
+            notEofOrValue(}, operator)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Extension, FunctionExtension)
+              parseMetadataStar(})
+                listener: beginMetadataStar(operator)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              parseMethod(}, null, null, null, null, null, null, null, }, Instance of 'NoType', null, operator, DeclarationKind.Extension, FunctionExtension, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
+                listener: handleNoType(})
+                parseOperatorName(})
+                  listener: handleOperatorName(operator, >>>)
+                parseMethodTypeVar(>>>)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(>>>, operator, false, MemberKind.ExtensionNonStaticMethod)
+                  parseFormalParameters(>>>, MemberKind.ExtensionNonStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(dynamic)
+                          listener: endMetadataStar(0)
+                        listener: beginFormalParameter(dynamic, MemberKind.ExtensionNonStaticMethod, null, null, null)
+                        listener: handleIdentifier(dynamic, typeReference)
+                        listener: handleNoTypeArguments(x)
+                        listener: handleType(dynamic, null)
+                        ensureIdentifier(dynamic, formalParameterDeclaration)
+                          listener: handleIdentifier(x, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                      listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
                 inPlainSync()
-              inPlainSync()
-              parseFunctionBody(), false, true)
-                listener: beginBlockFunctionBody({)
-                notEofOrValue(}, print)
-                parseStatement({)
-                  parseStatementX({)
-                    parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, null)
-                      looksLikeLocalFunction(print)
-                      parseExpressionStatement({)
-                        parseExpression({)
-                          parsePrecedenceExpression({, 1, true, ConstantPatternContext.none)
-                            parseUnaryExpression({, true, ConstantPatternContext.none)
-                              parsePrimary({, expression, ConstantPatternContext.none)
-                                parseSendOrFunctionLiteral({, expression, ConstantPatternContext.none)
-                                  looksLikeFunctionBody(;)
-                                  parseSend({, expression, ConstantPatternContext.none)
-                                    isNextIdentifier({)
-                                    ensureIdentifier({, expression)
-                                      listener: handleIdentifier(print, expression)
-                                    listener: handleNoTypeArguments(()
-                                    parseArgumentsOpt(print)
-                                      parseArguments(print)
-                                        parseArgumentsRest(()
-                                          listener: beginArguments(()
-                                          parseExpression(()
-                                            parsePrecedenceExpression((, 1, true, ConstantPatternContext.none)
-                                              parseUnaryExpression((, true, ConstantPatternContext.none)
-                                                parsePrimary((, expression, ConstantPatternContext.none)
-                                                  parseLiteralString(()
-                                                    parseSingleLiteralString(()
-                                                      listener: beginLiteralString("You did >>> with ')
-                                                      parseIdentifierExpression($)
-                                                        parseSend($, expression, ConstantPatternContext.none)
-                                                          isNextIdentifier($)
-                                                          ensureIdentifier($, expression)
-                                                            listener: handleIdentifier(x, expression)
-                                                          listener: handleNoTypeArguments(' on ')
-                                                          parseArgumentsOpt(x)
-                                                            listener: handleNoArguments(' on ')
-                                                          listener: handleSend(x, ' on ')
-                                                      listener: handleInterpolationExpression($, null)
-                                                      parseStringPart(x)
-                                                        listener: handleStringPart(' on ')
-                                                      parseIdentifierExpression($)
-                                                        listener: handleThisExpression(this, expression)
-                                                      listener: handleInterpolationExpression($, null)
-                                                      parseStringPart(this)
-                                                        listener: handleStringPart(' (Function)")
-                                                      listener: endLiteralString(2, ))
-                                          listener: endArguments(1, (, ))
-                                    listener: handleSend(print, ;)
-                        ensureSemicolon())
-                        listener: handleExpressionStatement(;)
-                notEofOrValue(}, })
-                listener: endBlockFunctionBody(1, {, })
-              listener: endExtensionMethod(null, operator, (, null, })
-            listener: endMember()
-          notEofOrValue(}, })
-          listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 3, {, })
-        listener: endExtensionDeclaration(extension, on, })
+                parseFunctionBody(), false, true)
+                  listener: beginBlockFunctionBody({)
+                  notEofOrValue(}, print)
+                  parseStatement({)
+                    parseStatementX({)
+                      parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, null)
+                        looksLikeLocalFunction(print)
+                        parseExpressionStatement({)
+                          parseExpression({)
+                            parsePrecedenceExpression({, 1, true, ConstantPatternContext.none)
+                              parseUnaryExpression({, true, ConstantPatternContext.none)
+                                parsePrimary({, expression, ConstantPatternContext.none)
+                                  parseSendOrFunctionLiteral({, expression, ConstantPatternContext.none)
+                                    looksLikeFunctionBody(;)
+                                    parseSend({, expression, ConstantPatternContext.none)
+                                      isNextIdentifier({)
+                                      ensureIdentifier({, expression)
+                                        listener: handleIdentifier(print, expression)
+                                      listener: handleNoTypeArguments(()
+                                      parseArgumentsOpt(print)
+                                        parseArguments(print)
+                                          parseArgumentsRest(()
+                                            listener: beginArguments(()
+                                            parseExpression(()
+                                              parsePrecedenceExpression((, 1, true, ConstantPatternContext.none)
+                                                parseUnaryExpression((, true, ConstantPatternContext.none)
+                                                  parsePrimary((, expression, ConstantPatternContext.none)
+                                                    parseLiteralString(()
+                                                      parseSingleLiteralString(()
+                                                        listener: beginLiteralString("You did >>> with ')
+                                                        parseIdentifierExpression($)
+                                                          parseSend($, expression, ConstantPatternContext.none)
+                                                            isNextIdentifier($)
+                                                            ensureIdentifier($, expression)
+                                                              listener: handleIdentifier(x, expression)
+                                                            listener: handleNoTypeArguments(' on ')
+                                                            parseArgumentsOpt(x)
+                                                              listener: handleNoArguments(' on ')
+                                                            listener: handleSend(x, ' on ')
+                                                        listener: handleInterpolationExpression($, null)
+                                                        parseStringPart(x)
+                                                          listener: handleStringPart(' on ')
+                                                        parseIdentifierExpression($)
+                                                          listener: handleThisExpression(this, expression)
+                                                        listener: handleInterpolationExpression($, null)
+                                                        parseStringPart(this)
+                                                          listener: handleStringPart(' (Function)")
+                                                        listener: endLiteralString(2, ))
+                                            listener: endArguments(1, (, ))
+                                      listener: handleSend(print, ;)
+                          ensureSemicolon())
+                          listener: handleExpressionStatement(;)
+                  notEofOrValue(}, })
+                  listener: endBlockFunctionBody(1, {, })
+                listener: endExtensionMethod(null, operator, (, null, })
+              listener: endMember()
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 3, {, })
+          listener: endExtensionDeclaration(extension, on, })
   listener: endTopLevelDeclaration(extension)
   parseTopLevelDeclarationImpl(}, Instance of 'DirectiveContext')
     parseMetadataStar(})
@@ -2247,292 +2248,293 @@
     parseTopLevelKeywordDeclaration(}, extension, null, null, null, null, Instance of 'DirectiveContext')
       parseExtension(extension)
         listener: beginExtensionDeclarationPrelude(extension)
-        listener: handleNoTypeVariables(on)
-        listener: beginExtensionDeclaration(extension, RecordExtension)
-        listener: handleIdentifier(Record, typeReference)
-        listener: handleNoTypeArguments({)
-        listener: handleType(Record, null)
-        parseClassOrMixinOrExtensionBody(Record, DeclarationKind.Extension, RecordExtension)
-          listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
-          notEofOrValue(}, operator)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, RecordExtension)
-            parseMetadataStar({)
-              listener: beginMetadataStar(operator)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            parseMethod({, null, null, null, null, null, null, null, {, Instance of 'NoType', null, operator, DeclarationKind.Extension, RecordExtension, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
-              listener: handleNoType({)
-              parseOperatorName({)
-                listener: handleOperatorName(operator, >)
-              parseMethodTypeVar(>)
-                listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(>, operator, false, MemberKind.ExtensionNonStaticMethod)
-                parseFormalParameters(>, MemberKind.ExtensionNonStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(dynamic)
-                        listener: endMetadataStar(0)
-                      listener: beginFormalParameter(dynamic, MemberKind.ExtensionNonStaticMethod, null, null, null)
-                      listener: handleIdentifier(dynamic, typeReference)
-                      listener: handleNoTypeArguments(x)
-                      listener: handleType(dynamic, null)
-                      ensureIdentifier(dynamic, formalParameterDeclaration)
-                        listener: handleIdentifier(x, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                    listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
+        parseExtensionDeclaration(extension, extension)
+          listener: handleNoTypeVariables(on)
+          listener: beginExtensionDeclaration(extension, RecordExtension)
+          listener: handleIdentifier(Record, typeReference)
+          listener: handleNoTypeArguments({)
+          listener: handleType(Record, null)
+          parseClassOrMixinOrExtensionBody(Record, DeclarationKind.Extension, RecordExtension)
+            listener: beginClassOrMixinOrExtensionBody(DeclarationKind.Extension, {)
+            notEofOrValue(}, operator)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl({, DeclarationKind.Extension, RecordExtension)
+              parseMetadataStar({)
+                listener: beginMetadataStar(operator)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              parseMethod({, null, null, null, null, null, null, null, {, Instance of 'NoType', null, operator, DeclarationKind.Extension, RecordExtension, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
+                listener: handleNoType({)
+                parseOperatorName({)
+                  listener: handleOperatorName(operator, >)
+                parseMethodTypeVar(>)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(>, operator, false, MemberKind.ExtensionNonStaticMethod)
+                  parseFormalParameters(>, MemberKind.ExtensionNonStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(dynamic)
+                          listener: endMetadataStar(0)
+                        listener: beginFormalParameter(dynamic, MemberKind.ExtensionNonStaticMethod, null, null, null)
+                        listener: handleIdentifier(dynamic, typeReference)
+                        listener: handleNoTypeArguments(x)
+                        listener: handleType(dynamic, null)
+                        ensureIdentifier(dynamic, formalParameterDeclaration)
+                          listener: handleIdentifier(x, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                      listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
                 inPlainSync()
-              inPlainSync()
-              parseFunctionBody(), false, true)
-                listener: beginBlockFunctionBody({)
-                notEofOrValue(}, print)
-                parseStatement({)
-                  parseStatementX({)
-                    parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, null)
-                      looksLikeLocalFunction(print)
-                      parseExpressionStatement({)
-                        parseExpression({)
-                          parsePrecedenceExpression({, 1, true, ConstantPatternContext.none)
-                            parseUnaryExpression({, true, ConstantPatternContext.none)
-                              parsePrimary({, expression, ConstantPatternContext.none)
-                                parseSendOrFunctionLiteral({, expression, ConstantPatternContext.none)
-                                  looksLikeFunctionBody(;)
-                                  parseSend({, expression, ConstantPatternContext.none)
-                                    isNextIdentifier({)
-                                    ensureIdentifier({, expression)
-                                      listener: handleIdentifier(print, expression)
-                                    listener: handleNoTypeArguments(()
-                                    parseArgumentsOpt(print)
-                                      parseArguments(print)
-                                        parseArgumentsRest(()
-                                          listener: beginArguments(()
-                                          parseExpression(()
-                                            parsePrecedenceExpression((, 1, true, ConstantPatternContext.none)
-                                              parseUnaryExpression((, true, ConstantPatternContext.none)
-                                                parsePrimary((, expression, ConstantPatternContext.none)
-                                                  parseLiteralString(()
-                                                    parseSingleLiteralString(()
-                                                      listener: beginLiteralString("You did > with ')
-                                                      parseIdentifierExpression($)
-                                                        parseSend($, expression, ConstantPatternContext.none)
-                                                          isNextIdentifier($)
-                                                          ensureIdentifier($, expression)
-                                                            listener: handleIdentifier(x, expression)
-                                                          listener: handleNoTypeArguments(' on ')
-                                                          parseArgumentsOpt(x)
-                                                            listener: handleNoArguments(' on ')
-                                                          listener: handleSend(x, ' on ')
-                                                      listener: handleInterpolationExpression($, null)
-                                                      parseStringPart(x)
-                                                        listener: handleStringPart(' on ')
-                                                      parseIdentifierExpression($)
-                                                        listener: handleThisExpression(this, expression)
-                                                      listener: handleInterpolationExpression($, null)
-                                                      parseStringPart(this)
-                                                        listener: handleStringPart(' (Record)")
-                                                      listener: endLiteralString(2, ))
-                                          listener: endArguments(1, (, ))
-                                    listener: handleSend(print, ;)
-                        ensureSemicolon())
-                        listener: handleExpressionStatement(;)
-                notEofOrValue(}, })
-                listener: endBlockFunctionBody(1, {, })
-              listener: endExtensionMethod(null, operator, (, null, })
-            listener: endMember()
-          notEofOrValue(}, operator)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Extension, RecordExtension)
-            parseMetadataStar(})
-              listener: beginMetadataStar(operator)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            parseMethod(}, null, null, null, null, null, null, null, }, Instance of 'NoType', null, operator, DeclarationKind.Extension, RecordExtension, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
-              listener: handleNoType(})
-              parseOperatorName(})
-                listener: handleOperatorName(operator, >>)
-              parseMethodTypeVar(>>)
-                listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(>>, operator, false, MemberKind.ExtensionNonStaticMethod)
-                parseFormalParameters(>>, MemberKind.ExtensionNonStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(dynamic)
-                        listener: endMetadataStar(0)
-                      listener: beginFormalParameter(dynamic, MemberKind.ExtensionNonStaticMethod, null, null, null)
-                      listener: handleIdentifier(dynamic, typeReference)
-                      listener: handleNoTypeArguments(x)
-                      listener: handleType(dynamic, null)
-                      ensureIdentifier(dynamic, formalParameterDeclaration)
-                        listener: handleIdentifier(x, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                    listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
+                parseFunctionBody(), false, true)
+                  listener: beginBlockFunctionBody({)
+                  notEofOrValue(}, print)
+                  parseStatement({)
+                    parseStatementX({)
+                      parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, null)
+                        looksLikeLocalFunction(print)
+                        parseExpressionStatement({)
+                          parseExpression({)
+                            parsePrecedenceExpression({, 1, true, ConstantPatternContext.none)
+                              parseUnaryExpression({, true, ConstantPatternContext.none)
+                                parsePrimary({, expression, ConstantPatternContext.none)
+                                  parseSendOrFunctionLiteral({, expression, ConstantPatternContext.none)
+                                    looksLikeFunctionBody(;)
+                                    parseSend({, expression, ConstantPatternContext.none)
+                                      isNextIdentifier({)
+                                      ensureIdentifier({, expression)
+                                        listener: handleIdentifier(print, expression)
+                                      listener: handleNoTypeArguments(()
+                                      parseArgumentsOpt(print)
+                                        parseArguments(print)
+                                          parseArgumentsRest(()
+                                            listener: beginArguments(()
+                                            parseExpression(()
+                                              parsePrecedenceExpression((, 1, true, ConstantPatternContext.none)
+                                                parseUnaryExpression((, true, ConstantPatternContext.none)
+                                                  parsePrimary((, expression, ConstantPatternContext.none)
+                                                    parseLiteralString(()
+                                                      parseSingleLiteralString(()
+                                                        listener: beginLiteralString("You did > with ')
+                                                        parseIdentifierExpression($)
+                                                          parseSend($, expression, ConstantPatternContext.none)
+                                                            isNextIdentifier($)
+                                                            ensureIdentifier($, expression)
+                                                              listener: handleIdentifier(x, expression)
+                                                            listener: handleNoTypeArguments(' on ')
+                                                            parseArgumentsOpt(x)
+                                                              listener: handleNoArguments(' on ')
+                                                            listener: handleSend(x, ' on ')
+                                                        listener: handleInterpolationExpression($, null)
+                                                        parseStringPart(x)
+                                                          listener: handleStringPart(' on ')
+                                                        parseIdentifierExpression($)
+                                                          listener: handleThisExpression(this, expression)
+                                                        listener: handleInterpolationExpression($, null)
+                                                        parseStringPart(this)
+                                                          listener: handleStringPart(' (Record)")
+                                                        listener: endLiteralString(2, ))
+                                            listener: endArguments(1, (, ))
+                                      listener: handleSend(print, ;)
+                          ensureSemicolon())
+                          listener: handleExpressionStatement(;)
+                  notEofOrValue(}, })
+                  listener: endBlockFunctionBody(1, {, })
+                listener: endExtensionMethod(null, operator, (, null, })
+              listener: endMember()
+            notEofOrValue(}, operator)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Extension, RecordExtension)
+              parseMetadataStar(})
+                listener: beginMetadataStar(operator)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              parseMethod(}, null, null, null, null, null, null, null, }, Instance of 'NoType', null, operator, DeclarationKind.Extension, RecordExtension, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
+                listener: handleNoType(})
+                parseOperatorName(})
+                  listener: handleOperatorName(operator, >>)
+                parseMethodTypeVar(>>)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(>>, operator, false, MemberKind.ExtensionNonStaticMethod)
+                  parseFormalParameters(>>, MemberKind.ExtensionNonStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(dynamic)
+                          listener: endMetadataStar(0)
+                        listener: beginFormalParameter(dynamic, MemberKind.ExtensionNonStaticMethod, null, null, null)
+                        listener: handleIdentifier(dynamic, typeReference)
+                        listener: handleNoTypeArguments(x)
+                        listener: handleType(dynamic, null)
+                        ensureIdentifier(dynamic, formalParameterDeclaration)
+                          listener: handleIdentifier(x, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                      listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
                 inPlainSync()
-              inPlainSync()
-              parseFunctionBody(), false, true)
-                listener: beginBlockFunctionBody({)
-                notEofOrValue(}, print)
-                parseStatement({)
-                  parseStatementX({)
-                    parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, null)
-                      looksLikeLocalFunction(print)
-                      parseExpressionStatement({)
-                        parseExpression({)
-                          parsePrecedenceExpression({, 1, true, ConstantPatternContext.none)
-                            parseUnaryExpression({, true, ConstantPatternContext.none)
-                              parsePrimary({, expression, ConstantPatternContext.none)
-                                parseSendOrFunctionLiteral({, expression, ConstantPatternContext.none)
-                                  looksLikeFunctionBody(;)
-                                  parseSend({, expression, ConstantPatternContext.none)
-                                    isNextIdentifier({)
-                                    ensureIdentifier({, expression)
-                                      listener: handleIdentifier(print, expression)
-                                    listener: handleNoTypeArguments(()
-                                    parseArgumentsOpt(print)
-                                      parseArguments(print)
-                                        parseArgumentsRest(()
-                                          listener: beginArguments(()
-                                          parseExpression(()
-                                            parsePrecedenceExpression((, 1, true, ConstantPatternContext.none)
-                                              parseUnaryExpression((, true, ConstantPatternContext.none)
-                                                parsePrimary((, expression, ConstantPatternContext.none)
-                                                  parseLiteralString(()
-                                                    parseSingleLiteralString(()
-                                                      listener: beginLiteralString("You did >> with ')
-                                                      parseIdentifierExpression($)
-                                                        parseSend($, expression, ConstantPatternContext.none)
-                                                          isNextIdentifier($)
-                                                          ensureIdentifier($, expression)
-                                                            listener: handleIdentifier(x, expression)
-                                                          listener: handleNoTypeArguments(' on ')
-                                                          parseArgumentsOpt(x)
-                                                            listener: handleNoArguments(' on ')
-                                                          listener: handleSend(x, ' on ')
-                                                      listener: handleInterpolationExpression($, null)
-                                                      parseStringPart(x)
-                                                        listener: handleStringPart(' on ')
-                                                      parseIdentifierExpression($)
-                                                        listener: handleThisExpression(this, expression)
-                                                      listener: handleInterpolationExpression($, null)
-                                                      parseStringPart(this)
-                                                        listener: handleStringPart(' (Record)")
-                                                      listener: endLiteralString(2, ))
-                                          listener: endArguments(1, (, ))
-                                    listener: handleSend(print, ;)
-                        ensureSemicolon())
-                        listener: handleExpressionStatement(;)
-                notEofOrValue(}, })
-                listener: endBlockFunctionBody(1, {, })
-              listener: endExtensionMethod(null, operator, (, null, })
-            listener: endMember()
-          notEofOrValue(}, operator)
-          parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Extension, RecordExtension)
-            parseMetadataStar(})
-              listener: beginMetadataStar(operator)
-              listener: endMetadataStar(0)
-            listener: beginMember()
-            parseMethod(}, null, null, null, null, null, null, null, }, Instance of 'NoType', null, operator, DeclarationKind.Extension, RecordExtension, false)
-              listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
-              listener: handleNoType(})
-              parseOperatorName(})
-                listener: handleOperatorName(operator, >>>)
-              parseMethodTypeVar(>>>)
-                listener: handleNoTypeVariables(()
-              parseGetterOrFormalParameters(>>>, operator, false, MemberKind.ExtensionNonStaticMethod)
-                parseFormalParameters(>>>, MemberKind.ExtensionNonStaticMethod)
-                  parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
-                    listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
-                    parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                      parseMetadataStar(()
-                        listener: beginMetadataStar(dynamic)
-                        listener: endMetadataStar(0)
-                      listener: beginFormalParameter(dynamic, MemberKind.ExtensionNonStaticMethod, null, null, null)
-                      listener: handleIdentifier(dynamic, typeReference)
-                      listener: handleNoTypeArguments(x)
-                      listener: handleType(dynamic, null)
-                      ensureIdentifier(dynamic, formalParameterDeclaration)
-                        listener: handleIdentifier(x, formalParameterDeclaration)
-                      listener: handleFormalParameterWithoutValue())
-                      listener: endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
-                    listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
-              parseInitializersOpt())
-                listener: handleNoInitializers()
-              parseAsyncModifierOpt())
-                listener: handleAsyncModifier(null, null)
+                parseFunctionBody(), false, true)
+                  listener: beginBlockFunctionBody({)
+                  notEofOrValue(}, print)
+                  parseStatement({)
+                    parseStatementX({)
+                      parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, null)
+                        looksLikeLocalFunction(print)
+                        parseExpressionStatement({)
+                          parseExpression({)
+                            parsePrecedenceExpression({, 1, true, ConstantPatternContext.none)
+                              parseUnaryExpression({, true, ConstantPatternContext.none)
+                                parsePrimary({, expression, ConstantPatternContext.none)
+                                  parseSendOrFunctionLiteral({, expression, ConstantPatternContext.none)
+                                    looksLikeFunctionBody(;)
+                                    parseSend({, expression, ConstantPatternContext.none)
+                                      isNextIdentifier({)
+                                      ensureIdentifier({, expression)
+                                        listener: handleIdentifier(print, expression)
+                                      listener: handleNoTypeArguments(()
+                                      parseArgumentsOpt(print)
+                                        parseArguments(print)
+                                          parseArgumentsRest(()
+                                            listener: beginArguments(()
+                                            parseExpression(()
+                                              parsePrecedenceExpression((, 1, true, ConstantPatternContext.none)
+                                                parseUnaryExpression((, true, ConstantPatternContext.none)
+                                                  parsePrimary((, expression, ConstantPatternContext.none)
+                                                    parseLiteralString(()
+                                                      parseSingleLiteralString(()
+                                                        listener: beginLiteralString("You did >> with ')
+                                                        parseIdentifierExpression($)
+                                                          parseSend($, expression, ConstantPatternContext.none)
+                                                            isNextIdentifier($)
+                                                            ensureIdentifier($, expression)
+                                                              listener: handleIdentifier(x, expression)
+                                                            listener: handleNoTypeArguments(' on ')
+                                                            parseArgumentsOpt(x)
+                                                              listener: handleNoArguments(' on ')
+                                                            listener: handleSend(x, ' on ')
+                                                        listener: handleInterpolationExpression($, null)
+                                                        parseStringPart(x)
+                                                          listener: handleStringPart(' on ')
+                                                        parseIdentifierExpression($)
+                                                          listener: handleThisExpression(this, expression)
+                                                        listener: handleInterpolationExpression($, null)
+                                                        parseStringPart(this)
+                                                          listener: handleStringPart(' (Record)")
+                                                        listener: endLiteralString(2, ))
+                                            listener: endArguments(1, (, ))
+                                      listener: handleSend(print, ;)
+                          ensureSemicolon())
+                          listener: handleExpressionStatement(;)
+                  notEofOrValue(}, })
+                  listener: endBlockFunctionBody(1, {, })
+                listener: endExtensionMethod(null, operator, (, null, })
+              listener: endMember()
+            notEofOrValue(}, operator)
+            parseClassOrMixinOrExtensionOrEnumMemberImpl(}, DeclarationKind.Extension, RecordExtension)
+              parseMetadataStar(})
+                listener: beginMetadataStar(operator)
+                listener: endMetadataStar(0)
+              listener: beginMember()
+              parseMethod(}, null, null, null, null, null, null, null, }, Instance of 'NoType', null, operator, DeclarationKind.Extension, RecordExtension, false)
+                listener: beginMethod(DeclarationKind.Extension, null, null, null, null, null, null, operator)
+                listener: handleNoType(})
+                parseOperatorName(})
+                  listener: handleOperatorName(operator, >>>)
+                parseMethodTypeVar(>>>)
+                  listener: handleNoTypeVariables(()
+                parseGetterOrFormalParameters(>>>, operator, false, MemberKind.ExtensionNonStaticMethod)
+                  parseFormalParameters(>>>, MemberKind.ExtensionNonStaticMethod)
+                    parseFormalParametersRest((, MemberKind.ExtensionNonStaticMethod)
+                      listener: beginFormalParameters((, MemberKind.ExtensionNonStaticMethod)
+                      parseFormalParameter((, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                        parseMetadataStar(()
+                          listener: beginMetadataStar(dynamic)
+                          listener: endMetadataStar(0)
+                        listener: beginFormalParameter(dynamic, MemberKind.ExtensionNonStaticMethod, null, null, null)
+                        listener: handleIdentifier(dynamic, typeReference)
+                        listener: handleNoTypeArguments(x)
+                        listener: handleType(dynamic, null)
+                        ensureIdentifier(dynamic, formalParameterDeclaration)
+                          listener: handleIdentifier(x, formalParameterDeclaration)
+                        listener: handleFormalParameterWithoutValue())
+                        listener: endFormalParameter(null, null, null, x, null, null, FormalParameterKind.requiredPositional, MemberKind.ExtensionNonStaticMethod)
+                      listener: endFormalParameters(1, (, ), MemberKind.ExtensionNonStaticMethod)
+                parseInitializersOpt())
+                  listener: handleNoInitializers()
+                parseAsyncModifierOpt())
+                  listener: handleAsyncModifier(null, null)
+                  inPlainSync()
                 inPlainSync()
-              inPlainSync()
-              parseFunctionBody(), false, true)
-                listener: beginBlockFunctionBody({)
-                notEofOrValue(}, print)
-                parseStatement({)
-                  parseStatementX({)
-                    parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, null)
-                      looksLikeLocalFunction(print)
-                      parseExpressionStatement({)
-                        parseExpression({)
-                          parsePrecedenceExpression({, 1, true, ConstantPatternContext.none)
-                            parseUnaryExpression({, true, ConstantPatternContext.none)
-                              parsePrimary({, expression, ConstantPatternContext.none)
-                                parseSendOrFunctionLiteral({, expression, ConstantPatternContext.none)
-                                  looksLikeFunctionBody(;)
-                                  parseSend({, expression, ConstantPatternContext.none)
-                                    isNextIdentifier({)
-                                    ensureIdentifier({, expression)
-                                      listener: handleIdentifier(print, expression)
-                                    listener: handleNoTypeArguments(()
-                                    parseArgumentsOpt(print)
-                                      parseArguments(print)
-                                        parseArgumentsRest(()
-                                          listener: beginArguments(()
-                                          parseExpression(()
-                                            parsePrecedenceExpression((, 1, true, ConstantPatternContext.none)
-                                              parseUnaryExpression((, true, ConstantPatternContext.none)
-                                                parsePrimary((, expression, ConstantPatternContext.none)
-                                                  parseLiteralString(()
-                                                    parseSingleLiteralString(()
-                                                      listener: beginLiteralString("You did >>> with ')
-                                                      parseIdentifierExpression($)
-                                                        parseSend($, expression, ConstantPatternContext.none)
-                                                          isNextIdentifier($)
-                                                          ensureIdentifier($, expression)
-                                                            listener: handleIdentifier(x, expression)
-                                                          listener: handleNoTypeArguments(' on ')
-                                                          parseArgumentsOpt(x)
-                                                            listener: handleNoArguments(' on ')
-                                                          listener: handleSend(x, ' on ')
-                                                      listener: handleInterpolationExpression($, null)
-                                                      parseStringPart(x)
-                                                        listener: handleStringPart(' on ')
-                                                      parseIdentifierExpression($)
-                                                        listener: handleThisExpression(this, expression)
-                                                      listener: handleInterpolationExpression($, null)
-                                                      parseStringPart(this)
-                                                        listener: handleStringPart(' (Record)")
-                                                      listener: endLiteralString(2, ))
-                                          listener: endArguments(1, (, ))
-                                    listener: handleSend(print, ;)
-                        ensureSemicolon())
-                        listener: handleExpressionStatement(;)
-                notEofOrValue(}, })
-                listener: endBlockFunctionBody(1, {, })
-              listener: endExtensionMethod(null, operator, (, null, })
-            listener: endMember()
-          notEofOrValue(}, })
-          listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 3, {, })
-        listener: endExtensionDeclaration(extension, on, })
+                parseFunctionBody(), false, true)
+                  listener: beginBlockFunctionBody({)
+                  notEofOrValue(}, print)
+                  parseStatement({)
+                    parseStatementX({)
+                      parseExpressionStatementOrDeclarationAfterModifiers({, {, null, null, null, null)
+                        looksLikeLocalFunction(print)
+                        parseExpressionStatement({)
+                          parseExpression({)
+                            parsePrecedenceExpression({, 1, true, ConstantPatternContext.none)
+                              parseUnaryExpression({, true, ConstantPatternContext.none)
+                                parsePrimary({, expression, ConstantPatternContext.none)
+                                  parseSendOrFunctionLiteral({, expression, ConstantPatternContext.none)
+                                    looksLikeFunctionBody(;)
+                                    parseSend({, expression, ConstantPatternContext.none)
+                                      isNextIdentifier({)
+                                      ensureIdentifier({, expression)
+                                        listener: handleIdentifier(print, expression)
+                                      listener: handleNoTypeArguments(()
+                                      parseArgumentsOpt(print)
+                                        parseArguments(print)
+                                          parseArgumentsRest(()
+                                            listener: beginArguments(()
+                                            parseExpression(()
+                                              parsePrecedenceExpression((, 1, true, ConstantPatternContext.none)
+                                                parseUnaryExpression((, true, ConstantPatternContext.none)
+                                                  parsePrimary((, expression, ConstantPatternContext.none)
+                                                    parseLiteralString(()
+                                                      parseSingleLiteralString(()
+                                                        listener: beginLiteralString("You did >>> with ')
+                                                        parseIdentifierExpression($)
+                                                          parseSend($, expression, ConstantPatternContext.none)
+                                                            isNextIdentifier($)
+                                                            ensureIdentifier($, expression)
+                                                              listener: handleIdentifier(x, expression)
+                                                            listener: handleNoTypeArguments(' on ')
+                                                            parseArgumentsOpt(x)
+                                                              listener: handleNoArguments(' on ')
+                                                            listener: handleSend(x, ' on ')
+                                                        listener: handleInterpolationExpression($, null)
+                                                        parseStringPart(x)
+                                                          listener: handleStringPart(' on ')
+                                                        parseIdentifierExpression($)
+                                                          listener: handleThisExpression(this, expression)
+                                                        listener: handleInterpolationExpression($, null)
+                                                        parseStringPart(this)
+                                                          listener: handleStringPart(' (Record)")
+                                                        listener: endLiteralString(2, ))
+                                            listener: endArguments(1, (, ))
+                                      listener: handleSend(print, ;)
+                          ensureSemicolon())
+                          listener: handleExpressionStatement(;)
+                  notEofOrValue(}, })
+                  listener: endBlockFunctionBody(1, {, })
+                listener: endExtensionMethod(null, operator, (, null, })
+              listener: endMember()
+            notEofOrValue(}, })
+            listener: endClassOrMixinOrExtensionBody(DeclarationKind.Extension, 3, {, })
+          listener: endExtensionDeclaration(extension, on, })
   listener: endTopLevelDeclaration()
   reportAllErrorTokens(void)
   listener: endCompilationUnit(3, )
diff --git a/pkg/front_end/test/parser_test_listener.dart b/pkg/front_end/test/parser_test_listener.dart
index 28a7557..9fe04a8 100644
--- a/pkg/front_end/test/parser_test_listener.dart
+++ b/pkg/front_end/test/parser_test_listener.dart
@@ -394,6 +394,13 @@
   }
 
   @override
+  void handleNoPrimaryConstructor(Token token, Token? constKeyword) {
+    seen(token);
+    seen(constKeyword);
+    doPrint('handleNoPrimaryConstructor(' '$token, ' '$constKeyword)');
+  }
+
+  @override
   void beginCombinators(Token token) {
     seen(token);
     doPrint('beginCombinators(' '$token)');
diff --git a/pkg/front_end/test/parser_test_parser.dart b/pkg/front_end/test/parser_test_parser.dart
index 39632fb..96171ea 100644
--- a/pkg/front_end/test/parser_test_parser.dart
+++ b/pkg/front_end/test/parser_test_parser.dart
@@ -817,17 +817,24 @@
   }
 
   @override
-  Token parseExtensionTypeDeclarationRest(Token token, Token extensionKeyword,
-      Token typeKeyword, Token? constKeyword, Token name) {
-    doPrint('parseExtensionTypeDeclarationRest('
+  Token parseExtensionDeclaration(Token token, Token extensionKeyword) {
+    doPrint('parseExtensionDeclaration(' '$token, ' '$extensionKeyword)');
+    indent++;
+    var result = super.parseExtensionDeclaration(token, extensionKeyword);
+    indent--;
+    return result;
+  }
+
+  @override
+  Token parseExtensionTypeDeclaration(
+      Token token, Token extensionKeyword, Token typeKeyword) {
+    doPrint('parseExtensionTypeDeclaration('
         '$token, '
         '$extensionKeyword, '
-        '$typeKeyword, '
-        '$constKeyword, '
-        '$name)');
+        '$typeKeyword)');
     indent++;
-    var result = super.parseExtensionTypeDeclarationRest(
-        token, extensionKeyword, typeKeyword, constKeyword, name);
+    var result = super
+        .parseExtensionTypeDeclaration(token, extensionKeyword, typeKeyword);
     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 f7cffb1..56aa526 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
@@ -2,7 +2,34 @@
 //
 // Problems in library:
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Unexpected token 'on'.
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:16: Error: An extension type declaration must have a primary constructor declaration.
+// Try adding a primary constructor to the extension type declaration.
+// 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.
+// 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'.
 //                  ^^
 //
@@ -14,6 +41,6 @@
     : super core::Object::•()
     ;
 }
-extension E on self::A {
+extension type E(invalid-type #) {
 }
 static method main() → dynamic {}
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 f7cffb1..56aa526 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
@@ -2,7 +2,34 @@
 //
 // Problems in library:
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Unexpected token 'on'.
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:16: Error: An extension type declaration must have a primary constructor declaration.
+// Try adding a primary constructor to the extension type declaration.
+// 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.
+// 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'.
 //                  ^^
 //
@@ -14,6 +41,6 @@
     : super core::Object::•()
     ;
 }
-extension E on self::A {
+extension type E(invalid-type #) {
 }
 static method main() → dynamic {}
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 a4c015d..39a45ab 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,3 +1,4 @@
 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 f7cffb1..56aa526 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
@@ -2,7 +2,34 @@
 //
 // Problems in library:
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Unexpected token 'on'.
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:16: Error: An extension type declaration must have a primary constructor declaration.
+// Try adding a primary constructor to the extension type declaration.
+// 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.
+// 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'.
 //                  ^^
 //
@@ -14,6 +41,6 @@
     : super core::Object::•()
     ;
 }
-extension E on self::A {
+extension type E(invalid-type #) {
 }
 static method main() → dynamic {}
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 f7cffb1..56aa526 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
@@ -2,7 +2,34 @@
 //
 // Problems in library:
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Unexpected token 'on'.
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:16: Error: An extension type declaration must have a primary constructor declaration.
+// Try adding a primary constructor to the extension type declaration.
+// 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.
+// 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'.
 //                  ^^
 //
@@ -14,6 +41,6 @@
     : super core::Object::•()
     ;
 }
-extension E on self::A {
+extension type E(invalid-type #) {
 }
 static method main() → dynamic {}
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 156688c..247413d 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
@@ -2,7 +2,34 @@
 //
 // Problems in library:
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Unexpected token 'on'.
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:16: Error: An extension type declaration must have a primary constructor declaration.
+// Try adding a primary constructor to the extension type declaration.
+// 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.
+// 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'.
 //                  ^^
 //
@@ -13,7 +40,7 @@
   synthetic constructor •() → self::A
     ;
 }
-extension E on self::A {
+extension type E(invalid-type #) {
 }
 static method main() → dynamic
   ;
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 f7cffb1..56aa526 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
@@ -2,7 +2,34 @@
 //
 // Problems in library:
 //
-// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:18: Error: Unexpected token 'on'.
+// pkg/front_end/testcases/general/extension_types_feature_not_enabled.dart:9:16: Error: An extension type declaration must have a primary constructor declaration.
+// Try adding a primary constructor to the extension type declaration.
+// 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.
+// 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'.
 //                  ^^
 //
@@ -14,6 +41,6 @@
     : super core::Object::•()
     ;
 }
-extension E on self::A {
+extension type E(invalid-type #) {
 }
 static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart
new file mode 100644
index 0000000..f877195
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart
@@ -0,0 +1,9 @@
+// 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.
+
+extension type ET {}
+
+test() {
+  print(ET);
+}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.strong.expect b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.strong.expect
new file mode 100644
index 0000000..ca3e604
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.strong.expect
@@ -0,0 +1,21 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart:5:16: Error: An extension type declaration must have a primary constructor declaration.
+// Try adding a primary constructor to the extension type declaration.
+// extension type ET {}
+//                ^^
+//
+import self as self;
+import "dart:core" as core;
+
+extension type ET(invalid-type #) {
+}
+static method test() → dynamic {
+  core::print(#C1);
+}
+
+constants  {
+  #C1 = TypeLiteralConstant(self::ET /* = invalid-type */)
+}
diff --git a/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.strong.transformed.expect b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.strong.transformed.expect
new file mode 100644
index 0000000..ca3e604
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.strong.transformed.expect
@@ -0,0 +1,21 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart:5:16: Error: An extension type declaration must have a primary constructor declaration.
+// Try adding a primary constructor to the extension type declaration.
+// extension type ET {}
+//                ^^
+//
+import self as self;
+import "dart:core" as core;
+
+extension type ET(invalid-type #) {
+}
+static method test() → dynamic {
+  core::print(#C1);
+}
+
+constants  {
+  #C1 = TypeLiteralConstant(self::ET /* = invalid-type */)
+}
diff --git a/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.textual_outline.expect b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.textual_outline.expect
new file mode 100644
index 0000000..45e5d55
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.textual_outline.expect
@@ -0,0 +1,2 @@
+extension type ET {}
+test() {}
diff --git a/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..541aaff
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.textual_outline_modelled.expect
@@ -0,0 +1,4 @@
+---- unknown chunk starts ----
+extension type ET {}
+---- unknown chunk ends ----
+test() {}
diff --git a/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.weak.expect b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.weak.expect
new file mode 100644
index 0000000..62112df
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.weak.expect
@@ -0,0 +1,21 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart:5:16: Error: An extension type declaration must have a primary constructor declaration.
+// Try adding a primary constructor to the extension type declaration.
+// extension type ET {}
+//                ^^
+//
+import self as self;
+import "dart:core" as core;
+
+extension type ET(invalid-type #) {
+}
+static method test() → dynamic {
+  core::print(#C1);
+}
+
+constants  {
+  #C1 = TypeLiteralConstant(self::ET* /* = invalid-type */)
+}
diff --git a/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.weak.modular.expect b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.weak.modular.expect
new file mode 100644
index 0000000..62112df
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.weak.modular.expect
@@ -0,0 +1,21 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart:5:16: Error: An extension type declaration must have a primary constructor declaration.
+// Try adding a primary constructor to the extension type declaration.
+// extension type ET {}
+//                ^^
+//
+import self as self;
+import "dart:core" as core;
+
+extension type ET(invalid-type #) {
+}
+static method test() → dynamic {
+  core::print(#C1);
+}
+
+constants  {
+  #C1 = TypeLiteralConstant(self::ET* /* = invalid-type */)
+}
diff --git a/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.weak.outline.expect b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.weak.outline.expect
new file mode 100644
index 0000000..306ab31
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.weak.outline.expect
@@ -0,0 +1,15 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart:5:16: Error: An extension type declaration must have a primary constructor declaration.
+// Try adding a primary constructor to the extension type declaration.
+// extension type ET {}
+//                ^^
+//
+import self as self;
+
+extension type ET(invalid-type #) {
+}
+static method test() → dynamic
+  ;
diff --git a/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.weak.transformed.expect b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.weak.transformed.expect
new file mode 100644
index 0000000..62112df
--- /dev/null
+++ b/pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart.weak.transformed.expect
@@ -0,0 +1,21 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/inline_class/extension_types/missing_primary_constructor.dart:5:16: Error: An extension type declaration must have a primary constructor declaration.
+// Try adding a primary constructor to the extension type declaration.
+// extension type ET {}
+//                ^^
+//
+import self as self;
+import "dart:core" as core;
+
+extension type ET(invalid-type #) {
+}
+static method test() → dynamic {
+  core::print(#C1);
+}
+
+constants  {
+  #C1 = TypeLiteralConstant(self::ET* /* = invalid-type */)
+}