Version 3.9.0-218.0.dev

Merge 5f877fb7c818895fa9b92156d72e7a64dc0898aa into dev
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 37db8d0..b3136a4 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -474,8 +474,11 @@
     try {
       var content = file.readAsStringSync();
       var diagnosticListener = RecordingDiagnosticListener();
-      var errorReporter = ErrorReporter(diagnosticListener, FileSource(file));
-      var parser = TransformSetParser(errorReporter, packageName);
+      var diagnosticReporter = DiagnosticReporter(
+        diagnosticListener,
+        FileSource(file),
+      );
+      var parser = TransformSetParser(diagnosticReporter, packageName);
       parser.parse(content);
       var converter = AnalyzerConverter();
       var analysisOptions = driver.getAnalysisOptionsForFile(file);
diff --git a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
index 0920a81..e729db6 100644
--- a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
@@ -275,7 +275,7 @@
           var contextUnits = <RuleContextUnit>[];
 
           for (var parsedUnit in parsedLibrary.units) {
-            var errorReporter = ErrorReporter(
+            var diagnosticReporter = DiagnosticReporter(
               diagnosticListener,
               StringSource(parsedUnit.content, null),
             );
@@ -283,7 +283,7 @@
               RuleContextUnit(
                 file: parsedUnit.file,
                 content: parsedUnit.content,
-                errorReporter: errorReporter,
+                diagnosticReporter: diagnosticReporter,
                 unit: parsedUnit.unit,
               ),
             );
@@ -542,7 +542,7 @@
             .map((name) => Registry.ruleRegistry.getRule(name))
             .nonNulls;
     for (var lintRule in lintRules) {
-      lintRule.reporter = currentUnit.errorReporter;
+      lintRule.reporter = currentUnit.diagnosticReporter;
       lintRule.registerNodeProcessors(nodeRegistry, context);
     }
 
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart
index 841a4a5..85e9b43 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/code_fragment_parser.dart
@@ -14,8 +14,8 @@
 
 /// A parser for the textual representation of a code fragment.
 class CodeFragmentParser {
-  /// The error reporter to which diagnostics will be reported.
-  final ErrorReporter errorReporter;
+  /// The diagnostic reporter to which diagnostics will be reported.
+  final DiagnosticReporter diagnosticReporter;
 
   /// The scope in which variables can be looked up.
   VariableScope variableScope;
@@ -30,8 +30,8 @@
   /// The index in the [_tokens] of the next token to be consumed.
   int currentIndex = 0;
 
-  /// Initialize a newly created parser to report errors to the [errorReporter].
-  CodeFragmentParser(this.errorReporter, {VariableScope? scope})
+  /// Initialize a newly created parser to report errors to the [diagnosticReporter].
+  CodeFragmentParser(this.diagnosticReporter, {VariableScope? scope})
     : variableScope = scope ?? VariableScope(null, {});
 
   /// Return the current token, or `null` if the end of the tokens has been
@@ -54,7 +54,7 @@
   List<Accessor>? parseAccessors(String content, int delta) {
     this.delta = delta;
     var scannedTokens =
-        _CodeFragmentScanner(content, delta, errorReporter).scan();
+        _CodeFragmentScanner(content, delta, diagnosticReporter).scan();
     if (scannedTokens == null) {
       // The error has already been reported.
       return null;
@@ -80,7 +80,7 @@
         }
         accessors.add(accessor);
       } else {
-        errorReporter.atOffset(
+        diagnosticReporter.atOffset(
           offset: token.offset + delta,
           length: token.length,
           diagnosticCode: TransformSetErrorCode.wrongToken,
@@ -100,7 +100,7 @@
   Expression? parseCondition(String content, int delta) {
     this.delta = delta;
     var scannedTokens =
-        _CodeFragmentScanner(content, delta, errorReporter).scan();
+        _CodeFragmentScanner(content, delta, diagnosticReporter).scan();
     if (scannedTokens == null) {
       // The error has already been reported.
       return null;
@@ -110,7 +110,7 @@
     var expression = _parseLogicalAndExpression();
     if (currentIndex < _tokens.length) {
       var token = _tokens[currentIndex];
-      errorReporter.atOffset(
+      diagnosticReporter.atOffset(
         offset: token.offset + delta,
         length: token.length,
         diagnosticCode: TransformSetErrorCode.unexpectedToken,
@@ -148,7 +148,7 @@
         offset = last.offset;
         length = last.length;
       }
-      errorReporter.atOffset(
+      diagnosticReporter.atOffset(
         offset: offset + delta,
         length: length,
         diagnosticCode: TransformSetErrorCode.missingToken,
@@ -157,7 +157,7 @@
       return null;
     }
     if (!validKinds.contains(token.kind)) {
-      errorReporter.atOffset(
+      diagnosticReporter.atOffset(
         offset: token.offset + delta,
         length: token.length,
         diagnosticCode: TransformSetErrorCode.wrongToken,
@@ -230,7 +230,7 @@
       advance();
       return TypeArgumentAccessor(argumentIndex);
     } else {
-      errorReporter.atOffset(
+      diagnosticReporter.atOffset(
         offset: token.offset + delta,
         length: token.length,
         diagnosticCode: TransformSetErrorCode.unknownAccessor,
@@ -310,7 +310,7 @@
         var variableName = token.lexeme;
         var generator = variableScope.lookup(variableName);
         if (generator == null) {
-          errorReporter.atOffset(
+          diagnosticReporter.atOffset(
             offset: token.offset + delta,
             length: token.length,
             diagnosticCode: TransformSetErrorCode.undefinedVariable,
@@ -341,7 +341,7 @@
       offset = token.offset + delta;
       length = token.length;
     }
-    errorReporter.atOffset(
+    diagnosticReporter.atOffset(
       offset: offset,
       length: length,
       diagnosticCode: TransformSetErrorCode.expectedPrimary,
@@ -372,11 +372,11 @@
   /// The offset in the file of the first character in the string being scanned.
   final int delta;
 
-  /// The error reporter to which diagnostics will be reported.
-  final ErrorReporter errorReporter;
+  /// The diagnostic reporter to which diagnostics will be reported.
+  final DiagnosticReporter _diagnosticReporter;
 
   /// Initialize a newly created scanner to scan the given [content].
-  _CodeFragmentScanner(this.content, this.delta, this.errorReporter)
+  _CodeFragmentScanner(this.content, this.delta, this._diagnosticReporter)
     : length = content.length;
 
   /// Return the tokens in the content, or `null` if there is an error in the
@@ -468,7 +468,7 @@
 
   /// Report the presence of an invalid character at the given [offset].
   Null _reportInvalidCharacter(int offset) {
-    errorReporter.atOffset(
+    _diagnosticReporter.atOffset(
       offset: offset + delta,
       length: 1,
       diagnosticCode: TransformSetErrorCode.invalidCharacter,
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart
index 5a34def..d12f708 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_manager.dart
@@ -115,7 +115,7 @@
     try {
       var content = file.readAsStringSync();
       var parser = TransformSetParser(
-        ErrorReporter(DiagnosticListener.NULL_LISTENER, FileSource(file)),
+        DiagnosticReporter(DiagnosticListener.NULL_LISTENER, FileSource(file)),
         packageName,
       );
       return parser.parse(content);
diff --git a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart
index c398cc4..386b5d7 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix/data_driven/transform_set_parser.dart
@@ -138,8 +138,8 @@
   /// includes removing support for keys and adding a new required key.
   static const int currentVersion = 1;
 
-  /// The error reporter to which diagnostics will be reported.
-  final ErrorReporter errorReporter;
+  /// The diagnostic reporter to which diagnostics will be reported.
+  final DiagnosticReporter _diagnosticReporter;
 
   /// The name of the package from which the data file being translated was
   /// found, or `null` for the SDK.
@@ -159,8 +159,8 @@
   List<ParameterModification>? _parameterModifications;
 
   /// Initialize a newly created parser to report diagnostics to the
-  /// [errorReporter].
-  TransformSetParser(this.errorReporter, this.packageName);
+  /// [_diagnosticReporter].
+  TransformSetParser(this._diagnosticReporter, this.packageName);
 
   /// Return the result of parsing the file [content] into a transform set, or
   /// `null` if the content does not represent a valid transform set.
@@ -192,7 +192,7 @@
       }
       var endIndex = template.indexOf(_closeComponent, variableStart + 2);
       if (endIndex < 0) {
-        errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: templateOffset + variableStart,
           length: 2,
           diagnosticCode: TransformSetErrorCode.missingTemplateEnd,
@@ -204,7 +204,7 @@
         var name = template.substring(variableStart + 2, endIndex).trim();
         var generator = variableScope.lookup(name);
         if (generator == null) {
-          errorReporter.atOffset(
+          _diagnosticReporter.atOffset(
             offset: templateOffset + template.indexOf(name, variableStart),
             length: name.length,
             diagnosticCode: TransformSetErrorCode.undefinedVariable,
@@ -258,7 +258,7 @@
       var span = e.span;
       var offset = span?.start.offset ?? 0;
       var length = span?.length ?? 0;
-      errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: offset,
         length: length,
         diagnosticCode: TransformSetErrorCode.yamlSyntaxError,
@@ -277,7 +277,7 @@
     List<String> arguments = const [],
   ]) {
     var span = node.span;
-    errorReporter.atOffset(
+    _diagnosticReporter.atOffset(
       offset: span.start.offset,
       length: span.length,
       diagnosticCode: code,
@@ -670,7 +670,7 @@
       return null;
     }
     var accessors = CodeFragmentParser(
-      errorReporter,
+      _diagnosticReporter,
     ).parseAccessors(value, _offsetOfString(valueNode));
     if (accessors == null) {
       // The error has already been reported.
@@ -718,7 +718,7 @@
         );
         if (requiredIfNode is YamlScalar && requiredIfText != null) {
           requiredIfCondition = CodeFragmentParser(
-            errorReporter,
+            _diagnosticReporter,
             scope: variableScope,
           ).parseCondition(requiredIfText, _offsetOfString(requiredIfNode));
           if (requiredIfCondition == null) {
@@ -780,7 +780,7 @@
           expressionText != null &&
           changes != null) {
         var expression = CodeFragmentParser(
-          errorReporter,
+          _diagnosticReporter,
           scope: transformVariableScope,
         ).parseCondition(expressionText, _offsetOfString(expressionNode));
         if (expression != null) {
diff --git a/pkg/analysis_server/test/services/linter/linter_test.dart b/pkg/analysis_server/test/services/linter/linter_test.dart
index 8078e31..cac5aab 100644
--- a/pkg/analysis_server/test/services/linter/linter_test.dart
+++ b/pkg/analysis_server/test/services/linter/linter_test.dart
@@ -23,7 +23,7 @@
 class LinterRuleOptionsValidatorTest {
   late RecordingDiagnosticListener recorder;
 
-  late ErrorReporter reporter;
+  late DiagnosticReporter reporter;
 
   List<Diagnostic> get diagnostics => recorder.diagnostics;
 
@@ -32,7 +32,7 @@
   void setUp() {
     registerLintRules();
     recorder = RecordingDiagnosticListener();
-    reporter = ErrorReporter(recorder, _TestSource());
+    reporter = DiagnosticReporter(recorder, _TestSource());
   }
 
   void test_linter_defined_rules() {
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/code_fragment_parser_test.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/code_fragment_parser_test.dart
index 2b450a4..d31b542 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/code_fragment_parser_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/code_fragment_parser_test.dart
@@ -77,7 +77,7 @@
     GatheringDiagnosticListener listener, {
     List<String>? variables,
   }) {
-    var errorReporter = ErrorReporter(listener, MockSource());
+    var diagnosticReporter = DiagnosticReporter(listener, MockSource());
     var map = <String, ValueGenerator>{};
     if (variables != null) {
       for (var variableName in variables) {
@@ -85,7 +85,7 @@
       }
     }
     var scope = VariableScope(null, map);
-    return CodeFragmentParser(errorReporter, scope: scope);
+    return CodeFragmentParser(diagnosticReporter, scope: scope);
   }
 }
 
diff --git a/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_parser_test_support.dart b/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_parser_test_support.dart
index edefa5c..4606d3c 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_parser_test_support.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/data_driven/transform_set_parser_test_support.dart
@@ -47,11 +47,11 @@
   );
 
   void parse(String content) {
-    var errorReporter = ErrorReporter(
+    var diagnosticReporter = DiagnosticReporter(
       diagnosticListener,
       MockSource(fullName: 'data.yaml'),
     );
-    var parser = TransformSetParser(errorReporter, 'myPackage');
+    var parser = TransformSetParser(diagnosticReporter, 'myPackage');
     result = parser.parse(content);
   }
 }
diff --git a/pkg/analysis_server_plugin/lib/src/plugin_server.dart b/pkg/analysis_server_plugin/lib/src/plugin_server.dart
index 54a84c8..146577d 100644
--- a/pkg/analysis_server_plugin/lib/src/plugin_server.dart
+++ b/pkg/analysis_server_plugin/lib/src/plugin_server.dart
@@ -319,13 +319,13 @@
       return const [];
     }
     var listener = RecordingDiagnosticListener();
-    var errorReporter = ErrorReporter(
+    var diagnosticReporter = DiagnosticReporter(
         listener, unitResult.libraryElement2.firstFragment.source);
 
     var currentUnit = RuleContextUnit(
       file: unitResult.file,
       content: unitResult.content,
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
       unit: unitResult.unit,
     );
     var allUnits = [
@@ -333,7 +333,7 @@
         RuleContextUnit(
           file: unitResult.file,
           content: unitResult.content,
-          errorReporter: errorReporter,
+          diagnosticReporter: diagnosticReporter,
           unit: unitResult.unit,
         ),
     ];
@@ -360,7 +360,7 @@
       var rules =
           Registry.ruleRegistry.enabled(configuration.diagnosticConfigs);
       for (var rule in rules) {
-        rule.reporter = errorReporter;
+        rule.reporter = diagnosticReporter;
         // TODO(srawlins): Enable timing similar to what the linter package's
         // `benchhmark.dart` script does.
         rule.registerNodeProcessors(nodeRegistry, context);
diff --git a/pkg/analyzer/api.txt b/pkg/analyzer/api.txt
index 1bd011a..b02f0fa 100644
--- a/pkg/analyzer/api.txt
+++ b/pkg/analyzer/api.txt
@@ -6,7 +6,7 @@
     incompatibleRules (getter: List<String>)
     name (getter: String)
     pubspecVisitor (getter: PubspecVisitor<dynamic>?)
-    reporter= (setter: ErrorReporter)
+    reporter= (setter: DiagnosticReporter)
     state (getter: RuleState)
     registerNodeProcessors (method: void Function(RuleVisitorRegistry, RuleContext))
   AnalysisRule (class extends AbstractAnalysisRule):
@@ -93,9 +93,9 @@
     typeSystem (getter: TypeSystem)
     isFeatureEnabled (method: bool Function(Feature))
   RuleContextUnit (class extends Object):
-    new (constructor: RuleContextUnit Function({required String content, required ErrorReporter errorReporter, required File file, required CompilationUnit unit}))
+    new (constructor: RuleContextUnit Function({required String content, required DiagnosticReporter diagnosticReporter, required File file, required CompilationUnit unit}))
     content (getter: String)
-    errorReporter (getter: ErrorReporter)
+    diagnosticReporter (getter: DiagnosticReporter)
     file (getter: File)
     unit (getter: CompilationUnit)
 package:analyzer/analysis_rule/rule_state.dart:
@@ -4754,8 +4754,8 @@
     NULL_LISTENER (static getter: DiagnosticListener)
     new (constructor: DiagnosticListener Function())
     onError (method: void Function(Diagnostic))
-  ErrorReporter (class extends Object):
-    new (constructor: ErrorReporter Function(DiagnosticListener, Source))
+  DiagnosticReporter (class extends Object):
+    new (constructor: DiagnosticReporter Function(DiagnosticListener, Source))
     lockLevel (getter: int)
     lockLevel= (setter: int)
     source (getter: Source)
@@ -4775,6 +4775,7 @@
     onError (method: void Function(Diagnostic))
   AnalysisErrorListener (type alias for DiagnosticListener, deprecated)
   BooleanErrorListener (type alias for BooleanDiagnosticListener, deprecated)
+  ErrorReporter (type alias for DiagnosticReporter, deprecated)
   RecorderingErrorListener (type alias for RecordingDiagnosticListener, deprecated)
 package:analyzer/exception/exception.dart:
   AnalysisException (class extends Object implements Exception):
diff --git a/pkg/analyzer/lib/analysis_rule/analysis_rule.dart b/pkg/analyzer/lib/analysis_rule/analysis_rule.dart
index e7e6e83..79d9972 100644
--- a/pkg/analyzer/lib/analysis_rule/analysis_rule.dart
+++ b/pkg/analyzer/lib/analysis_rule/analysis_rule.dart
@@ -20,7 +20,7 @@
   ///
   /// NOTE: this is set by the framework before any node processors start
   /// visiting nodes.
-  late ErrorReporter _reporter;
+  late DiagnosticReporter _reporter;
 
   /// Short description suitable for display in console output and IDEs.
   ///
@@ -63,9 +63,9 @@
   /// [reporter].
   PubspecVisitor? get pubspecVisitor => null;
 
-  /// Sets the [ErrorReporter] for the [CompilationUnit] currently being
+  /// Sets the [DiagnosticReporter] for the [CompilationUnit] currently being
   /// visited.
-  set reporter(ErrorReporter value) => _reporter = value;
+  set reporter(DiagnosticReporter value) => _reporter = value;
 
   /// Registers node processors in the given [registry].
   ///
diff --git a/pkg/analyzer/lib/analysis_rule/rule_context.dart b/pkg/analyzer/lib/analysis_rule/rule_context.dart
index edd940b..1f1a8f7 100644
--- a/pkg/analyzer/lib/analysis_rule/rule_context.dart
+++ b/pkg/analyzer/lib/analysis_rule/rule_context.dart
@@ -56,13 +56,13 @@
 class RuleContextUnit {
   final File file;
   final String content;
-  final ErrorReporter errorReporter;
+  final DiagnosticReporter diagnosticReporter;
   final CompilationUnit unit;
 
   RuleContextUnit({
     required this.file,
     required this.content,
-    required this.errorReporter,
+    required this.diagnosticReporter,
     required this.unit,
   });
 }
diff --git a/pkg/analyzer/lib/error/listener.dart b/pkg/analyzer/lib/error/listener.dart
index 66a7917..c22a9bf 100644
--- a/pkg/analyzer/lib/error/listener.dart
+++ b/pkg/analyzer/lib/error/listener.dart
@@ -22,6 +22,9 @@
 @Deprecated("Use 'BooleanDiagnosticListener' instead")
 typedef BooleanErrorListener = BooleanDiagnosticListener;
 
+@Deprecated("Use 'DiagnosticReporter' instead")
+typedef ErrorReporter = DiagnosticReporter;
+
 @Deprecated("Use 'RecordingDiagnosticListener' instead")
 typedef RecorderingErrorListener = RecordingDiagnosticListener;
 
@@ -54,8 +57,7 @@
 
 /// An object used to create diagnostics and report them to a diagnostic
 /// listener.
-// TODO(srawlins): Rename to 'DiagnosticReporter'.
-class ErrorReporter {
+class DiagnosticReporter {
   /// The diagnostic listener to which diagnostics are reported.
   final DiagnosticListener _diagnosticListener;
 
@@ -73,7 +75,7 @@
   ///
   /// Diagnostics are reported against the [_source] unless another source is
   /// provided later.
-  ErrorReporter(this._diagnosticListener, this._source);
+  DiagnosticReporter(this._diagnosticListener, this._source);
 
   Source get source => _source;
 
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_analysis.dart b/pkg/analyzer/lib/src/dart/analysis/file_analysis.dart
index cdad71b..69793e3 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_analysis.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_analysis.dart
@@ -13,7 +13,7 @@
 class FileAnalysis {
   final FileState file;
   final RecordingDiagnosticListener diagnosticListener;
-  final ErrorReporter errorReporter;
+  final DiagnosticReporter diagnosticReporter;
   final CompilationUnitImpl unit;
   final LibraryFragmentImpl element;
   final IgnoreInfo ignoreInfo;
@@ -24,7 +24,7 @@
     required this.diagnosticListener,
     required this.unit,
     required this.element,
-  }) : errorReporter = ErrorReporter(diagnosticListener, file.source),
+  }) : diagnosticReporter = DiagnosticReporter(diagnosticListener, file.source),
        ignoreInfo = IgnoreInfo.forDart(unit, file.content),
        importsTracking = element.scope.importsTrackingInit();
 }
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index d6b8167..26c06a2 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -184,7 +184,7 @@
       // TODO(scheglov): We don't need to do this for the whole unit.
       parsedUnit.accept(
         ScopeResolverVisitor(
-          fileAnalysis.errorReporter,
+          fileAnalysis.diagnosticReporter,
           nameScope: unitElement.scope,
         ),
       );
@@ -280,7 +280,7 @@
               shouldReport = true;
             }
             if (shouldReport) {
-              libraryUnitAnalysis.errorReporter.atNode(
+              libraryUnitAnalysis.diagnosticReporter.atNode(
                 directive.uri,
                 CompileTimeErrorCode.INCONSISTENT_LANGUAGE_VERSION_OVERRIDE,
               );
@@ -293,7 +293,7 @@
 
   void _computeConstantErrors(FileAnalysis fileAnalysis) {
     ConstantVerifier constantVerifier = ConstantVerifier(
-      fileAnalysis.errorReporter,
+      fileAnalysis.diagnosticReporter,
       _libraryElement,
       _declaredVariables,
       retainDataForTesting: _testingData != null,
@@ -370,7 +370,7 @@
     // Only validate non-generated files.
     .whereNot((f) => f.file.source.isGenerated)) {
       IgnoreValidator(
-        fileAnalysis.errorReporter,
+        fileAnalysis.diagnosticReporter,
         fileAnalysis.diagnosticListener.diagnostics,
         fileAnalysis.ignoreInfo,
         fileAnalysis.unit.lineInfo,
@@ -390,7 +390,7 @@
         file: fileAnalysis.file.resource,
         content: fileAnalysis.file.content,
         unit: fileAnalysis.unit,
-        errorReporter: fileAnalysis.errorReporter,
+        diagnosticReporter: fileAnalysis.diagnosticReporter,
       );
       analysesToContextUnits[fileAnalysis] = linterContextUnit;
       if (fileAnalysis.unit.declaredFragment == definingUnit) {
@@ -428,10 +428,10 @@
       if (!fileAnalysis.file.exists) continue;
 
       var unit = currentUnit.unit;
-      var errorReporter = currentUnit.errorReporter;
+      var diagnosticReporter = currentUnit.diagnosticReporter;
 
-      for (var linter in _analysisOptions.lintRules) {
-        linter.reporter = errorReporter;
+      for (var rule in _analysisOptions.lintRules) {
+        rule.reporter = diagnosticReporter;
       }
 
       // Run lint rules that handle specific node types.
@@ -453,28 +453,21 @@
   }
 
   void _computeVerifyErrors(FileAnalysis fileAnalysis) {
-    var errorReporter = fileAnalysis.errorReporter;
+    var diagnosticReporter = fileAnalysis.diagnosticReporter;
     var unit = fileAnalysis.unit;
 
-    //
-    // Use the ConstantVerifier to compute errors.
-    //
     _computeConstantErrors(fileAnalysis);
 
-    //
     // Compute inheritance and override errors.
-    //
     InheritanceOverrideVerifier(
       _typeSystem,
       _inheritance,
-      errorReporter,
+      diagnosticReporter,
     ).verifyUnit(unit);
 
-    //
     // Use the ErrorVerifier to compute errors.
-    //
     ErrorVerifier errorVerifier = ErrorVerifier(
-      errorReporter,
+      diagnosticReporter,
       _libraryElement,
       unit.declaredFragment!,
       _typeProvider,
@@ -490,7 +483,7 @@
     unit.accept(
       FfiVerifier(
         _typeSystem,
-        errorReporter,
+        diagnosticReporter,
         strictCasts: _analysisOptions.strictCasts,
       ),
     );
@@ -500,16 +493,18 @@
     FileAnalysis fileAnalysis, {
     required UsedLocalElements usedElements,
   }) {
-    var errorReporter = fileAnalysis.errorReporter;
+    var diagnosticReporter = fileAnalysis.diagnosticReporter;
     var unit = fileAnalysis.unit;
 
-    UnicodeTextVerifier(errorReporter).verify(unit, fileAnalysis.file.content);
+    UnicodeTextVerifier(
+      diagnosticReporter,
+    ).verify(unit, fileAnalysis.file.content);
 
-    unit.accept(DeadCodeVerifier(errorReporter, _libraryElement));
+    unit.accept(DeadCodeVerifier(diagnosticReporter, _libraryElement));
 
     unit.accept(
       BestPracticesVerifier(
-        errorReporter,
+        diagnosticReporter,
         _typeProvider,
         _libraryElement,
         unit,
@@ -519,23 +514,23 @@
       ),
     );
 
-    unit.accept(OverrideVerifier(errorReporter));
+    unit.accept(OverrideVerifier(diagnosticReporter));
 
-    unit.accept(RedeclareVerifier(errorReporter));
+    unit.accept(RedeclareVerifier(diagnosticReporter));
 
-    TodoFinder(errorReporter).findIn(unit);
-    LanguageVersionOverrideVerifier(errorReporter).verify(unit);
+    TodoFinder(diagnosticReporter).findIn(unit);
+    LanguageVersionOverrideVerifier(diagnosticReporter).verify(unit);
 
     // Verify imports.
     if (!_hasDiagnosticReportedThatPreventsImportWarnings()) {
       var verifier = ImportsVerifier(fileAnalysis: fileAnalysis);
       verifier.addImports(unit);
-      verifier.generateDuplicateExportWarnings(errorReporter);
-      verifier.generateDuplicateImportWarnings(errorReporter);
-      verifier.generateDuplicateShownHiddenNameWarnings(errorReporter);
-      verifier.generateUnusedImportWarnings(errorReporter);
-      verifier.generateUnusedShownNameHints(errorReporter);
-      verifier.generateUnnecessaryImportHints(errorReporter);
+      verifier.generateDuplicateExportWarnings(diagnosticReporter);
+      verifier.generateDuplicateImportWarnings(diagnosticReporter);
+      verifier.generateDuplicateShownHiddenNameWarnings(diagnosticReporter);
+      verifier.generateUnusedImportWarnings(diagnosticReporter);
+      verifier.generateUnusedShownNameHints(diagnosticReporter);
+      verifier.generateUnnecessaryImportHints(diagnosticReporter);
     }
 
     // Unused local elements.
@@ -556,7 +551,7 @@
         (package is PubPackage) ? package.sdkVersionConstraint : null;
     if (sdkVersionConstraint != null) {
       SdkConstraintVerifier verifier = SdkConstraintVerifier(
-        errorReporter,
+        diagnosticReporter,
         sdkVersionConstraint.withoutPreRelease,
       );
       unit.accept(verifier);
@@ -690,16 +685,16 @@
     _computeConstants();
   }
 
-  /// Reports URI-related import directive errors to the [errorReporter].
+  /// Reports URI-related import directive errors to the [diagnosticReporter].
   void _reportImportDirectiveErrors({
     required ImportDirectiveImpl directive,
     required LibraryImportState state,
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
   }) {
     if (state is LibraryImportWithUri) {
       var selectedUriStr = state.selectedUri.relativeUriStr;
       if (selectedUriStr.startsWith('dart-ext:')) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           directive.uri,
           CompileTimeErrorCode.USE_OF_NATIVE_EXTENSION,
         );
@@ -708,7 +703,7 @@
             state.isDocImport
                 ? WarningCode.URI_DOES_NOT_EXIST_IN_DOC_IMPORT
                 : CompileTimeErrorCode.URI_DOES_NOT_EXIST;
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           directive.uri,
           errorCode,
           arguments: [selectedUriStr],
@@ -720,26 +715,26 @@
                 : state.importedSource.isGenerated
                 ? CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED
                 : CompileTimeErrorCode.URI_DOES_NOT_EXIST;
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           directive.uri,
           errorCode,
           arguments: [selectedUriStr],
         );
       } else if (state.importedLibrarySource == null) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           directive.uri,
           CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY,
           arguments: [selectedUriStr],
         );
       }
     } else if (state is LibraryImportWithUriStr) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         directive.uri,
         CompileTimeErrorCode.INVALID_URI,
         arguments: [state.selectedUri.relativeUriStr],
       );
     } else {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         directive.uri,
         CompileTimeErrorCode.URI_WITH_INTERPOLATION,
       );
@@ -756,7 +751,7 @@
     var fileAnalysis = _parse(file: fileKind.file, unitElement: fileElement);
     var containerUnit = fileAnalysis.unit;
 
-    var containerErrorReporter = fileAnalysis.errorReporter;
+    var containerDiagnosticReporter = fileAnalysis.diagnosticReporter;
 
     var libraryExportIndex = 0;
     var libraryImportIndex = 0;
@@ -769,7 +764,7 @@
           directive: directive,
           element: fileElement.libraryExports[index],
           state: fileKind.libraryExports[index],
-          errorReporter: containerErrorReporter,
+          diagnosticReporter: containerDiagnosticReporter,
         );
       } else if (directive is ImportDirectiveImpl) {
         var index = libraryImportIndex++;
@@ -777,7 +772,7 @@
           directive: directive,
           element: fileElement.libraryImports[index],
           state: fileKind.libraryImports[index],
-          errorReporter: containerErrorReporter,
+          diagnosticReporter: containerDiagnosticReporter,
         );
       } else if (directive is LibraryDirectiveImpl) {
         if (fileKind == _library) {
@@ -790,7 +785,7 @@
           directive: directive,
           partState: fileKind.partIncludes[index],
           partElement: fileElement.parts[index],
-          errorReporter: containerErrorReporter,
+          diagnosticReporter: containerDiagnosticReporter,
         );
       }
     }
@@ -806,7 +801,7 @@
         _resolveLibraryDocImportDirective(
           directive: docImports[i].import as ImportDirectiveImpl,
           state: fileKind.docLibraryImports[i],
-          errorReporter: containerErrorReporter,
+          diagnosticReporter: containerDiagnosticReporter,
         );
       }
     }
@@ -850,7 +845,7 @@
     ];
     unit.accept(
       ScopeResolverVisitor(
-        fileAnalysis.errorReporter,
+        fileAnalysis.diagnosticReporter,
         nameScope: unitElement.scope,
         docImportLibraries: docImportLibraries,
       ),
@@ -892,11 +887,11 @@
   }
 
   /// Resolves the `@docImport` directive URI and reports any import errors of
-  /// the [directive] to the [errorReporter].
+  /// the [directive] to the [diagnosticReporter].
   void _resolveLibraryDocImportDirective({
     required ImportDirectiveImpl directive,
     required LibraryImportState state,
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
   }) {
     _resolveUriConfigurations(
       configurationNodes: directive.configurations,
@@ -905,7 +900,7 @@
     _reportImportDirectiveErrors(
       directive: directive,
       state: state,
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
     );
   }
 
@@ -913,7 +908,7 @@
     required ExportDirectiveImpl directive,
     required LibraryExportImpl element,
     required LibraryExportState state,
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
   }) {
     directive.libraryExport = element;
     _resolveUriConfigurations(
@@ -923,12 +918,12 @@
     if (state is LibraryExportWithUri) {
       var selectedUriStr = state.selectedUri.relativeUriStr;
       if (selectedUriStr.startsWith('dart-ext:')) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           directive.uri,
           CompileTimeErrorCode.USE_OF_NATIVE_EXTENSION,
         );
       } else if (state.exportedSource == null) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           directive.uri,
           CompileTimeErrorCode.URI_DOES_NOT_EXIST,
           arguments: [selectedUriStr],
@@ -938,26 +933,26 @@
             isGeneratedSource(state.exportedSource)
                 ? CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED
                 : CompileTimeErrorCode.URI_DOES_NOT_EXIST;
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           directive.uri,
           errorCode,
           arguments: [selectedUriStr],
         );
       } else if (state.exportedLibrarySource == null) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           directive.uri,
           CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY,
           arguments: [selectedUriStr],
         );
       }
     } else if (state is LibraryExportWithUriStr) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         directive.uri,
         CompileTimeErrorCode.INVALID_URI,
         arguments: [state.selectedUri.relativeUriStr],
       );
     } else {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         directive.uri,
         CompileTimeErrorCode.URI_WITH_INTERPOLATION,
       );
@@ -968,7 +963,7 @@
     required ImportDirectiveImpl directive,
     required LibraryImportImpl element,
     required LibraryImportState state,
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
   }) {
     directive.libraryImport = element;
     directive.prefix?.element = element.prefix2?.element;
@@ -979,7 +974,7 @@
     _reportImportDirectiveErrors(
       directive: directive,
       state: state,
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
     );
   }
 
@@ -988,7 +983,7 @@
     required PartDirectiveImpl? directive,
     required PartIncludeState partState,
     required PartIncludeImpl partElement,
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
   }) {
     directive?.partInclude = partElement;
 
@@ -997,7 +992,7 @@
       List<Object>? arguments = const [],
     }) {
       if (directive != null) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           directive.uri,
           diagnosticCode,
           arguments: arguments,
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index 2ffc080..3e08969 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -8336,7 +8336,7 @@
     var visitor = ConstantVisitor(
       evaluationEngine,
       libraryElement,
-      ErrorReporter(diagnosticListener, unitFragment.source),
+      DiagnosticReporter(diagnosticListener, unitFragment.source),
     );
 
     var constant = visitor.evaluateAndReportInvalidConstant(this);
diff --git a/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart b/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
index 3a456f3..b44e108 100644
--- a/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
+++ b/pkg/analyzer/lib/src/dart/constant/constant_verifier.dart
@@ -40,8 +40,8 @@
 /// In particular, it looks for errors and warnings related to constant
 /// expressions.
 class ConstantVerifier extends RecursiveAstVisitor<void> {
-  /// The error reporter by which errors will be reported.
-  final ErrorReporter _errorReporter;
+  /// The diagnostic reporter by which diagnostics will be reported.
+  final DiagnosticReporter _diagnosticReporter;
 
   /// The type operations.
   final TypeSystemImpl _typeSystem;
@@ -72,12 +72,12 @@
 
   /// Initialize a newly created constant verifier.
   ConstantVerifier(
-    ErrorReporter errorReporter,
+    DiagnosticReporter diagnosticReporter,
     LibraryElementImpl currentLibrary,
     DeclaredVariables declaredVariables, {
     bool retainDataForTesting = false,
   }) : this._(
-         errorReporter,
+         diagnosticReporter,
          currentLibrary,
          currentLibrary.typeSystem,
          currentLibrary.typeProvider,
@@ -87,7 +87,7 @@
        );
 
   ConstantVerifier._(
-    this._errorReporter,
+    this._diagnosticReporter,
     this._currentLibrary,
     this._typeSystem,
     this._typeProvider,
@@ -111,7 +111,7 @@
     if (element is ConstructorElement) {
       // should be 'const' constructor
       if (!element.isConst) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR,
         );
@@ -120,7 +120,7 @@
       // should have arguments
       var argumentList = node.arguments;
       if (argumentList == null) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS,
         );
@@ -151,7 +151,7 @@
           matchedValueType = matchedValueType?.extensionTypeErasure;
           if (matchedValueType != null) {
             if (!_canBeEqual(constantType, matchedValueType)) {
-              _errorReporter.atNode(
+              _diagnosticReporter.atNode(
                 node,
                 WarningCode.CONSTANT_PATTERN_NEVER_MATCHES_VALUE_TYPE,
                 arguments: [matchedValueType, constantType],
@@ -176,7 +176,7 @@
       if (element is ConstructorFragmentImpl &&
           !element.isCycleFree &&
           !element.isFactory) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node.returnType,
           CompileTimeErrorCode.RECURSIVE_CONSTANT_CONSTRUCTOR,
         );
@@ -277,7 +277,7 @@
         var constantVisitor = ConstantVisitor(
           _evaluationEngine,
           _currentLibrary,
-          _errorReporter,
+          _diagnosticReporter,
         );
         var result = _evaluationEngine.evaluateAndFormatErrorsInConstructorCall(
           _currentLibrary,
@@ -290,7 +290,7 @@
         switch (result) {
           case InvalidConstant():
             if (!result.avoidReporting) {
-              _errorReporter.atOffset(
+              _diagnosticReporter.atOffset(
                 offset: result.offset,
                 length: result.length,
                 diagnosticCode: result.diagnosticCode,
@@ -365,9 +365,9 @@
     }
 
     for (var duplicateEntry in duplicateKeys.entries) {
-      _errorReporter.reportError(
+      _diagnosticReporter.reportError(
         _diagnosticFactory.equalKeysInMapPattern(
-          _errorReporter.source,
+          _diagnosticReporter.source,
           duplicateEntry.key,
           duplicateEntry.value,
         ),
@@ -422,9 +422,9 @@
           verifier.verify(element);
         }
         for (var duplicateEntry in config.duplicateElements.entries) {
-          _errorReporter.reportError(
+          _diagnosticReporter.reportError(
             _diagnosticFactory.equalElementsInConstSet(
-              _errorReporter.source,
+              _diagnosticReporter.source,
               duplicateEntry.key,
               duplicateEntry.value,
             ),
@@ -446,9 +446,9 @@
           verifier.verify(entry);
         }
         for (var duplicateEntry in config.duplicateKeys.entries) {
-          _errorReporter.reportError(
+          _diagnosticReporter.reportError(
             _diagnosticFactory.equalKeysInConstMap(
-              _errorReporter.source,
+              _diagnosticReporter.source,
               duplicateEntry.key,
               duplicateEntry.value,
             ),
@@ -589,7 +589,7 @@
       // Should not be a type parameter.
       if (type.element2 is TypeParameterElement &&
           !allowedTypeParameters.contains(type.element2)) {
-        _errorReporter.atNode(type, diagnosticCode);
+        _diagnosticReporter.atNode(type, diagnosticCode);
         return;
       }
       // Check type arguments.
@@ -658,14 +658,14 @@
     DiagnosticCode diagnosticCode,
   ) {
     var diagnosticListener = RecordingDiagnosticListener();
-    var subErrorReporter = ErrorReporter(
+    var subDiagnosticReporter = DiagnosticReporter(
       diagnosticListener,
-      _errorReporter.source,
+      _diagnosticReporter.source,
     );
     var constantVisitor = ConstantVisitor(
       _evaluationEngine,
       _currentLibrary,
-      subErrorReporter,
+      subDiagnosticReporter,
     );
     var result = constantVisitor.evaluateConstant(expression);
     if (result is InvalidConstant) {
@@ -674,7 +674,7 @@
     return result;
   }
 
-  /// Reports an error to the [_errorReporter].
+  /// Reports an error to the [_diagnosticReporter].
   ///
   /// If the [error] isn't found in the list, use the given
   /// [defaultDiagnosticCode] instead.
@@ -839,9 +839,9 @@
           CompileTimeErrorCode
               .WRONG_NUMBER_OF_TYPE_ARGUMENTS_ANONYMOUS_FUNCTION,
         )) {
-      _errorReporter.reportError(
+      _diagnosticReporter.reportError(
         Diagnostic.tmp(
-          source: _errorReporter.source,
+          source: _diagnosticReporter.source,
           offset: error.offset,
           length: error.length,
           errorCode: error.diagnosticCode,
@@ -850,9 +850,9 @@
         ),
       );
     } else if (defaultDiagnosticCode != null) {
-      _errorReporter.reportError(
+      _diagnosticReporter.reportError(
         Diagnostic.tmp(
-          source: _errorReporter.source,
+          source: _diagnosticReporter.source,
           offset: error.offset,
           length: error.length,
           errorCode: defaultDiagnosticCode,
@@ -869,7 +869,10 @@
     if (notPotentiallyConstants.isEmpty) return;
 
     for (var notConst in notPotentiallyConstants) {
-      _errorReporter.atNode(notConst, CompileTimeErrorCode.INVALID_CONSTANT);
+      _diagnosticReporter.atNode(
+        notConst,
+        CompileTimeErrorCode.INVALID_CONSTANT,
+      );
     }
   }
 
@@ -969,23 +972,23 @@
           }
           var initializer = variableDeclaration.initializer;
           if (initializer != null) {
-            // Ignore any errors produced during validation--if the constant
-            // can't be evaluated we'll just report a single error.
-            ErrorReporter subErrorReporter = ErrorReporter(
+            // Ignore any diagnostics produced during validation--if the
+            // constant can't be evaluated we'll just report a single error.
+            DiagnosticReporter subDiagnosticReporter = DiagnosticReporter(
               DiagnosticListener.NULL_LISTENER,
-              _errorReporter.source,
+              _diagnosticReporter.source,
             );
             var result = initializer.accept(
               ConstantVisitor(
                 _evaluationEngine,
                 _currentLibrary,
-                subErrorReporter,
+                subDiagnosticReporter,
               ),
             );
             // TODO(kallentu): Report the specific error we got from the
             // evaluator to make it clear to the user what's wrong.
             if (result is! DartObjectImpl) {
-              _errorReporter.atToken(
+              _diagnosticReporter.atToken(
                 constKeyword,
                 CompileTimeErrorCode
                     .CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST,
@@ -1065,7 +1068,10 @@
           SwitchExpressionCaseImpl() => caseNode.arrow,
           SwitchPatternCaseImpl() => caseNode.keyword,
         };
-        _errorReporter.atToken(errorToken, WarningCode.UNREACHABLE_SWITCH_CASE);
+        _diagnosticReporter.atToken(
+          errorToken,
+          WarningCode.UNREACHABLE_SWITCH_CASE,
+        );
       }
       if (nonExhaustiveness != null) {
         if (reportNonExhaustive) {
@@ -1088,7 +1094,7 @@
               correctionData.add(correctionDataBuffer.parts);
             }
           }
-          _errorReporter.atToken(
+          _diagnosticReporter.atToken(
             switchKeyword,
             isSwitchExpression
                 ? CompileTimeErrorCode.NON_EXHAUSTIVE_SWITCH_EXPRESSION
@@ -1104,7 +1110,7 @@
       } else {
         if (defaultNode != null && mustBeExhaustive) {
           // Default node is unreachable
-          _errorReporter.atToken(
+          _diagnosticReporter.atToken(
             defaultNode.keyword,
             WarningCode.UNREACHABLE_SWITCH_DEFAULT,
           );
@@ -1147,7 +1153,7 @@
       if (!featureSet.isEnabled(Feature.patterns)) {
         var expressionType = expressionValue.type;
         if (!expressionValue.hasPrimitiveEquality(featureSet)) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             expression,
             CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS,
             arguments: [expressionType],
@@ -1222,7 +1228,7 @@
 
       return true;
     } else if (element is ForElement) {
-      verifier._errorReporter.atNode(
+      verifier._diagnosticReporter.atNode(
         element,
         CompileTimeErrorCode.CONST_EVAL_FOR_ELEMENT,
       );
@@ -1352,7 +1358,7 @@
       } else {
         throw UnimplementedError();
       }
-      verifier._errorReporter.atNode(notConst, errorCode);
+      verifier._diagnosticReporter.atNode(notConst, errorCode);
     }
 
     return false;
@@ -1368,13 +1374,13 @@
         value,
         verifier._typeSystem.makeNullable(listElementType),
       )) {
-        verifier._errorReporter.atNode(
+        verifier._diagnosticReporter.atNode(
           expression,
           CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE_NULLABILITY,
           arguments: [value.type, listElementType],
         );
       } else {
-        verifier._errorReporter.atNode(
+        verifier._diagnosticReporter.atNode(
           expression,
           CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE,
           arguments: [value.type, listElementType],
@@ -1398,7 +1404,7 @@
       // TODO(kallentu): Consolidate this with
       // [ConstantVisitor._addElementsToList] and the other similar
       // _addElementsTo methods..
-      verifier._errorReporter.atNode(
+      verifier._diagnosticReporter.atNode(
         element.expression,
         CompileTimeErrorCode.CONST_SPREAD_EXPECTED_LIST_OR_SET,
       );
@@ -1413,7 +1419,7 @@
     if (listValue != null) {
       var featureSet = verifier._currentLibrary.featureSet;
       if (!listValue.every((e) => e.hasPrimitiveEquality(featureSet))) {
-        verifier._errorReporter.atNode(
+        verifier._diagnosticReporter.atNode(
           element,
           CompileTimeErrorCode.CONST_SET_ELEMENT_NOT_PRIMITIVE_EQUALITY,
           arguments: [value.type],
@@ -1467,13 +1473,13 @@
               keyValue,
               verifier._typeSystem.makeNullable(expectedKeyType),
             )) {
-          verifier._errorReporter.atNode(
+          verifier._diagnosticReporter.atNode(
             keyExpression,
             CompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE_NULLABILITY,
             arguments: [keyType, expectedKeyType],
           );
         } else {
-          verifier._errorReporter.atNode(
+          verifier._diagnosticReporter.atNode(
             keyExpression,
             CompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE,
             arguments: [keyType, expectedKeyType],
@@ -1483,7 +1489,7 @@
 
       var featureSet = verifier._currentLibrary.featureSet;
       if (!keyValue.hasPrimitiveEquality(featureSet)) {
-        verifier._errorReporter.atNode(
+        verifier._diagnosticReporter.atNode(
           keyExpression,
           CompileTimeErrorCode.CONST_MAP_KEY_NOT_PRIMITIVE_EQUALITY,
           arguments: [keyType],
@@ -1517,13 +1523,13 @@
               valueValue,
               verifier._typeSystem.makeNullable(expectedValueType),
             )) {
-          verifier._errorReporter.atNode(
+          verifier._diagnosticReporter.atNode(
             valueExpression,
             CompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE_NULLABILITY,
             arguments: [valueValue.type, expectedValueType],
           );
         } else {
-          verifier._errorReporter.atNode(
+          verifier._diagnosticReporter.atNode(
             valueExpression,
             CompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE,
             arguments: [valueValue.type, expectedValueType],
@@ -1559,7 +1565,7 @@
       }
       return true;
     }
-    verifier._errorReporter.atNode(
+    verifier._diagnosticReporter.atNode(
       element.expression,
       CompileTimeErrorCode.CONST_SPREAD_EXPECTED_MAP,
     );
@@ -1576,13 +1582,13 @@
         value,
         verifier._typeSystem.makeNullable(config.elementType),
       )) {
-        verifier._errorReporter.atNode(
+        verifier._diagnosticReporter.atNode(
           expression,
           CompileTimeErrorCode.SET_ELEMENT_TYPE_NOT_ASSIGNABLE_NULLABILITY,
           arguments: [value.type, config.elementType],
         );
       } else {
-        verifier._errorReporter.atNode(
+        verifier._diagnosticReporter.atNode(
           expression,
           CompileTimeErrorCode.SET_ELEMENT_TYPE_NOT_ASSIGNABLE,
           arguments: [value.type, config.elementType],
@@ -1593,7 +1599,7 @@
 
     var featureSet = verifier._currentLibrary.featureSet;
     if (!value.hasPrimitiveEquality(featureSet)) {
-      verifier._errorReporter.atNode(
+      verifier._diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.CONST_SET_ELEMENT_NOT_PRIMITIVE_EQUALITY,
         arguments: [value.type],
diff --git a/pkg/analyzer/lib/src/dart/constant/evaluation.dart b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
index fbef442..febc926 100644
--- a/pkg/analyzer/lib/src/dart/constant/evaluation.dart
+++ b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
@@ -94,11 +94,15 @@
         var defaultValue = constant.constantInitializer;
         if (defaultValue != null) {
           var diagnosticListener = RecordingDiagnosticListener();
-          var errorReporter = ErrorReporter(
+          var diagnosticReporter = DiagnosticReporter(
             diagnosticListener,
             constant.source!,
           );
-          var constantVisitor = ConstantVisitor(this, library, errorReporter);
+          var constantVisitor = ConstantVisitor(
+            this,
+            library,
+            diagnosticReporter,
+          );
           var dartConstant = constantVisitor.evaluateConstant(defaultValue);
           constant.evaluationResult = dartConstant;
         } else {
@@ -108,9 +112,15 @@
     } else if (constant is VariableFragmentImpl) {
       var constantInitializer = constant.constantInitializer;
       if (constantInitializer != null) {
-        var diagnosticListener = RecordingDiagnosticListener();
-        var errorReporter = ErrorReporter(diagnosticListener, constant.source!);
-        var constantVisitor = ConstantVisitor(this, library, errorReporter);
+        var diagnosticReporter = DiagnosticReporter(
+          RecordingDiagnosticListener(),
+          constant.source!,
+        );
+        var constantVisitor = ConstantVisitor(
+          this,
+          library,
+          diagnosticReporter,
+        );
         var dartConstant = constantVisitor.evaluateConstant(
           constantInitializer,
         );
@@ -187,8 +197,15 @@
           element.isConst &&
           constNode.arguments != null) {
         var diagnosticListener = RecordingDiagnosticListener();
-        var errorReporter = ErrorReporter(diagnosticListener, constant.source);
-        var constantVisitor = ConstantVisitor(this, library, errorReporter);
+        var diagnosticReporter = DiagnosticReporter(
+          diagnosticListener,
+          constant.source,
+        );
+        var constantVisitor = ConstantVisitor(
+          this,
+          library,
+          diagnosticReporter,
+        );
         var result = evaluateAndFormatErrorsInConstructorCall(
           library,
           constNode,
@@ -422,14 +439,14 @@
     ConstantEvaluationTarget constant,
   ) {
     if (constant is VariableFragmentImpl) {
-      ErrorReporter errorReporter = ErrorReporter(
+      DiagnosticReporter diagnosticReporter = DiagnosticReporter(
         RecordingDiagnosticListener(),
         constant.source!,
       );
       // TODO(paulberry): It would be really nice if we could extract enough
       // information from the 'cycle' argument to provide the user with a
       // description of the cycle.
-      errorReporter.atElement2(
+      diagnosticReporter.atElement2(
         constant.asElement2!,
         CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT,
       );
@@ -563,9 +580,9 @@
 
   final Substitution? _substitution;
 
-  /// Error reporter that we use to report errors accumulated while computing
-  /// the constant.
-  final ErrorReporter _errorReporter;
+  /// Diagnostic reporter that we use to report errors accumulated while
+  /// computing the constant.
+  final DiagnosticReporter _diagnosticReporter;
 
   /// Helper class used to compute constant values.
   late final DartObjectComputer _dartObjectComputer;
@@ -573,14 +590,14 @@
   /// Initializes a newly created constant visitor. The [_evaluationEngine] is
   /// used to evaluate instance creation expressions. The [lexicalEnvironment]
   /// is a map containing values which should override identifiers, or `null` if
-  /// no overriding is necessary. The [_errorReporter] is used to report errors
-  /// found during evaluation.
+  /// no overriding is necessary. The [_diagnosticReporter] is used to report
+  /// errors found during evaluation.
   ///
   /// The [substitution] is specified for instance creations.
   ConstantVisitor(
     this._evaluationEngine,
     this._library,
-    this._errorReporter, {
+    this._diagnosticReporter, {
     Map<String, DartObjectImpl>? lexicalEnvironment,
     Map<TypeParameterElement, TypeImpl>? lexicalTypeEnvironment,
     Substitution? substitution,
@@ -604,7 +621,7 @@
   Constant evaluateAndReportInvalidConstant(AstNode node) {
     var result = evaluateConstant(node);
     if (result case InvalidConstant(avoidReporting: false)) {
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: result.offset,
         length: result.length,
         diagnosticCode: result.diagnosticCode,
@@ -2229,7 +2246,7 @@
       // interaction with g3 more elegantly.
       case InvalidConstant(isUnresolved: true):
         if (!expressionValue.avoidReporting) {
-          _errorReporter.atOffset(
+          _diagnosticReporter.atOffset(
             offset: expressionValue.offset,
             length: expressionValue.length,
             diagnosticCode: expressionValue.diagnosticCode,
@@ -2807,18 +2824,16 @@
   /// An error reporter for errors determined while computing values for field
   /// initializers, or default values for the constructor parameters.
   ///
-  /// Such errors cannot be reported into [ConstantVisitor._errorReporter],
+  /// Such errors cannot be reported into [ConstantVisitor._diagnosticReporter],
   /// because they usually happen in a different source. But they still should
   /// cause a constant evaluation error for the current node.
-  late final ErrorReporter _externalErrorReporter = ErrorReporter(
-    _externalDiagnosticListener,
-    _constructor.source,
-  );
+  late final DiagnosticReporter _externalDiagnosticReporter =
+      DiagnosticReporter(_externalDiagnosticListener, _constructor.source);
 
   late final ConstantVisitor _initializerVisitor = ConstantVisitor(
     _evaluationEngine,
     _constructor.library2,
-    _externalErrorReporter,
+    _externalDiagnosticReporter,
     lexicalEnvironment: _parameterMap,
     lexicalTypeEnvironment: _typeParameterMap,
     substitution: Substitution.fromInterfaceType(definingType),
diff --git a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
index 774ffca..6f50d63 100644
--- a/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
+++ b/pkg/analyzer/lib/src/dart/element/generic_inferrer.dart
@@ -9,7 +9,7 @@
 import 'package:analyzer/dart/ast/syntactic_entity.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/error/listener.dart' show ErrorReporter;
+import 'package:analyzer/error/listener.dart' show DiagnosticReporter;
 import 'package:analyzer/src/dart/ast/ast.dart';
 import 'package:analyzer/src/dart/ast/extensions.dart';
 import 'package:analyzer/src/dart/element/element.dart';
@@ -57,12 +57,12 @@
   /// The list of type parameters being inferred.
   final List<TypeParameterElementImpl2> _typeFormals;
 
-  /// The [ErrorReporter] to which inference errors should be reported, or
-  /// `null` if errors shouldn't be reported.
-  final ErrorReporter? errorReporter;
+  /// The [DiagnosticReporter] to which inference diagnostics should be reported, or
+  /// `null` if diagnostics shouldn't be reported.
+  final DiagnosticReporter? _diagnosticReporter;
 
   /// The [SyntacticEntity] to which errors should be attached.  May be `null`
-  /// if errors are not being reported (that is, if [errorReporter] is also
+  /// if errors are not being reported (that is, if [_diagnosticReporter] is also
   /// `null`).
   final SyntacticEntity? errorEntity;
 
@@ -108,20 +108,20 @@
   GenericInferrer(
     this._typeSystem,
     List<TypeParameterElement> typeFormals, {
-    this.errorReporter,
+    DiagnosticReporter? diagnosticReporter,
     this.errorEntity,
     required this.genericMetadataIsEnabled,
     required this.inferenceUsingBoundsIsEnabled,
     required bool strictInference,
     required TypeSystemOperations typeSystemOperations,
     required this.dataForTesting,
-  })
-    // TODO(paulberry): make this cast unnecessary by changing `typeFormals`
-    // to `List<TypeParameterElementImpl2>`.
-    : _typeFormals = typeFormals.cast(),
+  }) : _diagnosticReporter = diagnosticReporter,
+       // TODO(paulberry): make this cast unnecessary by changing `typeFormals`
+       // to `List<TypeParameterElementImpl2>`.
+       _typeFormals = typeFormals.cast(),
        _strictInference = strictInference,
        _typeSystemOperations = typeSystemOperations {
-    if (errorReporter != null) {
+    if (_diagnosticReporter != null) {
       assert(errorEntity != null);
     }
     _typeParameters.addAll(_typeFormals);
@@ -330,7 +330,7 @@
           return null;
         }
 
-        errorReporter?.atEntity(
+        _diagnosticReporter?.atEntity(
           errorEntity!,
           CompileTimeErrorCode.COULD_NOT_INFER,
           arguments: [name, _formatError(parameter, inferred, constraints)],
@@ -345,7 +345,7 @@
       if (inferred is FunctionTypeImpl &&
           inferred.typeFormals.isNotEmpty &&
           !genericMetadataIsEnabled &&
-          errorReporter != null) {
+          _diagnosticReporter != null) {
         if (failAtError) {
           inferenceLogWriter?.exitGenericInference(failed: true);
           return null;
@@ -359,7 +359,7 @@
 
         var typeFormals = inferred.typeFormals;
         var typeFormalsStr = typeFormals.map(_elementStr).join(', ');
-        errorReporter!.atEntity(
+        _diagnosticReporter.atEntity(
           errorEntity!,
           CompileTimeErrorCode.COULD_NOT_INFER,
           arguments: [
@@ -379,7 +379,7 @@
         // considered a failure of inference, under the "strict-inference"
         // mode.
         _reportInferenceFailure(
-          errorReporter: errorReporter,
+          diagnosticReporter: _diagnosticReporter,
           errorEntity: errorEntity,
           genericMetadataIsEnabled: genericMetadataIsEnabled,
         );
@@ -414,7 +414,7 @@
           inferredTypes,
         ).substituteType(typeParam.bound ?? typeProvider.objectType);
         // TODO(jmesserly): improve this error message.
-        errorReporter?.atEntity(
+        _diagnosticReporter?.atEntity(
           errorEntity!,
           CompileTimeErrorCode.COULD_NOT_INFER,
           arguments: [
@@ -430,7 +430,7 @@
     if (!hasErrorReported) {
       _checkArgumentsNotMatchingBounds(
         errorEntity: errorEntity,
-        errorReporter: errorReporter,
+        diagnosticReporter: _diagnosticReporter,
         typeArguments: result,
       );
     }
@@ -443,7 +443,7 @@
   /// Check that inferred [typeArguments] satisfy the [_typeParameters] bounds.
   void _checkArgumentsNotMatchingBounds({
     required SyntacticEntity? errorEntity,
-    required ErrorReporter? errorReporter,
+    required DiagnosticReporter? diagnosticReporter,
     required List<TypeImpl> typeArguments,
   }) {
     for (int i = 0; i < _typeFormals.length; i++) {
@@ -466,7 +466,7 @@
       );
       var bound = substitution.substituteType(rawBound);
       if (!_typeSystem.isSubtypeOf(argument, bound)) {
-        errorReporter?.atEntity(
+        diagnosticReporter?.atEntity(
           errorEntity!,
           CompileTimeErrorCode.COULD_NOT_INFER,
           arguments: [
@@ -778,11 +778,11 @@
 
   /// Reports an inference failure on [errorEntity] according to its type.
   void _reportInferenceFailure({
-    ErrorReporter? errorReporter,
+    DiagnosticReporter? diagnosticReporter,
     SyntacticEntity? errorEntity,
     required bool genericMetadataIsEnabled,
   }) {
-    if (errorReporter == null || errorEntity == null) {
+    if (diagnosticReporter == null || errorEntity == null) {
       return;
     }
     if (errorEntity is AstNode &&
@@ -802,7 +802,7 @@
           errorEntity.name == null
               ? errorEntity.type.qualifiedName
               : '${errorEntity.type}.${errorEntity.name}';
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         errorEntity,
         WarningCode.INFERENCE_FAILURE_ON_INSTANCE_CREATION,
         arguments: [constructorName],
@@ -816,7 +816,7 @@
               errorEntity.constructorName == null
                   ? errorEntity.name.name
                   : '${errorEntity.name.name}.${errorEntity.constructorName}';
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             errorEntity,
             WarningCode.INFERENCE_FAILURE_ON_INSTANCE_CREATION,
             arguments: [constructorName],
@@ -830,8 +830,7 @@
           // For variable elements, we check their type and possible alias type.
           var type = element.type;
           var typeElement = type is InterfaceType ? type.element3 : null;
-          if (typeElement != null &&
-              typeElement.metadata.hasOptionalTypeArgs) {
+          if (typeElement != null && typeElement.metadata.hasOptionalTypeArgs) {
             return;
           }
           var typeAliasElement = type.alias?.element2;
@@ -841,7 +840,7 @@
           }
         }
         if (!element.hasOptionalTypeArgs) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             errorEntity,
             WarningCode.INFERENCE_FAILURE_ON_FUNCTION_INVOCATION,
             arguments: [errorEntity.name],
@@ -853,7 +852,7 @@
       var type = errorEntity.staticType;
       if (type != null) {
         var typeDisplayString = _typeStr(type);
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           errorEntity,
           WarningCode.INFERENCE_FAILURE_ON_GENERIC_INVOCATION,
           arguments: [typeDisplayString],
diff --git a/pkg/analyzer/lib/src/dart/element/type_system.dart b/pkg/analyzer/lib/src/dart/element/type_system.dart
index c2c6d4e..927ff50 100644
--- a/pkg/analyzer/lib/src/dart/element/type_system.dart
+++ b/pkg/analyzer/lib/src/dart/element/type_system.dart
@@ -11,7 +11,7 @@
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/dart/element/type_provider.dart';
 import 'package:analyzer/dart/element/type_system.dart';
-import 'package:analyzer/error/listener.dart' show ErrorReporter;
+import 'package:analyzer/error/listener.dart' show DiagnosticReporter;
 import 'package:analyzer/src/dart/ast/ast.dart' show AstNodeImpl;
 import 'package:analyzer/src/dart/element/element.dart';
 import 'package:analyzer/src/dart/element/extensions.dart';
@@ -654,7 +654,7 @@
   List<TypeImpl> inferFunctionTypeInstantiation(
     FunctionTypeImpl contextType,
     FunctionTypeImpl fnType, {
-    ErrorReporter? errorReporter,
+    DiagnosticReporter? diagnosticReporter,
     AstNode? errorNode,
     required TypeSystemOperations typeSystemOperations,
     required bool genericMetadataIsEnabled,
@@ -676,7 +676,7 @@
     var inferrer = GenericInferrer(
       this,
       fnType.typeParameters,
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
       errorEntity: errorNode,
       genericMetadataIsEnabled: genericMetadataIsEnabled,
       inferenceUsingBoundsIsEnabled: inferenceUsingBoundsIsEnabled,
@@ -1701,7 +1701,7 @@
     required List<TypeParameterElement> typeParameters,
     required TypeImpl declaredReturnType,
     required TypeImpl contextReturnType,
-    ErrorReporter? errorReporter,
+    DiagnosticReporter? diagnosticReporter,
     SyntacticEntity? errorEntity,
     required bool genericMetadataIsEnabled,
     required bool inferenceUsingBoundsIsEnabled,
@@ -1719,7 +1719,7 @@
     var inferrer = GenericInferrer(
       this,
       typeParameters,
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
       errorEntity: errorEntity,
       genericMetadataIsEnabled: genericMetadataIsEnabled,
       inferenceUsingBoundsIsEnabled: inferenceUsingBoundsIsEnabled,
diff --git a/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart
index 22bd8a5..0209fed 100644
--- a/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/annotation_resolver.dart
@@ -23,7 +23,7 @@
 
   LibraryElementImpl get _definingLibrary => _resolver.definingLibrary;
 
-  ErrorReporter get _errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get _diagnosticReporter => _resolver.diagnosticReporter;
 
   void resolve(
     AnnotationImpl node,
@@ -93,7 +93,7 @@
       );
       _resolveAnnotationElementGetter(node, getter);
     } else if (getter is! ConstructorElement) {
-      _errorReporter.atNode(node, CompileTimeErrorCode.INVALID_ANNOTATION);
+      _diagnosticReporter.atNode(node, CompileTimeErrorCode.INVALID_ANNOTATION);
     }
 
     _visitArguments(
@@ -117,7 +117,7 @@
     node.element2 = constructorElement;
 
     if (constructorElement == null) {
-      _errorReporter.atNode(node, CompileTimeErrorCode.INVALID_ANNOTATION);
+      _diagnosticReporter.atNode(node, CompileTimeErrorCode.INVALID_ANNOTATION);
       AnnotationInferrer(
         resolver: _resolver,
         node: node,
@@ -172,7 +172,7 @@
       );
       _resolveAnnotationElementGetter(node, getter);
     } else {
-      _errorReporter.atNode(node, CompileTimeErrorCode.INVALID_ANNOTATION);
+      _diagnosticReporter.atNode(node, CompileTimeErrorCode.INVALID_ANNOTATION);
     }
 
     _visitArguments(
@@ -188,7 +188,7 @@
     List<WhyNotPromotedGetter> whyNotPromotedArguments,
   ) {
     if (!element.isConst || node.arguments != null) {
-      _errorReporter.atNode(node, CompileTimeErrorCode.INVALID_ANNOTATION);
+      _diagnosticReporter.atNode(node, CompileTimeErrorCode.INVALID_ANNOTATION);
     }
 
     _visitArguments(
@@ -237,7 +237,7 @@
     name1.element = element1;
 
     if (element1 == null) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node,
         CompileTimeErrorCode.UNDEFINED_ANNOTATION,
         arguments: [name1.name],
@@ -329,7 +329,7 @@
         }
         // undefined
         if (element == null) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             node,
             CompileTimeErrorCode.UNDEFINED_ANNOTATION,
             arguments: [name2.name],
@@ -375,7 +375,7 @@
       return;
     }
 
-    _errorReporter.atNode(node, CompileTimeErrorCode.INVALID_ANNOTATION);
+    _diagnosticReporter.atNode(node, CompileTimeErrorCode.INVALID_ANNOTATION);
 
     _visitArguments(
       node,
@@ -398,7 +398,7 @@
     if (!accessorElement.isSynthetic ||
         !variableElement.isConst ||
         annotation.arguments != null) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         annotation,
         CompileTimeErrorCode.INVALID_ANNOTATION,
       );
@@ -464,7 +464,7 @@
       );
       _resolveAnnotationElementGetter(node, getter);
     } else if (getter is! ConstructorElement) {
-      _errorReporter.atNode(node, CompileTimeErrorCode.INVALID_ANNOTATION);
+      _diagnosticReporter.atNode(node, CompileTimeErrorCode.INVALID_ANNOTATION);
     }
 
     _visitArguments(
diff --git a/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
index e69b68a..08d1077 100644
--- a/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/assignment_expression_resolver.dart
@@ -31,7 +31,7 @@
       _typePropertyResolver = resolver.typePropertyResolver,
       _assignmentShared = AssignmentExpressionShared(resolver: resolver);
 
-  ErrorReporter get _errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get _diagnosticReporter => _resolver.diagnosticReporter;
 
   TypeProviderImpl get _typeProvider => _resolver.typeProvider;
 
@@ -150,7 +150,7 @@
         rightType,
         strictCasts: strictCasts,
       )) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           right,
           CompileTimeErrorCode.RECORD_LITERAL_ONE_POSITIONAL_NO_TRAILING_COMMA,
         );
@@ -158,7 +158,7 @@
       }
     }
 
-    _errorReporter.atNode(
+    _diagnosticReporter.atNode(
       right,
       CompileTimeErrorCode.INVALID_ASSIGNMENT,
       arguments: [rightType, writeType],
@@ -182,12 +182,12 @@
 
     if (expression is MethodInvocation) {
       SimpleIdentifier methodName = expression.methodName;
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         methodName,
         CompileTimeErrorCode.USE_OF_VOID_RESULT,
       );
     } else {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.USE_OF_VOID_RESULT,
       );
@@ -240,7 +240,7 @@
     // Example: `y += 0`, is not allowed.
     if (operatorType != TokenType.EQ) {
       if (leftType is VoidType) {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           operator,
           CompileTimeErrorCode.USE_OF_VOID_RESULT,
         );
@@ -272,7 +272,7 @@
     );
     node.element = result.getter2 as MethodElement2OrMember?;
     if (result.needsGetterError) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         operator,
         CompileTimeErrorCode.UNDEFINED_OPERATOR,
         arguments: [methodName, leftType],
@@ -377,7 +377,7 @@
   AssignmentExpressionShared({required ResolverVisitor resolver})
     : _resolver = resolver;
 
-  ErrorReporter get _errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get _errorReporter => _resolver.diagnosticReporter;
 
   void checkFinalAlreadyAssigned(
     Expression left, {
diff --git a/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart b/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart
index 12b12fe..9923637 100644
--- a/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/ast_rewrite.dart
@@ -24,9 +24,9 @@
 /// The public methods of this class form a complete accounting of possible
 /// node replacements.
 class AstRewriter {
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
-  AstRewriter(this._errorReporter);
+  AstRewriter(this._diagnosticReporter);
 
   /// Possibly rewrites [node] as a [MethodInvocation] with a
   /// [FunctionReference] target.
@@ -433,7 +433,7 @@
 
     var typeArguments = node.typeArguments;
     if (typeArguments != null) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         typeArguments,
         CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
         arguments: [typeNameIdentifier.toString(), constructorIdentifier.name],
@@ -600,7 +600,7 @@
 
     var typeArguments = node.typeArguments;
     if (typeArguments != null) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         typeArguments,
         CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
         arguments: [typeIdentifier.name, constructorIdentifier.name],
diff --git a/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
index e32ae51..7e7f219 100644
--- a/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/binary_expression_resolver.dart
@@ -32,7 +32,7 @@
     : _resolver = resolver,
       _typePropertyResolver = resolver.typePropertyResolver;
 
-  ErrorReporter get _errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get _diagnosticReporter => _resolver.diagnosticReporter;
 
   TypeProviderImpl get _typeProvider => _resolver.typeProvider;
 
@@ -68,7 +68,7 @@
 
     // Report an error if not already reported by the parser.
     if (operator != TokenType.BANG_EQ_EQ && operator != TokenType.EQ_EQ_EQ) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         node.operator,
         CompileTimeErrorCode.NOT_BINARY_OPERATOR,
         arguments: [operator.lexeme],
@@ -151,7 +151,7 @@
               ? WarningCode.UNNECESSARY_NULL_COMPARISON_ALWAYS_NULL_FALSE
               : WarningCode.UNNECESSARY_NULL_COMPARISON_ALWAYS_NULL_TRUE;
       var offset = start.offset;
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: offset,
         length: end.end - offset,
         diagnosticCode: errorCode,
@@ -402,7 +402,7 @@
       if (member == null) {
         // Extension overrides can only be used with named extensions so it is
         // safe to assume `extension.name` is non-`null`.
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           node.operator,
           CompileTimeErrorCode.UNDEFINED_EXTENSION_OPERATOR,
           arguments: [methodName, extension.name3!],
@@ -416,7 +416,7 @@
     var leftType = leftOperand.typeOrThrow;
 
     if (identical(leftType, NeverTypeImpl.instance)) {
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         leftOperand,
         WarningCode.RECEIVER_OF_TYPE_NEVER,
       );
@@ -441,13 +441,13 @@
     node.staticInvokeType = result.getter2?.type;
     if (result.needsGetterError) {
       if (leftOperand is SuperExpression) {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           node.operator,
           CompileTimeErrorCode.UNDEFINED_SUPER_OPERATOR,
           arguments: [methodName, leftType],
         );
       } else {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           node.operator,
           CompileTimeErrorCode.UNDEFINED_OPERATOR,
           arguments: [methodName, leftType],
diff --git a/pkg/analyzer/lib/src/dart/resolver/comment_reference_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/comment_reference_resolver.dart
index 557823b..eded67a 100644
--- a/pkg/analyzer/lib/src/dart/resolver/comment_reference_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/comment_reference_resolver.dart
@@ -27,7 +27,7 @@
 
   /// Resolves [commentReference].
   void resolve(CommentReference commentReference) {
-    _resolver.errorReporter.lockLevel++;
+    _resolver.diagnosticReporter.lockLevel++;
     try {
       var expression = commentReference.expression;
       if (expression is SimpleIdentifierImpl) {
@@ -47,7 +47,7 @@
         );
       }
     } finally {
-      _resolver.errorReporter.lockLevel--;
+      _resolver.diagnosticReporter.lockLevel--;
     }
   }
 
diff --git a/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart
index a431c20..6f365b4 100644
--- a/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/constructor_reference_resolver.dart
@@ -23,7 +23,7 @@
         node.constructorName.type.typeArguments == null) {
       // Only report this if [node] has no explicit type arguments; otherwise
       // the parser has already reported an error.
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         node,
         WarningCode.SDK_VERSION_CONSTRUCTOR_TEAROFFS,
       );
@@ -34,7 +34,7 @@
       var enclosingElement = element.enclosingElement;
       if (enclosingElement is ClassElementImpl2 &&
           enclosingElement.isAbstract) {
-        _resolver.errorReporter.atNode(
+        _resolver.diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode
               .TEAROFF_OF_GENERATIVE_CONSTRUCTOR_OF_ABSTRACT_CLASS,
@@ -73,9 +73,13 @@
                       .CLASS_INSTANTIATION_ACCESS_TO_STATIC_MEMBER
                   : CompileTimeErrorCode
                       .CLASS_INSTANTIATION_ACCESS_TO_INSTANCE_MEMBER;
-          _resolver.errorReporter.atNode(node, error, arguments: [name.name]);
+          _resolver.diagnosticReporter.atNode(
+            node,
+            error,
+            arguments: [name.name],
+          );
         } else if (!name.isSynthetic) {
-          _resolver.errorReporter.atNode(
+          _resolver.diagnosticReporter.atNode(
             node,
             CompileTimeErrorCode.CLASS_INSTANTIATION_ACCESS_TO_UNKNOWN_MEMBER,
             arguments: [enclosingElement.name3!, name.name],
diff --git a/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart
index e67b9ed..d249d07 100644
--- a/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/extension_member_resolver.dart
@@ -30,7 +30,7 @@
 
   ExtensionMemberResolver(this._resolver);
 
-  ErrorReporter get _errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get _diagnosticReporter => _resolver.diagnosticReporter;
 
   bool get _genericMetadataIsEnabled =>
       _resolver.definingLibrary.featureSet.isEnabled(Feature.generic_metadata);
@@ -116,7 +116,7 @@
 
     // The most specific extension is ambiguous.
     if (mostSpecific.length == 2) {
-      _errorReporter.atEntity(
+      _diagnosticReporter.atEntity(
         nameEntity,
         CompileTimeErrorCode.AMBIGUOUS_EXTENSION_MEMBER_ACCESS_TWO,
         arguments: [
@@ -127,7 +127,7 @@
       );
     } else {
       var extensions = mostSpecific.map((e) => e.extension).toList();
-      _errorReporter.atEntity(
+      _diagnosticReporter.atEntity(
         nameEntity,
         CompileTimeErrorCode.AMBIGUOUS_EXTENSION_MEMBER_ACCESS_THREE_OR_MORE,
         arguments: [
@@ -201,7 +201,7 @@
 
     if (!_isValidContext(node)) {
       if (!_isCascadeTarget(node)) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.EXTENSION_OVERRIDE_WITHOUT_ACCESS,
         );
@@ -211,7 +211,7 @@
 
     var arguments = node.argumentList.arguments;
     if (arguments.length != 1) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node.argumentList,
         CompileTimeErrorCode.INVALID_EXTENSION_ARGUMENT_COUNT,
       );
@@ -254,7 +254,7 @@
     );
 
     if (receiverType is VoidType) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         receiverExpression,
         CompileTimeErrorCode.USE_OF_VOID_RESULT,
       );
@@ -265,7 +265,7 @@
     )) {
       var whyNotPromoted =
           whyNotPromotedArguments.isEmpty ? null : whyNotPromotedArguments[0];
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         receiverExpression,
         CompileTimeErrorCode.EXTENSION_OVERRIDE_ARGUMENT_NOT_ASSIGNABLE,
         arguments: [receiverType, extendedType],
@@ -292,7 +292,7 @@
         if (name != null && parameterBound != null) {
           parameterBound = substitution.substituteType(parameterBound);
           if (!_typeSystem.isSubtypeOf(argument, parameterBound)) {
-            _errorReporter.atNode(
+            _diagnosticReporter.atNode(
               typeArgumentList.arguments[i],
               CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
               arguments: [argument, name, parameterBound],
@@ -375,7 +375,7 @@
         // We can safely assume `element.name` is non-`null` because type
         // arguments can only be applied to explicit extension overrides, and
         // explicit extension overrides cannot refer to unnamed extensions.
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           typeArguments,
           CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_EXTENSION,
           arguments: [element.name3!, typeParameters.length, arguments.length],
@@ -390,7 +390,7 @@
       var inferrer = GenericInferrer(
         _typeSystem,
         typeParameters,
-        errorReporter: _errorReporter,
+        diagnosticReporter: _diagnosticReporter,
         errorEntity: node.name,
         genericMetadataIsEnabled: _genericMetadataIsEnabled,
         inferenceUsingBoundsIsEnabled: _resolver.inferenceUsingBoundsIsEnabled,
diff --git a/pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart
index b08fabb..180924d 100644
--- a/pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/function_expression_invocation_resolver.dart
@@ -25,7 +25,7 @@
     : _resolver = resolver,
       _typePropertyResolver = resolver.typePropertyResolver;
 
-  ErrorReporter get _errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get _diagnosticReporter => _resolver.diagnosticReporter;
 
   ExtensionMemberResolver get _extensionResolver => _resolver.extensionResolver;
 
@@ -78,7 +78,7 @@
     }
 
     if (identical(receiverType, NeverTypeImpl.instance)) {
-      _errorReporter.atNode(function, WarningCode.RECEIVER_OF_TYPE_NEVER);
+      _diagnosticReporter.atNode(function, WarningCode.RECEIVER_OF_TYPE_NEVER);
       _unresolved(
         node,
         NeverTypeImpl.instance,
@@ -101,7 +101,7 @@
 
     if (callElement == null) {
       if (result.needsGetterError) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           function,
           CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION,
         );
@@ -120,7 +120,7 @@
     }
 
     if (callElement.kind != ElementKind.METHOD) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         function,
         CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION,
       );
@@ -152,12 +152,12 @@
 
     if (expression is MethodInvocation) {
       SimpleIdentifier methodName = expression.methodName;
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         methodName,
         CompileTimeErrorCode.USE_OF_VOID_RESULT,
       );
     } else {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.USE_OF_VOID_RESULT,
       );
@@ -201,7 +201,7 @@
     node.element = callElement;
 
     if (callElement == null) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         function,
         CompileTimeErrorCode.INVOCATION_OF_EXTENSION_WITHOUT_CALL,
         arguments: [function.name.lexeme],
@@ -215,7 +215,7 @@
     }
 
     if (callElement.isStatic) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node.argumentList,
         CompileTimeErrorCode.EXTENSION_OVERRIDE_ACCESS_TO_STATIC_MEMBER,
       );
diff --git a/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart
index 4a22078..bf427f7 100644
--- a/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/function_expression_resolver.dart
@@ -77,7 +77,7 @@
       //
       // This is only needed for local functions because top-level and
       checkForTypeParameterBoundRecursion(
-        _resolver.errorReporter,
+        _resolver.diagnosticReporter,
         typeParameterList.typeParameters,
       );
       var map = <Fragment, TypeParameter>{};
diff --git a/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
index 27d1fe7..5f90137 100644
--- a/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/function_reference_resolver.dart
@@ -34,7 +34,7 @@
     : _extensionResolver = _resolver.extensionResolver,
       _typeType = _resolver.typeProvider.typeType;
 
-  ErrorReporter get _errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get _diagnosticReporter => _resolver.diagnosticReporter;
 
   void resolve(FunctionReferenceImpl node) {
     var function = node.function;
@@ -55,7 +55,7 @@
         // We can safely assume `function.constructorName.name` is non-null
         // because if no name had been given, the construct would have been
         // interpreted as a type literal (e.g. `List<int>`).
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           typeArguments,
           CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
           arguments: [
@@ -107,7 +107,7 @@
     }
 
     if (prefixType is DynamicType) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         function,
         CompileTimeErrorCode.GENERIC_METHOD_TYPE_INSTANTIATION_ON_DYNAMIC,
       );
@@ -130,14 +130,14 @@
         errorCode =
             CompileTimeErrorCode
                 .WRONG_NUMBER_OF_TYPE_ARGUMENTS_ANONYMOUS_FUNCTION;
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           typeArgumentList,
           errorCode,
           arguments: [typeParameters.length, typeArgumentList.arguments.length],
         );
       } else {
         assert(name != null);
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           typeArgumentList,
           errorCode,
           arguments: [
@@ -190,14 +190,14 @@
     var enclosingElement = element.enclosingElement!;
     if (implicitReceiver) {
       if (_resolver.enclosingExtension != null) {
-        _resolver.errorReporter.atNode(
+        _resolver.diagnosticReporter.atNode(
           nameNode,
           CompileTimeErrorCode
               .UNQUALIFIED_REFERENCE_TO_STATIC_MEMBER_OF_EXTENDED_TYPE,
           arguments: [enclosingElement.displayName],
         );
       } else {
-        _resolver.errorReporter.atNode(
+        _resolver.diagnosticReporter.atNode(
           nameNode,
           CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
           arguments: [enclosingElement.displayName],
@@ -205,7 +205,7 @@
       }
     } else if (enclosingElement is ExtensionElement &&
         enclosingElement.name3 == null) {
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         nameNode,
         CompileTimeErrorCode
             .INSTANCE_ACCESS_TO_STATIC_MEMBER_OF_UNNAMED_EXTENSION,
@@ -214,7 +214,7 @@
     } else {
       // It is safe to assume that `enclosingElement.name` is non-`null` because
       // it can only be `null` for extensions, and we handle that case above.
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         nameNode,
         CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER,
         arguments: [
@@ -280,7 +280,7 @@
       if (_resolver.isConstructorTearoffsEnabled) {
         // Only report constructor tearoff-related errors if the constructor
         // tearoff feature is enabled.
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node.function,
           CompileTimeErrorCode.DISALLOWED_TYPE_INSTANTIATION_EXPRESSION,
         );
@@ -355,7 +355,7 @@
     if (_resolver.isConstructorTearoffsEnabled) {
       // Only report constructor tearoff-related errors if the constructor
       // tearoff feature is enabled.
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node.function,
         CompileTimeErrorCode.DISALLOWED_TYPE_INSTANTIATION_EXPRESSION,
       );
@@ -381,7 +381,7 @@
     }
 
     if (member.isStatic) {
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         function.propertyName,
         CompileTimeErrorCode.EXTENSION_OVERRIDE_ACCESS_TO_STATIC_MEMBER,
       );
@@ -389,7 +389,7 @@
     }
 
     if (function.isCascaded) {
-      _resolver.errorReporter.atToken(
+      _resolver.diagnosticReporter.atToken(
         override.name,
         CompileTimeErrorCode.EXTENSION_OVERRIDE_WITH_CASCADE,
       );
@@ -443,7 +443,7 @@
     var prefixElement = function.prefix.scopeLookupResult!.getter2;
 
     if (prefixElement == null) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         function.prefix,
         CompileTimeErrorCode.UNDEFINED_IDENTIFIER,
         arguments: [function.name],
@@ -467,7 +467,7 @@
     if (prefixElement is PrefixElement) {
       var functionElement = prefixElement.scope.lookup(functionName).getter2;
       if (functionElement == null) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           function.identifier,
           CompileTimeErrorCode.UNDEFINED_PREFIXED_NAME,
           arguments: [functionName, function.prefix.name],
@@ -512,7 +512,7 @@
     if (propertyType != null) {
       // If the property is unknown, [UNDEFINED_GETTER] is reported elsewhere.
       // If it is known, we must report the bad type instantiation here.
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         function.identifier,
         CompileTimeErrorCode.DISALLOWED_TYPE_INSTANTIATION_EXPRESSION,
       );
@@ -562,7 +562,7 @@
     } else {
       var targetType = target.staticType;
       if (targetType is DynamicType) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.GENERIC_METHOD_TYPE_INSTANTIATION_ON_DYNAMIC,
         );
@@ -589,7 +589,7 @@
       } else if (functionType != null) {
         // If the property is unknown, [UNDEFINED_GETTER] is reported elsewhere.
         // If it is known, we must report the bad type instantiation here.
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           function.propertyName,
           CompileTimeErrorCode.DISALLOWED_TYPE_INSTANTIATION_EXPRESSION,
         );
@@ -710,7 +710,7 @@
         if (enclosingExtension != null) {
           receiverType = enclosingExtension.extendedType;
         } else {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             function,
             CompileTimeErrorCode.UNDEFINED_IDENTIFIER,
             arguments: [function.name],
@@ -760,7 +760,7 @@
         _resolve(node: node, rawType: method.type, name: function.name);
         return;
       } else {
-        _resolver.errorReporter.atNode(
+        _resolver.diagnosticReporter.atNode(
           function,
           CompileTimeErrorCode.UNDEFINED_METHOD,
           arguments: [function.name, receiverType],
diff --git a/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
index 6f1ca34..c8d4e69 100644
--- a/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/instance_creation_expression_resolver.dart
@@ -84,7 +84,7 @@
             when element.isAccessibleIn2(_resolver.definingLibrary)) {
           node.element = element;
         } else {
-          _resolver.errorReporter.atNode(
+          _resolver.diagnosticReporter.atNode(
             node.constructorName,
             CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR,
             arguments: [contextType, node.constructorName.name],
@@ -96,13 +96,13 @@
       if (contextElement is ClassElementImpl2 && contextElement.isAbstract) {
         var constructorElement = node.element;
         if (constructorElement != null && !constructorElement.isFactory) {
-          _resolver.errorReporter.atNode(
+          _resolver.diagnosticReporter.atNode(
             node,
             CompileTimeErrorCode.INSTANTIATE_ABSTRACT_CLASS,
           );
         }
       } else if (typeArguments != null) {
-        _resolver.errorReporter.atNode(
+        _resolver.diagnosticReporter.atNode(
           typeArguments,
           CompileTimeErrorCode
               .WRONG_NUMBER_OF_TYPE_ARGUMENTS_DOT_SHORTHAND_CONSTRUCTOR,
@@ -113,7 +113,7 @@
         );
       }
     } else {
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         node,
         CompileTimeErrorCode.DOT_SHORTHAND_MISSING_CONTEXT,
       );
diff --git a/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart b/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
index e959df8..11a36a8 100644
--- a/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/invocation_inference_helper.dart
@@ -64,18 +64,18 @@
 
 class InvocationInferenceHelper {
   final ResolverVisitor _resolver;
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
   final TypeSystemImpl _typeSystem;
   final bool _genericMetadataIsEnabled;
   final TypeConstraintGenerationDataForTesting? dataForTesting;
 
   InvocationInferenceHelper({
     required ResolverVisitor resolver,
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
     required TypeSystemImpl typeSystem,
     required this.dataForTesting,
   }) : _resolver = resolver,
-       _errorReporter = errorReporter,
+       _diagnosticReporter = diagnosticReporter,
        _typeSystem = typeSystem,
        _genericMetadataIsEnabled = resolver.definingLibrary.featureSet
            .isEnabled(Feature.generic_metadata);
@@ -137,7 +137,7 @@
       var typeArguments = _typeSystem.inferFunctionTypeInstantiation(
         contextType,
         tearOffType,
-        errorReporter: _errorReporter,
+        diagnosticReporter: _diagnosticReporter,
         errorNode: expression,
         genericMetadataIsEnabled: _genericMetadataIsEnabled,
         inferenceUsingBoundsIsEnabled: _resolver.inferenceUsingBoundsIsEnabled,
diff --git a/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart b/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
index 1d37e3d..ad2100d 100644
--- a/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
@@ -278,7 +278,7 @@
               bound = substitution.substituteType(bound);
               var typeArgument = typeArgumentTypes[i];
               if (!resolver.typeSystem.isSubtypeOf(typeArgument, bound)) {
-                resolver.errorReporter.atNode(
+                resolver.diagnosticReporter.atNode(
                   typeArgumentList.arguments[i],
                   CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
                   arguments: [typeArgument, typeParameter.name3!, bound],
@@ -312,7 +312,7 @@
         declaredReturnType: rawType.returnType,
         contextReturnType: contextType,
         isConst: _isConst,
-        errorReporter: resolver.errorReporter,
+        diagnosticReporter: resolver.diagnosticReporter,
         errorEntity: _errorEntity,
         genericMetadataIsEnabled: resolver.genericMetadataIsEnabled,
         inferenceUsingBoundsIsEnabled: resolver.inferenceUsingBoundsIsEnabled,
@@ -383,7 +383,7 @@
           ResolverVisitor.resolveArgumentsToParameters(
             argumentList: argumentList,
             formalParameters: parameters,
-            errorReporter: resolver.errorReporter,
+            diagnosticReporter: resolver.diagnosticReporter,
           );
     }
     var returnType = _refineReturnType(
@@ -419,7 +419,7 @@
     FunctionType rawType,
     List<TypeParameterElement> typeParameters,
   ) {
-    resolver.errorReporter.atNode(
+    resolver.diagnosticReporter.atNode(
       typeArgumentList,
       _wrongNumberOfTypeArgumentsErrorCode,
       arguments: [
diff --git a/pkg/analyzer/lib/src/dart/resolver/list_pattern_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/list_pattern_resolver.dart
index 1b305a9..62d170f 100644
--- a/pkg/analyzer/lib/src/dart/resolver/list_pattern_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/list_pattern_resolver.dart
@@ -24,7 +24,7 @@
       // Check that we have exactly one type argument.
       var length = typeArguments.arguments.length;
       if (length != 1) {
-        resolverVisitor.errorReporter.atNode(
+        resolverVisitor.diagnosticReporter.atNode(
           typeArguments,
           CompileTimeErrorCode.EXPECTED_ONE_LIST_PATTERN_TYPE_ARGUMENTS,
           arguments: [length],
diff --git a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
index df7f62b..28bee62 100644
--- a/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/method_invocation_resolver.dart
@@ -74,7 +74,7 @@
        _inferenceHelper = inferenceHelper;
 
   @override
-  ErrorReporter get errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get diagnosticReporter => _resolver.diagnosticReporter;
 
   TypeSystemImpl get _typeSystem => _resolver.typeSystem;
 
@@ -226,7 +226,7 @@
       // There is no possible resolution for a property access of a function
       // type literal (which can only be a type instantiation of a type alias
       // of a function type).
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         nameNode,
         CompileTimeErrorCode.UNDEFINED_METHOD_ON_FUNCTION_TYPE,
         arguments: [name, receiver.type.qualifiedName],
@@ -285,7 +285,7 @@
       );
     }
 
-    _resolver.errorReporter.atNode(
+    _resolver.diagnosticReporter.atNode(
       node.memberName,
       CompileTimeErrorCode.DOT_SHORTHAND_UNDEFINED_INVOCATION,
       arguments: [node.memberName.name, contextType.getDisplayString()],
@@ -320,14 +320,14 @@
     var enclosingElement = element.enclosingElement!;
     if (nullReceiver) {
       if (_resolver.enclosingExtension != null) {
-        _resolver.errorReporter.atNode(
+        _resolver.diagnosticReporter.atNode(
           nameNode,
           CompileTimeErrorCode
               .UNQUALIFIED_REFERENCE_TO_STATIC_MEMBER_OF_EXTENDED_TYPE,
           arguments: [enclosingElement.displayString2()],
         );
       } else {
-        _resolver.errorReporter.atNode(
+        _resolver.diagnosticReporter.atNode(
           nameNode,
           CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
           arguments: [enclosingElement.displayString2()],
@@ -335,7 +335,7 @@
       }
     } else if (enclosingElement is ExtensionElement &&
         enclosingElement.name3 == null) {
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         nameNode,
         CompileTimeErrorCode
             .INSTANCE_ACCESS_TO_STATIC_MEMBER_OF_UNNAMED_EXTENSION,
@@ -344,7 +344,7 @@
     } else {
       // It is safe to assume that `enclosingElement.name` is non-`null` because
       // it can only be `null` for extensions, and we handle that case above.
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         nameNode,
         CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER,
         arguments: [
@@ -360,7 +360,7 @@
   }
 
   void _reportInvocationOfNonFunction(SimpleIdentifierImpl methodName) {
-    _resolver.errorReporter.atNode(
+    _resolver.diagnosticReporter.atNode(
       methodName,
       CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION,
       arguments: [methodName.name],
@@ -368,7 +368,7 @@
   }
 
   void _reportPrefixIdentifierNotFollowedByDot(SimpleIdentifier target) {
-    _resolver.errorReporter.atNode(
+    _resolver.diagnosticReporter.atNode(
       target,
       CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT,
       arguments: [target.name],
@@ -380,7 +380,7 @@
     SimpleIdentifier nameNode,
   ) {
     if (!element.isStatic) {
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         nameNode,
         CompileTimeErrorCode.STATIC_ACCESS_TO_INSTANCE_MEMBER,
         arguments: [nameNode.name],
@@ -405,7 +405,7 @@
       return;
     }
 
-    _resolver.errorReporter.atNode(
+    _resolver.diagnosticReporter.atNode(
       node.methodName,
       CompileTimeErrorCode.UNDEFINED_FUNCTION,
       arguments: [node.methodName.name],
@@ -419,7 +419,7 @@
     if (methodName.name == 'new') {
       // Attempting to invoke the unnamed constructor via `C.new(`.
       if (_resolver.isConstructorTearoffsEnabled) {
-        _resolver.errorReporter.atNode(
+        _resolver.diagnosticReporter.atNode(
           methodName,
           CompileTimeErrorCode.NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT,
           arguments: [receiver.displayName],
@@ -429,7 +429,7 @@
         // Do not report extra errors.
       }
     } else {
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         methodName,
         CompileTimeErrorCode.UNDEFINED_METHOD,
         arguments: [methodName.name, receiver.displayName],
@@ -438,7 +438,7 @@
   }
 
   void _reportUseOfVoidType(AstNode errorNode) {
-    _resolver.errorReporter.atNode(
+    _resolver.diagnosticReporter.atNode(
       errorNode,
       CompileTimeErrorCode.USE_OF_VOID_RESULT,
     );
@@ -545,7 +545,7 @@
     );
     // This method is only called for named extensions, so we know that
     // `extension.name` is non-`null`.
-    _resolver.errorReporter.atNode(
+    _resolver.diagnosticReporter.atNode(
       nameNode,
       CompileTimeErrorCode.UNDEFINED_EXTENSION_METHOD,
       arguments: [name, extension.name3!],
@@ -577,7 +577,7 @@
       );
       // Extension overrides always refer to named extensions, so we can safely
       // assume `override.staticElement!.name` is non-`null`.
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         nameNode,
         CompileTimeErrorCode.UNDEFINED_EXTENSION_METHOD,
         arguments: [name, override.element2.name3!],
@@ -586,7 +586,7 @@
     }
 
     if (member.isStatic) {
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         nameNode,
         CompileTimeErrorCode.EXTENSION_OVERRIDE_ACCESS_TO_STATIC_MEMBER,
       );
@@ -594,7 +594,7 @@
 
     if (node.isCascaded) {
       // Report this error and recover by treating it like a non-cascade.
-      _resolver.errorReporter.atToken(
+      _resolver.diagnosticReporter.atToken(
         override.name,
         CompileTimeErrorCode.EXTENSION_OVERRIDE_WITH_CASCADE,
       );
@@ -722,7 +722,7 @@
         whyNotPromotedArguments: whyNotPromotedArguments,
       ).resolveInvocation(rawType: null);
 
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         receiver,
         WarningCode.RECEIVER_OF_TYPE_NEVER,
       );
@@ -855,7 +855,7 @@
           FunctionType() => 'Function',
           _ => '<unknown>',
         };
-        _resolver.errorReporter.atNode(
+        _resolver.diagnosticReporter.atNode(
           nameNode,
           CompileTimeErrorCode.UNDEFINED_METHOD,
           arguments: [name, receiverTypeName],
@@ -1029,7 +1029,7 @@
         contextType: contextType,
       );
 
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         nameNode,
         CompileTimeErrorCode.ABSTRACT_SUPER_MEMBER_REFERENCE,
         arguments: [target.kind.displayName, name],
@@ -1043,7 +1043,7 @@
       whyNotPromotedArguments: whyNotPromotedArguments,
       contextType: contextType,
     );
-    _resolver.errorReporter.atNode(
+    _resolver.diagnosticReporter.atNode(
       nameNode,
       CompileTimeErrorCode.UNDEFINED_SUPER_METHOD,
       arguments: [name, enclosingClass.firstFragment.displayName],
@@ -1167,7 +1167,7 @@
     }
 
     if (!nameNode.isSynthetic) {
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         nameNode,
         CompileTimeErrorCode.UNDEFINED_METHOD,
         arguments: [name, receiverClassName],
@@ -1273,7 +1273,7 @@
           contextType: contextType,
         );
       } else {
-        _resolver.errorReporter.atNode(
+        _resolver.diagnosticReporter.atNode(
           nameNode,
           CompileTimeErrorCode.DOT_SHORTHAND_UNDEFINED_INVOCATION,
           arguments: [nameNode.name, receiver.displayName],
@@ -1305,7 +1305,7 @@
       return replacement;
     }
 
-    _resolver.errorReporter.atNode(
+    _resolver.diagnosticReporter.atNode(
       nameNode,
       CompileTimeErrorCode.DOT_SHORTHAND_UNDEFINED_INVOCATION,
       arguments: [nameNode.name, receiver.displayName],
diff --git a/pkg/analyzer/lib/src/dart/resolver/named_type_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/named_type_resolver.dart
index 7339156..7305468 100644
--- a/pkg/analyzer/lib/src/dart/resolver/named_type_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/named_type_resolver.dart
@@ -33,7 +33,7 @@
   final bool strictInference;
 
   @override
-  final ErrorReporter errorReporter;
+  final DiagnosticReporter diagnosticReporter;
 
   late Scope nameScope;
 
@@ -65,7 +65,7 @@
   NamedTypeResolver(
     LibraryElementImpl libraryElement,
     this._libraryFragment,
-    this.errorReporter, {
+    this.diagnosticReporter, {
     required this.strictInference,
     required this.strictCasts,
     required this.typeSystemOperations,
@@ -118,7 +118,7 @@
         return;
       }
 
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         prefixToken,
         CompileTimeErrorCode.PREFIX_SHADOWED_BY_LOCAL_DECLARATION,
         arguments: [prefixName],
@@ -145,7 +145,7 @@
     var argumentCount = arguments.length;
 
     if (argumentCount != parameterCount) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         node,
         CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS,
         arguments: [node.name.lexeme, parameterCount, argumentCount],
@@ -238,7 +238,7 @@
         );
         return _verifyTypeAliasForContext(node, element, type);
       } else if (_isInstanceCreation(node)) {
-        _ErrorHelper(errorReporter).reportNewWithNonType(node);
+        _ErrorHelper(diagnosticReporter).reportNewWithNonType(node);
         return InvalidTypeImpl.instance;
       } else if (element is DynamicElementImpl2) {
         _buildTypeArguments(node, argumentList, 0);
@@ -250,7 +250,9 @@
         _buildTypeArguments(node, argumentList, 0);
         return element.instantiate(nullabilitySuffix: nullability);
       } else {
-        _ErrorHelper(errorReporter).reportNullOrNonTypeElement(node, element);
+        _ErrorHelper(
+          diagnosticReporter,
+        ).reportNullOrNonTypeElement(node, element);
         return InvalidTypeImpl.instance;
       }
     }
@@ -283,7 +285,7 @@
       );
       return _verifyTypeAliasForContext(node, element, type);
     } else if (_isInstanceCreation(node)) {
-      _ErrorHelper(errorReporter).reportNewWithNonType(node);
+      _ErrorHelper(diagnosticReporter).reportNewWithNonType(node);
       return InvalidTypeImpl.instance;
     } else if (element is DynamicElementImpl2) {
       return DynamicTypeImpl.instance;
@@ -292,7 +294,9 @@
     } else if (element is TypeParameterElementImpl2) {
       return element.instantiate(nullabilitySuffix: nullability);
     } else {
-      _ErrorHelper(errorReporter).reportNullOrNonTypeElement(node, element);
+      _ErrorHelper(
+        diagnosticReporter,
+      ).reportNullOrNonTypeElement(node, element);
       return InvalidTypeImpl.instance;
     }
   }
@@ -320,7 +324,7 @@
     if (element == null) {
       node.type = InvalidTypeImpl.instance;
       if (!_libraryFragment.shouldIgnoreUndefinedNamedType(node)) {
-        _ErrorHelper(errorReporter).reportNullOrNonTypeElement(node, null);
+        _ErrorHelper(diagnosticReporter).reportNullOrNonTypeElement(node, null);
       }
       return;
     }
@@ -353,7 +357,7 @@
         constructorName.name == null) {
       var typeArguments = node.typeArguments;
       if (typeArguments != null) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           typeArguments,
           CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR,
           arguments: [importPrefix.name.lexeme, nameToken.lexeme],
@@ -384,7 +388,7 @@
 
     if (_isInstanceCreation(node)) {
       node.type = InvalidTypeImpl.instance;
-      _ErrorHelper(errorReporter).reportNewWithNonType(node);
+      _ErrorHelper(diagnosticReporter).reportNewWithNonType(node);
     } else {
       node.type = InvalidTypeImpl.instance;
       Element? element = importPrefixElement;
@@ -402,7 +406,7 @@
       var fragment = element?.firstFragment;
       var source = fragment?.libraryFragment?.source;
       var nameOffset = fragment?.nameOffset2;
-      errorReporter.atOffset(
+      diagnosticReporter.atOffset(
         offset: importPrefix.offset,
         length: nameToken.end - importPrefix.offset,
         diagnosticCode: CompileTimeErrorCode.NOT_A_TYPE,
@@ -430,22 +434,22 @@
       if (type.nullabilitySuffix == NullabilitySuffix.question) {
         var parent = node.parent;
         if (parent is ExtendsClause || parent is ClassTypeAlias) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             node,
             CompileTimeErrorCode.NULLABLE_TYPE_IN_EXTENDS_CLAUSE,
           );
         } else if (parent is ImplementsClause) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             node,
             CompileTimeErrorCode.NULLABLE_TYPE_IN_IMPLEMENTS_CLAUSE,
           );
         } else if (parent is MixinOnClause) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             node,
             CompileTimeErrorCode.NULLABLE_TYPE_IN_ON_CLAUSE,
           );
         } else if (parent is WithClause) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             node,
             CompileTimeErrorCode.NULLABLE_TYPE_IN_WITH_CLAUSE,
           );
@@ -469,7 +473,7 @@
         var errorRange = _ErrorHelper._getErrorRange(node);
         var constructorUsage = parent.parent;
         if (constructorUsage is InstanceCreationExpression) {
-          errorReporter.atOffset(
+          diagnosticReporter.atOffset(
             offset: errorRange.offset,
             length: errorRange.length,
             diagnosticCode:
@@ -478,7 +482,7 @@
           );
         } else if (constructorUsage is ConstructorDeclaration &&
             constructorUsage.redirectedConstructor == parent) {
-          errorReporter.atOffset(
+          diagnosticReporter.atOffset(
             offset: errorRange.offset,
             length: errorRange.length,
             diagnosticCode:
@@ -509,7 +513,7 @@
       }
       if (diagnosticCode != null) {
         var errorRange = _ErrorHelper._getErrorRange(node);
-        errorReporter.atOffset(
+        diagnosticReporter.atOffset(
           offset: errorRange.offset,
           length: errorRange.length,
           diagnosticCode: diagnosticCode,
@@ -519,7 +523,7 @@
       }
     }
     if (type is! InterfaceType && _isInstanceCreation(node)) {
-      _ErrorHelper(errorReporter).reportNewWithNonType(node);
+      _ErrorHelper(diagnosticReporter).reportNewWithNonType(node);
       return InvalidTypeImpl.instance;
     }
     return type;
@@ -532,11 +536,11 @@
   }
 }
 
-/// Helper for reporting errors during type name resolution.
+/// Helper for reporting diagnostics during type name resolution.
 class _ErrorHelper {
-  final ErrorReporter errorReporter;
+  final DiagnosticReporter diagnosticReporter;
 
-  _ErrorHelper(this.errorReporter);
+  _ErrorHelper(this.diagnosticReporter);
 
   bool reportNewWithNonType(NamedType node) {
     var constructorName = node.parent;
@@ -544,7 +548,7 @@
       var instanceCreation = constructorName.parent;
       if (instanceCreation is InstanceCreationExpression) {
         var errorRange = _getErrorRange(node, skipImportPrefix: true);
-        errorReporter.atOffset(
+        diagnosticReporter.atOffset(
           offset: errorRange.offset,
           length: errorRange.length,
           diagnosticCode:
@@ -566,7 +570,7 @@
 
     if (node.name.lexeme == 'boolean') {
       var errorRange = _getErrorRange(node, skipImportPrefix: true);
-      errorReporter.atOffset(
+      diagnosticReporter.atOffset(
         offset: errorRange.offset,
         length: errorRange.length,
         diagnosticCode: CompileTimeErrorCode.UNDEFINED_CLASS_BOOLEAN,
@@ -577,7 +581,7 @@
 
     if (_isTypeInCatchClause(node)) {
       var errorRange = _getErrorRange(node);
-      errorReporter.atOffset(
+      diagnosticReporter.atOffset(
         offset: errorRange.offset,
         length: errorRange.length,
         diagnosticCode: CompileTimeErrorCode.NON_TYPE_IN_CATCH_CLAUSE,
@@ -588,7 +592,7 @@
 
     if (_isTypeInAsExpression(node)) {
       var errorRange = _getErrorRange(node);
-      errorReporter.atOffset(
+      diagnosticReporter.atOffset(
         offset: errorRange.offset,
         length: errorRange.length,
         diagnosticCode: CompileTimeErrorCode.CAST_TO_NON_TYPE,
@@ -600,14 +604,14 @@
     if (_isTypeInIsExpression(node)) {
       var errorRange = _getErrorRange(node);
       if (element != null) {
-        errorReporter.atOffset(
+        diagnosticReporter.atOffset(
           offset: errorRange.offset,
           length: errorRange.length,
           diagnosticCode: CompileTimeErrorCode.TYPE_TEST_WITH_NON_TYPE,
           arguments: [node.name.lexeme],
         );
       } else {
-        errorReporter.atOffset(
+        diagnosticReporter.atOffset(
           offset: errorRange.offset,
           length: errorRange.length,
           diagnosticCode: CompileTimeErrorCode.TYPE_TEST_WITH_UNDEFINED_NAME,
@@ -619,7 +623,7 @@
 
     if (_isRedirectingConstructor(node)) {
       var errorRange = _getErrorRange(node);
-      errorReporter.atOffset(
+      diagnosticReporter.atOffset(
         offset: errorRange.offset,
         length: errorRange.length,
         diagnosticCode: CompileTimeErrorCode.REDIRECT_TO_NON_CLASS,
@@ -630,7 +634,7 @@
 
     if (_isTypeInTypeArgumentList(node)) {
       var errorRange = _getErrorRange(node);
-      errorReporter.atOffset(
+      diagnosticReporter.atOffset(
         offset: errorRange.offset,
         length: errorRange.length,
         diagnosticCode: CompileTimeErrorCode.NON_TYPE_AS_TYPE_ARGUMENT,
@@ -653,9 +657,9 @@
     }
 
     if (element is LocalVariableElement || element is LocalFunctionElement) {
-      errorReporter.reportError(
+      diagnosticReporter.reportError(
         DiagnosticFactory().referencedBeforeDeclaration(
-          errorReporter.source,
+          diagnosticReporter.source,
           nameToken: node.name,
           element2: element!,
         ),
@@ -669,7 +673,7 @@
       var fragment = element.firstFragment;
       var source = fragment.libraryFragment?.source;
       var nameOffset = fragment.nameOffset2;
-      errorReporter.atOffset(
+      diagnosticReporter.atOffset(
         offset: errorRange.offset,
         length: errorRange.length,
         diagnosticCode: CompileTimeErrorCode.NOT_A_TYPE,
@@ -689,7 +693,7 @@
     }
 
     if (node.importPrefix == null && node.name.lexeme == 'await') {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         node,
         CompileTimeErrorCode.UNDEFINED_IDENTIFIER_AWAIT,
       );
@@ -697,7 +701,7 @@
     }
 
     var errorRange = _getErrorRange(node);
-    errorReporter.atOffset(
+    diagnosticReporter.atOffset(
       offset: errorRange.offset,
       length: errorRange.length,
       diagnosticCode: CompileTimeErrorCode.UNDEFINED_CLASS,
diff --git a/pkg/analyzer/lib/src/dart/resolver/postfix_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/postfix_expression_resolver.dart
index 2877c8e..d30184d 100644
--- a/pkg/analyzer/lib/src/dart/resolver/postfix_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/postfix_expression_resolver.dart
@@ -31,7 +31,7 @@
       _typePropertyResolver = resolver.typePropertyResolver,
       _assignmentShared = AssignmentExpressionShared(resolver: resolver);
 
-  ErrorReporter get _errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get _diagnosticReporter => _resolver.diagnosticReporter;
 
   TypeSystemImpl get _typeSystem => _resolver.typeSystem;
 
@@ -84,7 +84,7 @@
       operandWriteType,
       strictCasts: _resolver.analysisOptions.strictCasts,
     )) {
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         node,
         CompileTimeErrorCode.INVALID_ASSIGNMENT,
         arguments: [type, operandWriteType],
@@ -131,7 +131,7 @@
     ExpressionImpl operand = node.operand;
 
     if (identical(receiverType, NeverTypeImpl.instance)) {
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         operand,
         WarningCode.RECEIVER_OF_TYPE_NEVER,
       );
@@ -151,13 +151,13 @@
     node.element = result.getter2 as MethodElement?;
     if (result.needsGetterError) {
       if (operand is SuperExpression) {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           node.operator,
           CompileTimeErrorCode.UNDEFINED_SUPER_OPERATOR,
           arguments: [methodName, receiverType],
         );
       } else {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           node.operator,
           CompileTimeErrorCode.UNDEFINED_OPERATOR,
           arguments: [methodName, receiverType],
@@ -215,7 +215,7 @@
     var operand = node.operand;
 
     if (operand is SuperExpression) {
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         node,
         ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR,
       );
diff --git a/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart
index a6ac734..1627a23 100644
--- a/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/prefix_expression_resolver.dart
@@ -31,7 +31,7 @@
       _typePropertyResolver = resolver.typePropertyResolver,
       _assignmentShared = AssignmentExpressionShared(resolver: resolver);
 
-  ErrorReporter get _errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get _diagnosticReporter => _resolver.diagnosticReporter;
 
   TypeProviderImpl get _typeProvider => _resolver.typeProvider;
 
@@ -102,7 +102,7 @@
       operandWriteType,
       strictCasts: _resolver.analysisOptions.strictCasts,
     )) {
-      _resolver.errorReporter.atNode(
+      _resolver.diagnosticReporter.atNode(
         node,
         CompileTimeErrorCode.INVALID_ASSIGNMENT,
         arguments: [type, operandWriteType],
@@ -160,7 +160,7 @@
         if (member == null) {
           // Extension overrides always refer to named extensions, so we can
           // safely assume `element.name` is non-`null`.
-          _errorReporter.atToken(
+          _diagnosticReporter.atToken(
             node.operator,
             CompileTimeErrorCode.UNDEFINED_EXTENSION_OPERATOR,
             arguments: [methodName, element.name3!],
@@ -175,7 +175,7 @@
         return;
       }
       if (identical(readType, NeverTypeImpl.instance)) {
-        _resolver.errorReporter.atNode(
+        _resolver.diagnosticReporter.atNode(
           operand,
           WarningCode.RECEIVER_OF_TYPE_NEVER,
         );
@@ -194,13 +194,13 @@
       node.element = result.getter2 as MethodElement?;
       if (result.needsGetterError) {
         if (operand is SuperExpression) {
-          _errorReporter.atToken(
+          _diagnosticReporter.atToken(
             operator,
             CompileTimeErrorCode.UNDEFINED_SUPER_OPERATOR,
             arguments: [methodName, readType],
           );
         } else {
-          _errorReporter.atToken(
+          _diagnosticReporter.atToken(
             operator,
             CompileTimeErrorCode.UNDEFINED_OPERATOR,
             arguments: [methodName, readType],
diff --git a/pkg/analyzer/lib/src/dart/resolver/prefixed_identifier_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/prefixed_identifier_resolver.dart
index f1636da..4aee917 100644
--- a/pkg/analyzer/lib/src/dart/resolver/prefixed_identifier_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/prefixed_identifier_resolver.dart
@@ -179,7 +179,7 @@
       return;
     }
 
-    _resolver.errorReporter.atNode(
+    _resolver.diagnosticReporter.atNode(
       node,
       CompileTimeErrorCode.EXTENSION_AS_EXPRESSION,
       arguments: [node.name],
diff --git a/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
index 18cb257..9cb7e55 100644
--- a/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/property_element_resolver.dart
@@ -31,7 +31,7 @@
   PropertyElementResolver(this._resolver);
 
   @override
-  ErrorReporter get errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get diagnosticReporter => _resolver.diagnosticReporter;
 
   LibraryElementImpl get _definingLibrary => _resolver.definingLibrary;
 
@@ -70,7 +70,7 @@
           var enclosingElement = element.enclosingElement;
           if (enclosingElement is ClassElementImpl2 &&
               enclosingElement.isAbstract) {
-            _resolver.errorReporter.atNode(
+            _resolver.diagnosticReporter.atNode(
               node,
               CompileTimeErrorCode
                   .TEAROFF_OF_GENERATIVE_CONSTRUCTOR_OF_ABSTRACT_CLASS,
@@ -125,7 +125,7 @@
       );
     }
 
-    errorReporter.atNode(
+    diagnosticReporter.atNode(
       node,
       CompileTimeErrorCode.DOT_SHORTHAND_MISSING_CONTEXT,
     );
@@ -186,7 +186,7 @@
 
     if (identical(targetType, NeverTypeImpl.instance)) {
       // TODO(scheglov): Report directly in TypePropertyResolver?
-      errorReporter.atNode(target, WarningCode.RECEIVER_OF_TYPE_NEVER);
+      diagnosticReporter.atNode(target, WarningCode.RECEIVER_OF_TYPE_NEVER);
       return PropertyElementResolverResult();
     }
 
@@ -379,7 +379,7 @@
       writeElementRequested = writeLookup?.requested;
       writeElementRecovery = writeLookup?.recovery;
 
-      AssignmentVerifier(errorReporter).verify(
+      AssignmentVerifier(diagnosticReporter).verify(
         node: node,
         requested: writeElementRequested,
         recovery: writeElementRecovery,
@@ -405,7 +405,7 @@
   ) {
     if (element.isStatic) return false;
 
-    errorReporter.atNode(
+    diagnosticReporter.atNode(
       identifier,
       CompileTimeErrorCode.STATIC_ACCESS_TO_INSTANCE_MEMBER,
       arguments: [identifier.name],
@@ -420,7 +420,7 @@
   ) {
     if (element != null && element.isStatic) {
       if (target is ExtensionOverride) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           propertyName,
           CompileTimeErrorCode.EXTENSION_OVERRIDE_ACCESS_TO_STATIC_MEMBER,
         );
@@ -428,7 +428,7 @@
         var enclosingElement = element.enclosingElement;
         if (enclosingElement is ExtensionElement &&
             enclosingElement.name3 == null) {
-          _resolver.errorReporter.atNode(
+          _resolver.diagnosticReporter.atNode(
             propertyName,
             CompileTimeErrorCode
                 .INSTANCE_ACCESS_TO_STATIC_MEMBER_OF_UNNAMED_EXTENSION,
@@ -438,7 +438,7 @@
           // It is safe to assume that `enclosingElement.name` is non-`null`
           // because it can only be `null` for extensions, and we handle that
           // case above.
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             propertyName,
             CompileTimeErrorCode.INSTANCE_ACCESS_TO_STATIC_MEMBER,
             arguments: [
@@ -469,7 +469,7 @@
     var offset = leftBracket.offset;
     var length = rightBracket.end - offset;
 
-    errorReporter.atOffset(
+    diagnosticReporter.atOffset(
       offset: offset,
       length: length,
       diagnosticCode: diagnosticCode,
@@ -542,7 +542,7 @@
     }
 
     if (targetType is VoidType) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         propertyName,
         CompileTimeErrorCode.USE_OF_VOID_RESULT,
       );
@@ -558,13 +558,13 @@
       // type literal (which can only be a type instantiation of a type alias
       // of a function type).
       if (hasRead) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           propertyName,
           CompileTimeErrorCode.UNDEFINED_GETTER_ON_FUNCTION_TYPE,
           arguments: [propertyName.name, target.type.qualifiedName],
         );
       } else {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           propertyName,
           CompileTimeErrorCode.UNDEFINED_SETTER_ON_FUNCTION_TYPE,
           arguments: [propertyName.name, target.type.qualifiedName],
@@ -607,7 +607,7 @@
 
       _checkForStaticMember(target, propertyName, result.getter2);
       if (result.needsGetterError) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           propertyName,
           CompileTimeErrorCode.UNDEFINED_GETTER,
           arguments: [propertyName.name, targetType],
@@ -628,7 +628,7 @@
           nameErrorEntity: propertyName,
         );
 
-        AssignmentVerifier(errorReporter).verify(
+        AssignmentVerifier(diagnosticReporter).verify(
           node: propertyName,
           requested: null,
           recovery: readResult.getter2,
@@ -667,7 +667,7 @@
         // This method is only called for extension overrides, and extension
         // overrides can only refer to named extensions.  So it is safe to
         // assume that `extension.name` is non-`null`.
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           propertyName,
           CompileTimeErrorCode.UNDEFINED_EXTENSION_GETTER,
           arguments: [memberName, extension.name3!],
@@ -687,7 +687,7 @@
       writeElement = extension.getSetter(memberName);
 
       if (writeElement == null) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           propertyName,
           CompileTimeErrorCode.UNDEFINED_EXTENSION_SETTER,
           arguments: [memberName, extension.name3!],
@@ -717,7 +717,7 @@
   }) {
     if (target.parent is CascadeExpression) {
       // Report this error and recover by treating it like a non-cascade.
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         target.name,
         CompileTimeErrorCode.EXTENSION_OVERRIDE_WITH_CASCADE,
       );
@@ -736,7 +736,7 @@
         // This method is only called for extension overrides, and extension
         // overrides can only refer to named extensions.  So it is safe to
         // assume that `element.name` is non-`null`.
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           propertyName,
           CompileTimeErrorCode.UNDEFINED_EXTENSION_GETTER,
           arguments: [memberName, element.name3!],
@@ -754,7 +754,7 @@
         // This method is only called for extension overrides, and extension
         // overrides can only refer to named extensions.  So it is safe to
         // assume that `element.name` is non-`null`.
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           propertyName,
           CompileTimeErrorCode.UNDEFINED_EXTENSION_SETTER,
           arguments: [memberName, element.name3!],
@@ -808,7 +808,7 @@
         if (resolvingDotShorthand) {
           // We didn't resolve to any static getter or static field using the
           // context type.
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             propertyName,
             CompileTimeErrorCode.DOT_SHORTHAND_UNDEFINED_GETTER,
             arguments: [propertyName.name, typeReference.name3!],
@@ -818,7 +818,7 @@
               typeReference is EnumElement
                   ? CompileTimeErrorCode.UNDEFINED_ENUM_CONSTANT
                   : CompileTimeErrorCode.UNDEFINED_GETTER;
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             propertyName,
             code,
             arguments: [propertyName.name, typeReference.name3!],
@@ -833,7 +833,7 @@
       writeElement = typeReference.getSetter(propertyName.name);
       if (writeElement != null) {
         if (!_isAccessible(writeElement)) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             propertyName,
             CompileTimeErrorCode.PRIVATE_SETTER,
             arguments: [propertyName.name],
@@ -846,7 +846,7 @@
       } else {
         // Recovery, try to use getter.
         writeElementRecovery = typeReference.getGetter(propertyName.name);
-        AssignmentVerifier(errorReporter).verify(
+        AssignmentVerifier(diagnosticReporter).verify(
           node: propertyName,
           requested: null,
           recovery: writeElementRecovery,
@@ -892,7 +892,7 @@
             prefix: target.name3,
             name: identifier.name,
           )) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           identifier,
           CompileTimeErrorCode.UNDEFINED_PREFIXED_NAME,
           arguments: [identifier.name, target.name3!],
@@ -943,13 +943,13 @@
             name,
           );
           if (readElement != null) {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               propertyName,
               CompileTimeErrorCode.ABSTRACT_SUPER_MEMBER_REFERENCE,
               arguments: [readElement.kind.displayName, propertyName.name],
             );
           } else {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               propertyName,
               CompileTimeErrorCode.UNDEFINED_SUPER_GETTER,
               arguments: [propertyName.name, targetType],
@@ -991,13 +991,13 @@
             inherited: true,
           );
           if (writeElement != null) {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               propertyName,
               CompileTimeErrorCode.ABSTRACT_SUPER_MEMBER_REFERENCE,
               arguments: [writeElement.kind.displayName, propertyName.name],
             );
           } else {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               propertyName,
               CompileTimeErrorCode.UNDEFINED_SUPER_SETTER,
               arguments: [propertyName.name, targetType],
diff --git a/pkg/analyzer/lib/src/dart/resolver/record_literal_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/record_literal_resolver.dart
index 7529d6b..fb7025b5 100644
--- a/pkg/analyzer/lib/src/dart/resolver/record_literal_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/record_literal_resolver.dart
@@ -21,7 +21,7 @@
   RecordLiteralResolver({required ResolverVisitor resolver})
     : _resolver = resolver;
 
-  ErrorReporter get errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get _diagnosticReporter => _resolver.diagnosticReporter;
 
   void resolve(RecordLiteralImpl node, {required DartType contextType}) {
     _resolveFields(node, contextType);
@@ -83,9 +83,9 @@
         var name = field.name.label.name;
         var previousField = usedNames[name];
         if (previousField != null) {
-          errorReporter.reportError(
+          _diagnosticReporter.reportError(
             DiagnosticFactory().duplicateFieldDefinitionInLiteral(
-              errorReporter.source,
+              _diagnosticReporter.source,
               field,
               previousField,
             ),
@@ -111,7 +111,7 @@
         var nameNode = field.name.label;
         var name = nameNode.name;
         if (name.startsWith('_')) {
-          errorReporter.atNode(
+          _diagnosticReporter.atNode(
             nameNode,
             CompileTimeErrorCode.INVALID_FIELD_NAME_PRIVATE,
           );
@@ -119,13 +119,13 @@
           var index = RecordTypeExtension.positionalFieldIndex(name);
           if (index != null) {
             if (index < positionalCount) {
-              errorReporter.atNode(
+              _diagnosticReporter.atNode(
                 nameNode,
                 CompileTimeErrorCode.INVALID_FIELD_NAME_POSITIONAL,
               );
             }
           } else if (isForbiddenNameForRecordField(name)) {
-            errorReporter.atNode(
+            _diagnosticReporter.atNode(
               nameNode,
               CompileTimeErrorCode.INVALID_FIELD_NAME_FROM_OBJECT,
             );
@@ -155,7 +155,10 @@
     }
 
     if (staticType is VoidType) {
-      errorReporter.atNode(field, CompileTimeErrorCode.USE_OF_VOID_RESULT);
+      _diagnosticReporter.atNode(
+        field,
+        CompileTimeErrorCode.USE_OF_VOID_RESULT,
+      );
     }
 
     return staticType;
diff --git a/pkg/analyzer/lib/src/dart/resolver/record_type_annotation_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/record_type_annotation_resolver.dart
index d20561e..d0317d9 100644
--- a/pkg/analyzer/lib/src/dart/resolver/record_type_annotation_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/record_type_annotation_resolver.dart
@@ -18,14 +18,14 @@
 /// Helper for resolving [RecordTypeAnnotation]s.
 class RecordTypeAnnotationResolver {
   final TypeProviderImpl typeProvider;
-  final ErrorReporter errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
   final LibraryElement libraryElement;
 
   RecordTypeAnnotationResolver({
     required this.typeProvider,
-    required this.errorReporter,
+    required DiagnosticReporter diagnosticReporter,
     required this.libraryElement,
-  });
+  }) : _diagnosticReporter = diagnosticReporter;
 
   bool get isWildCardVariablesEnabled =>
       libraryElement.featureSet.isEnabled(Feature.wildcard_variables);
@@ -47,9 +47,9 @@
 
         var previousField = usedNames[name];
         if (previousField != null) {
-          errorReporter.reportError(
+          _diagnosticReporter.reportError(
             DiagnosticFactory().duplicateFieldDefinitionInType(
-              errorReporter.source,
+              _diagnosticReporter.source,
               field,
               previousField,
             ),
@@ -72,7 +72,7 @@
         if (name.startsWith('_')) {
           // Positional record fields named `_` are legal w/ wildcards.
           if (!isPositionalWildCard(field, name)) {
-            errorReporter.atToken(
+            _diagnosticReporter.atToken(
               nameToken,
               CompileTimeErrorCode.INVALID_FIELD_NAME_PRIVATE,
             );
@@ -82,7 +82,7 @@
           if (index != null) {
             if (index < positionalCount &&
                 positionalFields.indexOf(field) != index) {
-              errorReporter.atToken(
+              _diagnosticReporter.atToken(
                 nameToken,
                 CompileTimeErrorCode.INVALID_FIELD_NAME_POSITIONAL,
               );
@@ -90,7 +90,7 @@
           } else if (RecordLiteralResolver.isForbiddenNameForRecordField(
             name,
           )) {
-            errorReporter.atToken(
+            _diagnosticReporter.atToken(
               nameToken,
               CompileTimeErrorCode.INVALID_FIELD_NAME_FROM_OBJECT,
             );
diff --git a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
index 279bf76..99f0bb9 100644
--- a/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/resolution_visitor.dart
@@ -73,7 +73,7 @@
   final LibraryElementImpl _libraryElement;
   final TypeProviderImpl _typeProvider;
   final LibraryFragmentImpl _unitElement;
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
   final AstRewriter _astRewriter;
   final NamedTypeResolver _namedTypeResolver;
   final RecordTypeAnnotationResolver _recordTypeResolver;
@@ -122,7 +122,7 @@
     var libraryElement = unitElement.library;
     var typeProvider = libraryElement.typeProvider;
     var unitSource = unitElement.source;
-    var errorReporter = ErrorReporter(diagnosticListener, unitSource);
+    var diagnosticReporter = DiagnosticReporter(diagnosticListener, unitSource);
 
     var typeSystemOperations = TypeSystemOperations(
       unitElement.library.typeSystem,
@@ -132,7 +132,7 @@
     var namedTypeResolver = NamedTypeResolver(
       libraryElement,
       unitElement,
-      errorReporter,
+      diagnosticReporter,
       strictInference: strictInference,
       strictCasts: strictCasts,
       typeSystemOperations: typeSystemOperations,
@@ -140,7 +140,7 @@
 
     var recordTypeResolver = RecordTypeAnnotationResolver(
       typeProvider: typeProvider,
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
       libraryElement: libraryElement,
     );
 
@@ -148,8 +148,8 @@
       libraryElement,
       typeProvider,
       unitElement,
-      errorReporter,
-      AstRewriter(errorReporter),
+      diagnosticReporter,
+      AstRewriter(diagnosticReporter),
       namedTypeResolver,
       recordTypeResolver,
       nameScope,
@@ -164,7 +164,7 @@
     this._libraryElement,
     this._typeProvider,
     this._unitElement,
-    this._errorReporter,
+    this._diagnosticReporter,
     this._astRewriter,
     this._namedTypeResolver,
     this._recordTypeResolver,
@@ -196,14 +196,14 @@
     node.element2 = element;
 
     if (element == null) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         node.name,
         CompileTimeErrorCode.UNDEFINED_IDENTIFIER,
         arguments: [name],
       );
     } else if (!(element is LocalVariableElement ||
         element is FormalParameterElement)) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         node.name,
         CompileTimeErrorCode.PATTERN_ASSIGNMENT_NOT_LOCAL_VARIABLE,
       );
@@ -981,7 +981,7 @@
         //
         // This is a case where the parser does not report an error, because the
         // parser thinks this could be an InstanceCreationExpression.
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           WarningCode.SDK_VERSION_CONSTRUCTOR_TEAROFFS,
         );
@@ -1761,7 +1761,7 @@
     var firstToken = namedType.importPrefix?.name ?? namedType.name;
     var offset = firstToken.offset;
     var length = namedType.name.end - offset;
-    _errorReporter.atOffset(
+    _diagnosticReporter.atOffset(
       offset: offset,
       length: length,
       diagnosticCode: diagnosticCode,
@@ -1839,7 +1839,7 @@
     var typeSystem = _libraryElement.typeSystem;
 
     if (!typeSystem.isValidExtensionTypeSuperinterface(type)) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node,
         CompileTimeErrorCode.EXTENSION_TYPE_IMPLEMENTS_DISALLOWED_TYPE,
         arguments: [type],
@@ -1860,7 +1860,7 @@
           declaredRepresentation,
           implementedRepresentation,
         )) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             node,
             CompileTimeErrorCode
                 .EXTENSION_TYPE_IMPLEMENTS_REPRESENTATION_NOT_SUPERTYPE,
@@ -1876,7 +1876,7 @@
       }
     }
 
-    _errorReporter.atNode(
+    _diagnosticReporter.atNode(
       node,
       CompileTimeErrorCode.EXTENSION_TYPE_IMPLEMENTS_NOT_SUPERTYPE,
       arguments: [type, declaredRepresentation],
@@ -2026,9 +2026,9 @@
     required covariant BindPatternVariableElementImpl2 original,
     required covariant BindPatternVariableElementImpl2 duplicate,
   }) {
-    visitor._errorReporter.reportError(
+    visitor._diagnosticReporter.reportError(
       DiagnosticFactory().duplicateDefinitionForNodes(
-        visitor._errorReporter.source,
+        visitor._diagnosticReporter.source,
         CompileTimeErrorCode.DUPLICATE_VARIABLE_PATTERN,
         duplicate.node.name,
         original.node.name,
@@ -2045,7 +2045,7 @@
     required String name,
     required PromotableElement variable,
   }) {
-    visitor._errorReporter.atNode(
+    visitor._diagnosticReporter.atNode(
       hasInLeft ? node.rightOperand : node.leftOperand,
       CompileTimeErrorCode.MISSING_VARIABLE_PATTERN,
       arguments: [name],
diff --git a/pkg/analyzer/lib/src/dart/resolver/shared_type_analyzer.dart b/pkg/analyzer/lib/src/dart/resolver/shared_type_analyzer.dart
index 60904b7..e1bc4db 100644
--- a/pkg/analyzer/lib/src/dart/resolver/shared_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/shared_type_analyzer.dart
@@ -17,7 +17,7 @@
     shared.RecordPatternField<PatternFieldImpl, DartPatternImpl>;
 
 /// Implementation of [shared.TypeAnalyzerErrors] that reports errors using the
-/// analyzer's [ErrorReporter] class.
+/// analyzer's [DiagnosticReporter] class.
 class SharedTypeAnalyzerErrors
     implements
         shared.TypeAnalyzerErrors<
@@ -29,9 +29,9 @@
           DartPatternImpl,
           void
         > {
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
-  SharedTypeAnalyzerErrors(this._errorReporter);
+  SharedTypeAnalyzerErrors(this._diagnosticReporter);
 
   @override
   void assertInErrorRecovery() {}
@@ -43,7 +43,7 @@
     required SharedTypeView scrutineeType,
     required SharedTypeView caseExpressionType,
   }) {
-    _errorReporter.atNode(
+    _diagnosticReporter.atNode(
       caseExpression,
       CompileTimeErrorCode
           .CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE,
@@ -57,9 +57,9 @@
     required covariant AssignedVariablePatternImpl original,
     required covariant AssignedVariablePatternImpl duplicate,
   }) {
-    _errorReporter.reportError(
+    _diagnosticReporter.reportError(
       DiagnosticFactory().duplicateAssignmentPatternVariable(
-        source: _errorReporter.source,
+        source: _diagnosticReporter.source,
         variable: variable,
         original: original,
         duplicate: duplicate,
@@ -77,9 +77,9 @@
     if (objectOrRecordPattern is RecordPatternImpl) {
       objectOrRecordPattern.hasDuplicateNamedField = true;
     }
-    _errorReporter.reportError(
+    _diagnosticReporter.reportError(
       DiagnosticFactory().duplicatePatternField(
-        source: _errorReporter.source,
+        source: _diagnosticReporter.source,
         name: name,
         duplicateField: duplicate.node,
         originalField: original.node,
@@ -93,9 +93,9 @@
     required covariant RestPatternElementImpl original,
     required covariant RestPatternElementImpl duplicate,
   }) {
-    _errorReporter.reportError(
+    _diagnosticReporter.reportError(
       DiagnosticFactory().duplicateRestElementInPattern(
-        source: _errorReporter.source,
+        source: _diagnosticReporter.source,
         originalElement: original,
         duplicateElement: duplicate,
       ),
@@ -104,7 +104,7 @@
 
   @override
   void emptyMapPattern({required DartPattern pattern}) {
-    _errorReporter.atNode(pattern, CompileTimeErrorCode.EMPTY_MAP_PATTERN);
+    _diagnosticReporter.atNode(pattern, CompileTimeErrorCode.EMPTY_MAP_PATTERN);
   }
 
   @override
@@ -112,7 +112,7 @@
     required PromotableElement variable,
     required PromotableElement component,
   }) {
-    _errorReporter.atElement2(
+    _diagnosticReporter.atElement2(
       component,
       CompileTimeErrorCode.INCONSISTENT_PATTERN_VARIABLE_LOGICAL_OR,
       arguments: [variable.name3!],
@@ -125,12 +125,12 @@
     required SharedTypeView matchedType,
   }) {
     if (pattern is NullAssertPattern) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         pattern.operator,
         StaticWarningCode.UNNECESSARY_NULL_ASSERT_PATTERN,
       );
     } else if (pattern is NullCheckPattern) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         pattern.operator,
         StaticWarningCode.UNNECESSARY_NULL_CHECK_PATTERN,
       );
@@ -145,7 +145,7 @@
     required SharedTypeView matchedType,
     required SharedTypeView requiredType,
   }) {
-    _errorReporter.atToken(
+    _diagnosticReporter.atToken(
       pattern.asToken,
       WarningCode.UNNECESSARY_CAST_PATTERN,
     );
@@ -153,7 +153,7 @@
 
   @override
   void nonBooleanCondition({required Expression node}) {
-    _errorReporter.atNode(node, CompileTimeErrorCode.NON_BOOL_CONDITION);
+    _diagnosticReporter.atNode(node, CompileTimeErrorCode.NON_BOOL_CONDITION);
   }
 
   @override
@@ -162,7 +162,7 @@
     required Expression expression,
     required SharedTypeView expressionType,
   }) {
-    _errorReporter.atNode(
+    _diagnosticReporter.atNode(
       expression,
       CompileTimeErrorCode.FOR_IN_OF_INVALID_TYPE,
       arguments: [expressionType, 'Iterable'],
@@ -176,7 +176,7 @@
     required SharedTypeView matchedType,
     required SharedTypeView requiredType,
   }) {
-    _errorReporter.atNode(
+    _diagnosticReporter.atNode(
       pattern,
       CompileTimeErrorCode.PATTERN_TYPE_MISMATCH_IN_IRREFUTABLE_CONTEXT,
       arguments: [matchedType, requiredType],
@@ -188,7 +188,7 @@
     required AstNode pattern,
     required AstNode context,
   }) {
-    _errorReporter.atNode(
+    _diagnosticReporter.atNode(
       pattern,
       CompileTimeErrorCode.REFUTABLE_PATTERN_IN_IRREFUTABLE_CONTEXT,
     );
@@ -200,7 +200,7 @@
     required SharedTypeView operandType,
     required SharedTypeView parameterType,
   }) {
-    _errorReporter.atNode(
+    _diagnosticReporter.atNode(
       pattern.operand,
       CompileTimeErrorCode.RELATIONAL_PATTERN_OPERAND_TYPE_NOT_ASSIGNABLE,
       arguments: [operandType, parameterType, pattern.operator.lexeme],
@@ -212,7 +212,7 @@
     required covariant RelationalPatternImpl pattern,
     required SharedTypeView returnType,
   }) {
-    _errorReporter.atToken(
+    _diagnosticReporter.atToken(
       pattern.operator,
       CompileTimeErrorCode
           .RELATIONAL_PATTERN_OPERATOR_RETURN_TYPE_NOT_ASSIGNABLE_TO_BOOL,
@@ -224,7 +224,7 @@
     required covariant MapPatternImpl node,
     required covariant RestPatternElementImpl element,
   }) {
-    _errorReporter.atNode(
+    _diagnosticReporter.atNode(
       element,
       CompileTimeErrorCode.REST_ELEMENT_IN_MAP_PATTERN,
     );
@@ -235,7 +235,7 @@
     required covariant SwitchStatementImpl node,
     required int caseIndex,
   }) {
-    _errorReporter.atToken(
+    _diagnosticReporter.atToken(
       node.members[caseIndex].keyword,
       CompileTimeErrorCode.SWITCH_CASE_COMPLETES_NORMALLY,
     );
@@ -248,7 +248,7 @@
   }) {
     switch (kind) {
       case UnnecessaryWildcardKind.logicalAndPatternOperand:
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           pattern,
           WarningCode.UNNECESSARY_WILDCARD_PATTERN,
         );
diff --git a/pkg/analyzer/lib/src/dart/resolver/simple_identifier_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/simple_identifier_resolver.dart
index dcbb15f..f2905ea 100644
--- a/pkg/analyzer/lib/src/dart/resolver/simple_identifier_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/simple_identifier_resolver.dart
@@ -24,7 +24,7 @@
   SimpleIdentifierResolver(this._resolver);
 
   @override
-  ErrorReporter get errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get diagnosticReporter => _resolver.diagnosticReporter;
 
   TypeProviderImpl get _typeProvider => _resolver.typeProvider;
 
@@ -196,7 +196,7 @@
     var enclosingClass = _resolver.enclosingClass;
     if (_isFactoryConstructorReturnType(node) &&
         !identical(element, enclosingClass)) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         node,
         CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS,
       );
@@ -206,7 +206,7 @@
       element = null;
     } else if (element is PrefixElement && !_isValidAsPrefix(node)) {
       if (element.name3 case var name?) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT,
           arguments: [name],
@@ -215,14 +215,14 @@
     } else if (element == null) {
       // TODO(brianwilkerson): Recover from this error.
       if (node.name == "await" && _resolver.enclosingFunction != null) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.UNDEFINED_IDENTIFIER_AWAIT,
         );
       } else if (!_resolver.libraryFragment.shouldIgnoreUndefinedIdentifier(
         node,
       )) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.UNDEFINED_IDENTIFIER,
           arguments: [node.name],
@@ -332,7 +332,7 @@
       return;
     }
 
-    _resolver.errorReporter.atNode(
+    _resolver.diagnosticReporter.atNode(
       node,
       CompileTimeErrorCode.EXTENSION_AS_EXPRESSION,
       arguments: [node.name],
diff --git a/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
index c0050eb..852acd0 100644
--- a/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/typed_literal_resolver.dart
@@ -48,7 +48,7 @@
   final ResolverVisitor _resolver;
   final TypeSystemImpl _typeSystem;
   final TypeProviderImpl _typeProvider;
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
   final bool _strictInference;
 
@@ -62,7 +62,7 @@
       resolver,
       typeSystem,
       typeProvider,
-      resolver.errorReporter,
+      resolver.diagnosticReporter,
       analysisOptions.strictInference,
     );
   }
@@ -71,7 +71,7 @@
     this._resolver,
     this._typeSystem,
     this._typeProvider,
-    this._errorReporter,
+    this._diagnosticReporter,
     this._strictInference,
   );
 
@@ -486,7 +486,7 @@
       declaredReturnType: element.thisType,
       contextReturnType: contextType,
       isConst: node.isConst,
-      errorReporter: _errorReporter,
+      diagnosticReporter: _diagnosticReporter,
       errorEntity: node,
       genericMetadataIsEnabled: _genericMetadataIsEnabled,
       inferenceUsingBoundsIsEnabled: _resolver.inferenceUsingBoundsIsEnabled,
@@ -527,7 +527,7 @@
       // We cannot infer the type of a collection literal with no elements, and
       // no context type. If there are any elements, inference has not failed,
       // as the types of those elements are considered resolved.
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node,
         WarningCode.INFERENCE_FAILURE_ON_COLLECTION_LITERAL,
         arguments: ['List'],
@@ -646,12 +646,12 @@
       inferenceLogWriter?.exitGenericInference(failed: true);
     }
     if (mustBeAMap && mustBeASet) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         literal,
         CompileTimeErrorCode.AMBIGUOUS_SET_OR_MAP_LITERAL_BOTH,
       );
     } else {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         literal,
         CompileTimeErrorCode.AMBIGUOUS_SET_OR_MAP_LITERAL_EITHER,
       );
@@ -802,7 +802,7 @@
       // We cannot infer the type of a collection literal with no elements, and
       // no context type. If there are any elements, inference has not failed,
       // as the types of those elements are considered resolved.
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node,
         WarningCode.INFERENCE_FAILURE_ON_COLLECTION_LITERAL,
         arguments: [node.isMap ? 'Map' : 'Set'],
diff --git a/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart
index 7630013..e3f3d27 100644
--- a/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/variable_declaration_resolver.dart
@@ -29,7 +29,7 @@
 
     if (initializer == null) {
       if (_strictInference && parent.type == null) {
-        _resolver.errorReporter.atNode(
+        _resolver.diagnosticReporter.atNode(
           node,
           WarningCode.INFERENCE_FAILURE_ON_UNINITIALIZED_VARIABLE,
           arguments: [node.name.lexeme],
diff --git a/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart b/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
index dbb8b4e..13a6328 100644
--- a/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/yield_statement_resolver.dart
@@ -21,7 +21,7 @@
   YieldStatementResolver({required ResolverVisitor resolver})
     : _resolver = resolver;
 
-  ErrorReporter get _errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get _diagnosticReporter => _resolver.diagnosticReporter;
 
   TypeProviderImpl get _typeProvider => _resolver.typeProvider;
 
@@ -50,12 +50,12 @@
     }
 
     if (expression is MethodInvocation) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         expression.methodName,
         CompileTimeErrorCode.USE_OF_VOID_RESULT,
       );
     } else {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.USE_OF_VOID_RESULT,
       );
@@ -93,7 +93,7 @@
           imposedReturnType,
           strictCasts: _resolver.analysisOptions.strictCasts,
         )) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             expression,
             CompileTimeErrorCode.YIELD_EACH_OF_INVALID_TYPE,
             arguments: [impliedReturnType, imposedReturnType],
@@ -113,7 +113,7 @@
             imposedValueType,
             strictCasts: _resolver.analysisOptions.strictCasts,
           )) {
-            _errorReporter.atNode(
+            _diagnosticReporter.atNode(
               expression,
               CompileTimeErrorCode.YIELD_OF_INVALID_TYPE,
               arguments: [expressionType, imposedValueType],
@@ -140,7 +140,7 @@
         requiredReturnType,
         strictCasts: _resolver.analysisOptions.strictCasts,
       )) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           expression,
           CompileTimeErrorCode.YIELD_EACH_OF_INVALID_TYPE,
           arguments: [impliedReturnType, requiredReturnType],
@@ -202,7 +202,7 @@
     );
     _resolver.popRewrite();
 
-    _errorReporter.atNode(
+    _diagnosticReporter.atNode(
       node,
       node.star != null
           ? CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR
diff --git a/pkg/analyzer/lib/src/error/annotation_verifier.dart b/pkg/analyzer/lib/src/error/annotation_verifier.dart
index edb240f..9adcbc2 100644
--- a/pkg/analyzer/lib/src/error/annotation_verifier.dart
+++ b/pkg/analyzer/lib/src/error/annotation_verifier.dart
@@ -16,7 +16,7 @@
 
 /// Helper for verifying the validity of annotations.
 class AnnotationVerifier {
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
   /// The current library.
   final LibraryElement _currentLibrary;
@@ -32,7 +32,7 @@
       );
 
   AnnotationVerifier(
-    this._errorReporter,
+    this._diagnosticReporter,
     this._currentLibrary,
     this._workspacePackage,
   );
@@ -83,7 +83,7 @@
         return;
       }
 
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         errorNode ?? node.name,
         WarningCode.INVALID_AWAIT_NOT_REQUIRED_ANNOTATION,
       );
@@ -123,7 +123,7 @@
     }
     var returnType = parent.returnType?.type;
     if (returnType is VoidType) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         parent.name,
         WarningCode.INVALID_FACTORY_METHOD_DECL,
         arguments: [parent.name.lexeme],
@@ -153,7 +153,7 @@
       }
     }
 
-    _errorReporter.atToken(
+    _diagnosticReporter.atToken(
       parent.name,
       WarningCode.INVALID_FACTORY_METHOD_IMPL,
       arguments: [parent.name.lexeme],
@@ -171,7 +171,7 @@
       for (var variable in parent.variables.variables) {
         var element = variable.declaredTopLevelVariableElement;
         if (element.isPrivate) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             variable,
             WarningCode.INVALID_INTERNAL_ANNOTATION,
           );
@@ -181,7 +181,7 @@
       for (var variable in parent.fields.variables) {
         var element = variable.declaredFieldElement;
         if (element.isPrivate) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             variable,
             WarningCode.INVALID_INTERNAL_ANNOTATION,
           );
@@ -191,15 +191,21 @@
       var element = parent.declaredFragment!.element;
       var class_ = element.enclosingElement;
       if (class_.isPrivate || parentElementIsPrivate) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node.name,
           WarningCode.INVALID_INTERNAL_ANNOTATION,
         );
       }
     } else if (parentElementIsPrivate) {
-      _errorReporter.atNode(node.name, WarningCode.INVALID_INTERNAL_ANNOTATION);
+      _diagnosticReporter.atNode(
+        node.name,
+        WarningCode.INVALID_INTERNAL_ANNOTATION,
+      );
     } else if (_inPackagePublicApi) {
-      _errorReporter.atNode(node.name, WarningCode.INVALID_INTERNAL_ANNOTATION);
+      _diagnosticReporter.atNode(
+        node.name,
+        WarningCode.INVALID_INTERNAL_ANNOTATION,
+      );
     }
   }
 
@@ -220,7 +226,7 @@
         var kindNames =
             kinds.map((kind) => kind.displayString).toList()..sort();
         var validKinds = kindNames.commaSeparatedWithOr;
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node.name,
           WarningCode.INVALID_ANNOTATION_TARGET,
           arguments: [name!, validKinds],
@@ -235,7 +241,10 @@
   void _checkLiteral(Annotation node) {
     var parent = node.parent;
     if (parent is! ConstructorDeclaration || parent.constKeyword == null) {
-      _errorReporter.atNode(node.name, WarningCode.INVALID_LITERAL_ANNOTATION);
+      _diagnosticReporter.atNode(
+        node.name,
+        WarningCode.INVALID_LITERAL_ANNOTATION,
+      );
     }
   }
 
@@ -245,7 +254,7 @@
     var parent = node.parent;
     if (parent is FieldDeclaration) {
       if (parent.isStatic) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node.name,
           WarningCode.INVALID_NON_VIRTUAL_ANNOTATION,
         );
@@ -255,13 +264,13 @@
           parent.parent is ExtensionTypeDeclaration ||
           parent.isStatic ||
           parent.isAbstract) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node.name,
           WarningCode.INVALID_NON_VIRTUAL_ANNOTATION,
         );
       }
     } else {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node.name,
         WarningCode.INVALID_NON_VIRTUAL_ANNOTATION,
       );
@@ -274,7 +283,7 @@
     var parent = node.parent;
     if (parent.parent is! ExtensionTypeDeclaration ||
         parent is MethodDeclaration && parent.isStatic) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node.name,
         WarningCode.INVALID_ANNOTATION_TARGET,
         arguments: [node.name.name, 'instance members of extension types'],
@@ -310,16 +319,25 @@
     if (classElement.isFinal ||
         classElement.isMixinClass ||
         classElement.isSealed) {
-      _errorReporter.atNode(node.name, WarningCode.INVALID_REOPEN_ANNOTATION);
+      _diagnosticReporter.atNode(
+        node.name,
+        WarningCode.INVALID_REOPEN_ANNOTATION,
+      );
       return;
     }
     if (classElement.library2 != superElement.library2) {
-      _errorReporter.atNode(node.name, WarningCode.INVALID_REOPEN_ANNOTATION);
+      _diagnosticReporter.atNode(
+        node.name,
+        WarningCode.INVALID_REOPEN_ANNOTATION,
+      );
       return;
     }
     if (classElement.isBase) {
       if (!superElement.isFinal && !superElement.isInterface) {
-        _errorReporter.atNode(node.name, WarningCode.INVALID_REOPEN_ANNOTATION);
+        _diagnosticReporter.atNode(
+          node.name,
+          WarningCode.INVALID_REOPEN_ANNOTATION,
+        );
         return;
       }
     } else if (!classElement.isBase &&
@@ -327,7 +345,10 @@
         !classElement.isInterface &&
         !classElement.isSealed) {
       if (!superElement.isInterface) {
-        _errorReporter.atNode(node.name, WarningCode.INVALID_REOPEN_ANNOTATION);
+        _diagnosticReporter.atNode(
+          node.name,
+          WarningCode.INVALID_REOPEN_ANNOTATION,
+        );
         return;
       }
     }
@@ -354,7 +375,7 @@
             undefinedParameter is SimpleStringLiteral
                 ? undefinedParameter.value
                 : undefinedParameter.correspondingParameter?.name3;
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           undefinedParameter,
           WarningCode.UNDEFINED_REFERENCED_PARAMETER,
           arguments: [parameterName ?? undefinedParameter, name],
@@ -372,7 +393,7 @@
       void reportInvalidAnnotation(String name) {
         // This method is only called on named elements, so it is safe to
         // assume that `declaredElement.name` is non-`null`.
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node.name,
           WarningCode.INVALID_VISIBILITY_ANNOTATION,
           arguments: [name, node.name.name],
@@ -380,7 +401,7 @@
       }
 
       void reportInvalidVisibleForOverriding() {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node.name,
           WarningCode.INVALID_VISIBLE_FOR_OVERRIDING_ANNOTATION,
         );
@@ -436,7 +457,7 @@
   /// `@visibleOutsideTemplate` annotation.
   void _checkVisibleOutsideTemplate(Annotation node) {
     void reportError() {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node.name,
         WarningCode.INVALID_VISIBLE_OUTSIDE_TEMPLATE_ANNOTATION,
       );
diff --git a/pkg/analyzer/lib/src/error/assignment_verifier.dart b/pkg/analyzer/lib/src/error/assignment_verifier.dart
index 11e6e5d..b7007de 100644
--- a/pkg/analyzer/lib/src/error/assignment_verifier.dart
+++ b/pkg/analyzer/lib/src/error/assignment_verifier.dart
@@ -13,9 +13,9 @@
 /// an [AssignmentExpression], or a [PrefixExpression] or [PostfixExpression]
 /// when the operator is an increment operator.
 class AssignmentVerifier {
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
-  AssignmentVerifier(this._errorReporter);
+  AssignmentVerifier(this._diagnosticReporter);
 
   /// We resolved [node] and found that it references the [requested] element.
   /// Verify that this element is actually writable.
@@ -36,7 +36,10 @@
     if (requested != null) {
       if (requested is VariableElement) {
         if (requested.isConst) {
-          _errorReporter.atNode(node, CompileTimeErrorCode.ASSIGNMENT_TO_CONST);
+          _diagnosticReporter.atNode(
+            node,
+            CompileTimeErrorCode.ASSIGNMENT_TO_CONST,
+          );
         }
       }
       return;
@@ -46,15 +49,21 @@
         recovery is InterfaceElement ||
         recovery is TypeAliasElement ||
         recovery is TypeParameterElement) {
-      _errorReporter.atNode(node, CompileTimeErrorCode.ASSIGNMENT_TO_TYPE);
+      _diagnosticReporter.atNode(node, CompileTimeErrorCode.ASSIGNMENT_TO_TYPE);
     } else if (recovery is LocalFunctionElement ||
         recovery is TopLevelFunctionElement) {
-      _errorReporter.atNode(node, CompileTimeErrorCode.ASSIGNMENT_TO_FUNCTION);
+      _diagnosticReporter.atNode(
+        node,
+        CompileTimeErrorCode.ASSIGNMENT_TO_FUNCTION,
+      );
     } else if (recovery is MethodElement) {
-      _errorReporter.atNode(node, CompileTimeErrorCode.ASSIGNMENT_TO_METHOD);
+      _diagnosticReporter.atNode(
+        node,
+        CompileTimeErrorCode.ASSIGNMENT_TO_METHOD,
+      );
     } else if (recovery is PrefixElement) {
       if (recovery.name3 case var prefixName?) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT,
           arguments: [prefixName],
@@ -72,15 +81,18 @@
       }
 
       if (variable.isConst) {
-        _errorReporter.atNode(node, CompileTimeErrorCode.ASSIGNMENT_TO_CONST);
+        _diagnosticReporter.atNode(
+          node,
+          CompileTimeErrorCode.ASSIGNMENT_TO_CONST,
+        );
       } else if (variable is FieldElement && variable.isSynthetic) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.ASSIGNMENT_TO_FINAL_NO_SETTER,
           arguments: [variableName, variable.enclosingElement.displayName],
         );
       } else {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.ASSIGNMENT_TO_FINAL,
           arguments: [variableName],
@@ -93,13 +105,13 @@
         return;
       }
       if (receiverType != null) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.UNDEFINED_SETTER,
           arguments: [node.name, receiverType],
         );
       } else {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.UNDEFINED_IDENTIFIER,
           arguments: [node.name],
diff --git a/pkg/analyzer/lib/src/error/base_or_final_type_verifier.dart b/pkg/analyzer/lib/src/error/base_or_final_type_verifier.dart
index 2dbe645..b21ef83 100644
--- a/pkg/analyzer/lib/src/error/base_or_final_type_verifier.dart
+++ b/pkg/analyzer/lib/src/error/base_or_final_type_verifier.dart
@@ -16,13 +16,13 @@
 /// base, final, or sealed.
 class BaseOrFinalTypeVerifier {
   final LibraryElement _definingLibrary;
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
   BaseOrFinalTypeVerifier({
     required LibraryElement definingLibrary,
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
   }) : _definingLibrary = definingLibrary,
-       _errorReporter = errorReporter;
+       _diagnosticReporter = diagnosticReporter;
 
   /// Check to ensure the subelement of a base or final element must be base,
   /// final, or sealed and that base elements are not implemented outside of its
@@ -242,7 +242,7 @@
                 ? CompileTimeErrorCode.BASE_MIXIN_IMPLEMENTED_OUTSIDE_OF_LIBRARY
                 : CompileTimeErrorCode
                     .BASE_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY;
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           implementsNamedType,
           errorCode,
           arguments: [baseOrFinalSuperElement.displayName],
@@ -279,7 +279,7 @@
                 ? CompileTimeErrorCode.MIXIN_SUBTYPE_OF_FINAL_IS_NOT_BASE
                 : CompileTimeErrorCode
                     .SUBTYPE_OF_FINAL_IS_NOT_BASE_FINAL_OR_SEALED;
-        _errorReporter.atElement2(
+        _diagnosticReporter.atElement2(
           element,
           errorCode,
           arguments: [element.displayName, baseOrFinalSuperElement.displayName],
@@ -292,7 +292,7 @@
                 ? CompileTimeErrorCode.MIXIN_SUBTYPE_OF_BASE_IS_NOT_BASE
                 : CompileTimeErrorCode
                     .SUBTYPE_OF_BASE_IS_NOT_BASE_FINAL_OR_SEALED;
-        _errorReporter.atElement2(
+        _diagnosticReporter.atElement2(
           element,
           errorCode,
           arguments: [element.displayName, baseOrFinalSuperElement.displayName],
diff --git a/pkg/analyzer/lib/src/error/best_practices_verifier.dart b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
index 6c1639f..652d89f 100644
--- a/pkg/analyzer/lib/src/error/best_practices_verifier.dart
+++ b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
@@ -49,8 +49,8 @@
   /// `@doNotStore`.
   bool _inDoNotStoreMember = false;
 
-  /// The error reporter by which errors will be reported.
-  final ErrorReporter _errorReporter;
+  /// The error reporter by which diagnostics will be reported.
+  final DiagnosticReporter _diagnosticReporter;
 
   /// The type [Null].
   final InterfaceType _nullType;
@@ -74,7 +74,7 @@
   final NullSafeApiVerifier _nullSafeApiVerifier;
 
   late final DocCommentVerifier _docCommentVerifier = DocCommentVerifier(
-    _errorReporter,
+    _diagnosticReporter,
   );
 
   final WidgetPreviewVerifier _widgetPreviewVerifier;
@@ -91,7 +91,7 @@
       _workspacePackage.sourceIsInPublicApi(_currentLibrary.source);
 
   BestPracticesVerifier(
-    this._errorReporter,
+    this._diagnosticReporter,
     TypeProviderImpl typeProvider,
     this._currentLibrary,
     CompilationUnit unit, {
@@ -102,30 +102,33 @@
        _typeSystem = typeSystem,
        _strictInference = analysisOptions.strictInference,
        _annotationVerifier = AnnotationVerifier(
-         _errorReporter,
+         _diagnosticReporter,
          _currentLibrary,
          workspacePackage,
        ),
        _deprecatedVerifier = DeprecatedMemberUseVerifier(
          workspacePackage,
-         _errorReporter,
+         _diagnosticReporter,
          strictCasts: analysisOptions.strictCasts,
        ),
        _errorHandlerVerifier = ErrorHandlerVerifier(
-         _errorReporter,
+         _diagnosticReporter,
          typeProvider,
          typeSystem,
          strictCasts: analysisOptions.strictCasts,
        ),
        _invalidAccessVerifier = _InvalidAccessVerifier(
-         _errorReporter,
+         _diagnosticReporter,
          unit,
          _currentLibrary,
          workspacePackage,
        ),
-       _mustCallSuperVerifier = MustCallSuperVerifier(_errorReporter),
-       _nullSafeApiVerifier = NullSafeApiVerifier(_errorReporter, typeSystem),
-       _widgetPreviewVerifier = WidgetPreviewVerifier(_errorReporter),
+       _mustCallSuperVerifier = MustCallSuperVerifier(_diagnosticReporter),
+       _nullSafeApiVerifier = NullSafeApiVerifier(
+         _diagnosticReporter,
+         typeSystem,
+       ),
+       _widgetPreviewVerifier = WidgetPreviewVerifier(_diagnosticReporter),
        _workspacePackage = workspacePackage {
     _deprecatedVerifier.pushInDeprecatedValue(
       _currentLibrary.metadata.hasDeprecated,
@@ -149,13 +152,13 @@
   @override
   void visitAsExpression(AsExpression node) {
     if (_isUnnecessaryCast(node, _typeSystem)) {
-      _errorReporter.atNode(node, WarningCode.UNNECESSARY_CAST);
+      _diagnosticReporter.atNode(node, WarningCode.UNNECESSARY_CAST);
     }
     var type = node.type.type;
     if (type != null &&
         _typeSystem.isNonNullable(type) &&
         node.expression.typeOrThrow.isDartCoreNull) {
-      _errorReporter.atNode(node, WarningCode.CAST_FROM_NULL_ALWAYS_FAILS);
+      _diagnosticReporter.atNode(node, WarningCode.CAST_FROM_NULL_ALWAYS_FAILS);
     }
     super.visitAsExpression(node);
   }
@@ -183,7 +186,7 @@
         _typeSystem.isNonNullable(type) &&
         matchedValueType != null &&
         matchedValueType.isDartCoreNull) {
-      _errorReporter.atNode(node, WarningCode.CAST_FROM_NULL_ALWAYS_FAILS);
+      _diagnosticReporter.atNode(node, WarningCode.CAST_FROM_NULL_ALWAYS_FAILS);
     }
     super.visitCastPattern(node);
   }
@@ -250,7 +253,7 @@
     var newKeyword = node.newKeyword;
     if (newKeyword != null &&
         _currentLibrary.featureSet.isEnabled(Feature.constructor_tearoffs)) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         newKeyword,
         WarningCode.DEPRECATED_NEW_IN_COMMENT_REFERENCE,
       );
@@ -261,7 +264,10 @@
   @override
   void visitConstantPattern(ConstantPattern node) {
     if (node.expression.isDoubleNan) {
-      _errorReporter.atNode(node, WarningCode.UNNECESSARY_NAN_COMPARISON_FALSE);
+      _diagnosticReporter.atNode(
+        node,
+        WarningCode.UNNECESSARY_NAN_COMPARISON_FALSE,
+      );
     }
     super.visitConstantPattern(node);
   }
@@ -297,12 +303,12 @@
       // This is a warning in code whose language version is < 3.0, but an error
       // in code whose language version is >= 3.0.
       if (_currentLibrary.languageVersion.effective.major < 3) {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           separator,
           HintCode.DEPRECATED_COLON_FOR_DEFAULT_VALUE,
         );
       } else {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           separator,
           CompileTimeErrorCode.OBSOLETE_COLON_FOR_DEFAULT_VALUE,
         );
@@ -411,7 +417,7 @@
           // Overridden members are always inside classes or mixins, which are
           // always named, so we can safely assume
           // `overriddenElement.enclosingElement3.name` is non-`null`.
-          _errorReporter.atToken(
+          _diagnosticReporter.atToken(
             field.name,
             WarningCode.INVALID_OVERRIDE_OF_NON_VIRTUAL_MEMBER,
             arguments: [
@@ -622,7 +628,7 @@
         // Overridden members are always inside classes or mixins, which are
         // always named, so we can safely assume
         // `overriddenElement.enclosingElement3.name` is non-`null`.
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           node.name,
           WarningCode.INVALID_OVERRIDE_OF_NON_VIRTUAL_MEMBER,
           arguments: [
@@ -679,7 +685,7 @@
       if ((type is InterfaceType && type.element3 == _nullType.element3 ||
               (type is DynamicType && node.name.lexeme == 'dynamic')) &&
           type.alias == null) {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           question,
           WarningCode.UNNECESSARY_QUESTION_MARK,
           arguments: [node.qualifiedName],
@@ -701,7 +707,7 @@
     _deprecatedVerifier.postfixExpression(node);
     if (node.operator.type == TokenType.BANG &&
         node.operand.typeOrThrow.isDartCoreNull) {
-      _errorReporter.atNode(node, WarningCode.NULL_CHECK_ALWAYS_FAILS);
+      _diagnosticReporter.atNode(node, WarningCode.NULL_CHECK_ALWAYS_FAILS);
     }
     super.visitPostfixExpression(node);
   }
@@ -788,7 +794,7 @@
     var rightType = rightNode.typeOrThrow;
 
     void report() {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node,
         node.notOperator == null
             ? WarningCode.UNNECESSARY_TYPE_CHECK_TRUE
@@ -817,7 +823,7 @@
       if (leftNode is NullLiteral) {
         report();
       } else {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           node.notOperator == null
               ? WarningCode.TYPE_CHECK_IS_NULL
@@ -837,7 +843,7 @@
 
   void _checkFinalParameter(FormalParameter node, Token? keyword) {
     if (node.isFinal) {
-      _errorReporter.atToken(keyword!, WarningCode.UNNECESSARY_FINAL);
+      _diagnosticReporter.atToken(keyword!, WarningCode.UNNECESSARY_FINAL);
     }
   }
 
@@ -847,7 +853,7 @@
       // All the elements returned by [_getSubExpressionsMarkedDoNotStore] are
       // named elements, so we can safely assume `entry.value.name` is
       // non-`null`.
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         entry.key,
         WarningCode.ASSIGNMENT_OF_DO_NOT_STORE,
         arguments: [entry.value.name3!],
@@ -879,7 +885,7 @@
               node.isSet
                   ? WarningCode.EQUAL_ELEMENTS_IN_SET
                   : WarningCode.EQUAL_KEYS_IN_MAP;
-          _errorReporter.atNode(expression, errorCode);
+          _diagnosticReporter.atNode(expression, errorCode);
         }
       }
     }
@@ -960,7 +966,7 @@
             HashSet<InterfaceElement>(),
           );
       if (nonFinalFields.isNotEmpty) {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           node.name,
           WarningCode.MUST_BE_IMMUTABLE,
           arguments: [nonFinalFields.join(', ')],
@@ -981,7 +987,7 @@
     if (libraryElement == null) return;
 
     if (libraryElement.metadata.hasInternal) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node,
         WarningCode.INVALID_EXPORT_OF_INTERNAL_ELEMENT,
         arguments: [libraryElement.displayName],
@@ -993,7 +999,7 @@
     exportNamespace.definedNames2.forEach((String name, Element element) {
       if (element case Annotatable annotatable) {
         if (annotatable.metadata.hasInternal) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             node,
             WarningCode.INVALID_EXPORT_OF_INTERNAL_ELEMENT,
             arguments: [element.displayName],
@@ -1010,7 +1016,7 @@
         for (var type in signatureTypes) {
           var aliasElement = type?.alias?.element2;
           if (aliasElement != null && aliasElement.metadata.hasInternal) {
-            _errorReporter.atNode(
+            _diagnosticReporter.atNode(
               node,
               WarningCode.INVALID_EXPORT_OF_INTERNAL_ELEMENT_INDIRECTLY,
               arguments: [aliasElement.name3!, element.displayName],
@@ -1041,14 +1047,14 @@
               element.superclassConstraints.contains(supertype)) {
             // This is a special violation of the sealed class contract,
             // requiring specific messaging.
-            _errorReporter.atNode(
+            _diagnosticReporter.atNode(
               node,
               WarningCode.MIXIN_ON_SEALED_CLASS,
               arguments: [superclass.name3.toString()],
             );
           } else {
             // This is a regular violation of the sealed class contract.
-            _errorReporter.atNode(
+            _diagnosticReporter.atNode(
               node,
               WarningCode.SUBTYPE_OF_SEALED_CLASS,
               arguments: [superclass.name3.toString()],
@@ -1066,7 +1072,7 @@
       SyntacticEntity endEntity,
     ) {
       var offset = startEntity.offset;
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: offset,
         length: endEntity.end - offset,
         diagnosticCode: diagnosticCode,
@@ -1102,7 +1108,7 @@
       var rightType = node.rightOperand.typeOrThrow;
       if (_typeSystem.isStrictlyNonNullable(rightType)) {
         var offset = node.leftOperand.offset;
-        _errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: offset,
           length: node.operator.end - offset,
           diagnosticCode: errorCode,
@@ -1114,7 +1120,7 @@
       var leftType = node.leftOperand.typeOrThrow;
       if (_typeSystem.isStrictlyNonNullable(leftType)) {
         var offset = node.operator.offset;
-        _errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: offset,
           length: node.rightOperand.end - offset,
           diagnosticCode: errorCode,
@@ -1144,7 +1150,11 @@
           node.keyword?.keyword == Keyword.NEW
               ? WarningCode.NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR_USING_NEW
               : WarningCode.NON_CONST_CALL_TO_LITERAL_CONSTRUCTOR;
-      _errorReporter.atNode(node, warning, arguments: [fullConstructorName]);
+      _diagnosticReporter.atNode(
+        node,
+        warning,
+        arguments: [fullConstructorName],
+      );
     }
   }
 
@@ -1175,7 +1185,7 @@
       TopLevelFunctionElement.LOAD_LIBRARY_NAME,
     );
     if (loadLibraryElement != null) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node,
         HintCode.IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION,
       );
@@ -1209,7 +1219,7 @@
     }
 
     if (_typeSystem.isNullable(parameterElement.type)) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         node.name,
         WarningCode.NON_NULLABLE_EQUALS_PARAMETER,
       );
@@ -1228,7 +1238,7 @@
     }
 
     if (_typeSystem.isPotentiallyNullable(typeObj)) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         typeNode,
         WarningCode.NULLABLE_TYPE_IN_CATCH_CLAUSE,
       );
@@ -1253,7 +1263,7 @@
         // All the elements returned by [_getSubExpressionsMarkedDoNotStore] are
         // named elements, so we can safely assume `entry.value.name` is
         // non-`null`.
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           entry.key,
           WarningCode.RETURN_OF_DO_NOT_STORE,
           arguments: [
@@ -1292,7 +1302,7 @@
     FunctionBody body = node.body;
     if (body is ExpressionFunctionBody) {
       if (isNonObjectNoSuchMethodInvocation(body.expression)) {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           node.name,
           WarningCode.UNNECESSARY_NO_SUCH_METHOD,
         );
@@ -1304,7 +1314,7 @@
         Statement returnStatement = statements.first;
         if (returnStatement is ReturnStatement &&
             isNonObjectNoSuchMethodInvocation(returnStatement.expression)) {
-          _errorReporter.atToken(
+          _diagnosticReporter.atToken(
             node.name,
             WarningCode.UNNECESSARY_NO_SUCH_METHOD,
           );
@@ -1349,7 +1359,7 @@
       if (isReturnVoid) {
         var expression = body.expression;
         if (expression is SetOrMapLiteralImpl && expression.isSet) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             expression,
             WarningCode.UNNECESSARY_SET_LITERAL,
           );
@@ -1369,21 +1379,21 @@
         .where((p) => p.isNamed)
         .where((p) => p is DefaultFormalParameter && p.defaultValue != null);
     for (var param in nonNamedParamsWithRequired.where((p) => p.isOptional)) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         param,
         WarningCode.INVALID_REQUIRED_OPTIONAL_POSITIONAL_PARAM,
         arguments: [_formalParameterNameOrEmpty(param)],
       );
     }
     for (var param in nonNamedParamsWithRequired.where((p) => p.isRequired)) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         param,
         WarningCode.INVALID_REQUIRED_POSITIONAL_PARAM,
         arguments: [_formalParameterNameOrEmpty(param)],
       );
     }
     for (var param in namedParamsWithRequiredAndDefault) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         param,
         WarningCode.INVALID_REQUIRED_NAMED_PARAM,
         arguments: [_formalParameterNameOrEmpty(param)],
@@ -1431,7 +1441,7 @@
     void checkParameterTypeIsKnown(SimpleFormalParameter parameter) {
       if (parameter.type == null && isParameterReferenced(parameter)) {
         var element = parameter.declaredFragment!.element;
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           parameter,
           WarningCode.INFERENCE_FAILURE_ON_UNTYPED_PARAMETER,
           arguments: [element.displayName],
@@ -1465,19 +1475,19 @@
 
     switch (reportNode) {
       case MethodDeclaration():
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           reportNode.name,
           WarningCode.INFERENCE_FAILURE_ON_FUNCTION_RETURN_TYPE,
           arguments: [displayName],
         );
       case FunctionDeclaration():
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           reportNode.name,
           WarningCode.INFERENCE_FAILURE_ON_FUNCTION_RETURN_TYPE,
           arguments: [displayName],
         );
       case _:
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           reportNode,
           WarningCode.INFERENCE_FAILURE_ON_FUNCTION_RETURN_TYPE,
           arguments: [displayName],
@@ -1615,7 +1625,7 @@
 class _InvalidAccessVerifier {
   static final _templateExtension = '.template';
 
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _errorReporter;
   final LibraryElement _library;
   final WorkspacePackageImpl? _workspacePackage;
 
diff --git a/pkg/analyzer/lib/src/error/bool_expression_verifier.dart b/pkg/analyzer/lib/src/error/bool_expression_verifier.dart
index 65aef84..83d5441 100644
--- a/pkg/analyzer/lib/src/error/bool_expression_verifier.dart
+++ b/pkg/analyzer/lib/src/error/bool_expression_verifier.dart
@@ -16,17 +16,17 @@
 /// Helper for verifying expression that should be of type bool.
 class BoolExpressionVerifier {
   final ResolverVisitor _resolver;
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
   final NullableDereferenceVerifier _nullableDereferenceVerifier;
 
   final InterfaceTypeImpl _boolType;
 
   BoolExpressionVerifier({
     required ResolverVisitor resolver,
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
     required NullableDereferenceVerifier nullableDereferenceVerifier,
   }) : _resolver = resolver,
-       _errorReporter = errorReporter,
+       _diagnosticReporter = diagnosticReporter,
        _nullableDereferenceVerifier = nullableDereferenceVerifier,
        _boolType = resolver.typeSystem.typeProvider.boolType;
 
@@ -72,7 +72,11 @@
           ),
         );
       } else {
-        _errorReporter.atNode(expression, diagnosticCode, arguments: arguments);
+        _diagnosticReporter.atNode(
+          expression,
+          diagnosticCode,
+          arguments: arguments,
+        );
       }
     }
   }
@@ -100,12 +104,12 @@
 
     if (expression is MethodInvocation) {
       SimpleIdentifier methodName = expression.methodName;
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         methodName,
         CompileTimeErrorCode.USE_OF_VOID_RESULT,
       );
     } else {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.USE_OF_VOID_RESULT,
       );
diff --git a/pkg/analyzer/lib/src/error/const_argument_verifier.dart b/pkg/analyzer/lib/src/error/const_argument_verifier.dart
index 2ca2afd..c30243b 100644
--- a/pkg/analyzer/lib/src/error/const_argument_verifier.dart
+++ b/pkg/analyzer/lib/src/error/const_argument_verifier.dart
@@ -15,9 +15,9 @@
 /// Checks if the arguments for a parameter annotated with `@mustBeConst` are
 /// actually constant.
 class ConstArgumentsVerifier extends SimpleAstVisitor<void> {
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
-  ConstArgumentsVerifier(this._errorReporter);
+  ConstArgumentsVerifier(this._diagnosticReporter);
 
   @override
   void visitAssignmentExpression(AssignmentExpression node) {
@@ -31,7 +31,7 @@
         false) {
       // If the operator is not `=`, then the argument cannot be const, as it
       // depends on the value of the left hand side.
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node.rightHandSide,
         WarningCode.NON_CONST_ARGUMENT_FOR_CONST_PARAMETER,
         arguments: [node.rightHandSide],
@@ -111,7 +111,7 @@
           resolvedArgument = argument;
         }
         if (!_isConst(resolvedArgument)) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             argument,
             WarningCode.NON_CONST_ARGUMENT_FOR_CONST_PARAMETER,
             arguments: [parameterName],
diff --git a/pkg/analyzer/lib/src/error/constructor_fields_verifier.dart b/pkg/analyzer/lib/src/error/constructor_fields_verifier.dart
index b34c4e1..e0c8f0a 100644
--- a/pkg/analyzer/lib/src/error/constructor_fields_verifier.dart
+++ b/pkg/analyzer/lib/src/error/constructor_fields_verifier.dart
@@ -17,7 +17,7 @@
   ConstructorFieldsVerifier({required this.typeSystem});
 
   void addConstructors(
-    ErrorReporter errorReporter,
+    DiagnosticReporter diagnosticReporter,
     InterfaceElement element,
     List<ClassMember> members,
   ) {
@@ -25,7 +25,7 @@
     var constructors = members.whereType<ConstructorDeclarationImpl>();
     for (var constructor in constructors) {
       _addConstructor(
-        errorReporter: errorReporter,
+        diagnosticReporter: diagnosticReporter,
         interfaceFields: interfaceFields,
         node: constructor,
       );
@@ -41,7 +41,7 @@
   }
 
   void _addConstructor({
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
     required _Interface interfaceFields,
     required ConstructorDeclarationImpl node,
   }) {
@@ -53,7 +53,7 @@
 
     var fragment = node.declaredFragment!;
     var constructorState = interfaceFields.forConstructor(
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
       node: node,
       fragment: fragment,
     );
@@ -62,7 +62,7 @@
       constructorState.updateWithParameters(node);
     }
 
-    constructorState.updateWithInitializers(errorReporter, node);
+    constructorState.updateWithInitializers(diagnosticReporter, node);
   }
 
   _Interface _forInterface(InterfaceElement element) {
@@ -95,7 +95,7 @@
 
 class _Constructor {
   final TypeSystemImpl typeSystem;
-  final ErrorReporter errorReporter;
+  final DiagnosticReporter diagnosticReporter;
   final ConstructorDeclaration node;
   final ConstructorElement element;
   final Map<FieldElement, _InitState> fields;
@@ -105,7 +105,7 @@
 
   _Constructor({
     required this.typeSystem,
-    required this.errorReporter,
+    required this.diagnosticReporter,
     required this.node,
     required this.element,
     required this.fields,
@@ -148,19 +148,19 @@
     names.sort();
 
     if (names.length == 1) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         node.returnType,
         CompileTimeErrorCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_1,
         arguments: names,
       );
     } else if (names.length == 2) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         node.returnType,
         CompileTimeErrorCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_2,
         arguments: names,
       );
     } else {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         node.returnType,
         CompileTimeErrorCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS,
         arguments: [names[0], names[1], names.length - 2],
@@ -177,7 +177,7 @@
     names.sort();
 
     for (var name in names) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         node.returnType,
         CompileTimeErrorCode
             .NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD_CONSTRUCTOR,
@@ -187,7 +187,7 @@
   }
 
   void updateWithInitializers(
-    ErrorReporter errorReporter,
+    DiagnosticReporter diagnosticReporter,
     ConstructorDeclaration node,
   ) {
     for (var initializer in node.initializers) {
@@ -203,20 +203,20 @@
             fields[fieldElement] = _InitState.initInInitializer;
           } else if (state == _InitState.initInDeclaration) {
             if (fieldElement.isFinal || fieldElement.isConst) {
-              errorReporter.atNode(
+              diagnosticReporter.atNode(
                 fieldName,
                 CompileTimeErrorCode
                     .FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION,
               );
             }
           } else if (state == _InitState.initInFieldFormal) {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               fieldName,
               CompileTimeErrorCode
                   .FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER,
             );
           } else if (state == _InitState.initInInitializer) {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               fieldName,
               CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS,
               arguments: [fieldElement.displayName],
@@ -242,7 +242,7 @@
           fields[fieldElement] = _InitState.initInFieldFormal;
         } else if (state == _InitState.initInDeclaration) {
           if (fieldElement.isFinal || fieldElement.isConst) {
-            errorReporter.atToken(
+            diagnosticReporter.atToken(
               parameter.name,
               CompileTimeErrorCode
                   .FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR,
@@ -303,14 +303,14 @@
   });
 
   _Constructor forConstructor({
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
     required ConstructorDeclaration node,
     required ConstructorFragment fragment,
   }) {
     var element = fragment.element;
     return constructors[element] ??= _Constructor(
       typeSystem: typeSystem,
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
       node: node,
       element: element,
       fields: {...fields},
diff --git a/pkg/analyzer/lib/src/error/correct_override.dart b/pkg/analyzer/lib/src/error/correct_override.dart
index 0af8172..c16d1aa 100644
--- a/pkg/analyzer/lib/src/error/correct_override.dart
+++ b/pkg/analyzer/lib/src/error/correct_override.dart
@@ -43,7 +43,7 @@
   /// error.
   void verify({
     required ExecutableElement2OrMember superMember,
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
     required SyntacticEntity errorNode,
     required DiagnosticCode diagnosticCode,
   }) {
@@ -52,9 +52,9 @@
       var member = _thisMember;
       var memberName = member.name3;
       if (memberName != null) {
-        errorReporter.reportError(
+        diagnosticReporter.reportError(
           _diagnosticFactory.invalidOverride(
-            errorReporter.source,
+            diagnosticReporter.source,
             diagnosticCode,
             errorNode,
             _thisMember,
@@ -106,7 +106,7 @@
       _thisMember = thisMember;
 
   void verify({
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter errorReporter,
     required SyntacticEntity errorEntity,
   }) {
     var superParameters = _superParameters();
diff --git a/pkg/analyzer/lib/src/error/dead_code_verifier.dart b/pkg/analyzer/lib/src/error/dead_code_verifier.dart
index 63c7734..d9759e3 100644
--- a/pkg/analyzer/lib/src/error/dead_code_verifier.dart
+++ b/pkg/analyzer/lib/src/error/dead_code_verifier.dart
@@ -31,8 +31,8 @@
 /// A visitor that finds dead code, other than unreachable code that is
 /// handled in [NullSafetyDeadCodeVerifier].
 class DeadCodeVerifier extends RecursiveAstVisitor<void> {
-  /// The error reporter by which errors will be reported.
-  final ErrorReporter _errorReporter;
+  /// The diagnostic reporter by which diagnostics will be reported.
+  final DiagnosticReporter _diagnosticReporter;
 
   /// The object used to track the usage of labels within a given label scope.
   _LabelTracker? _labelTracker;
@@ -40,7 +40,7 @@
   /// Whether the `wildcard_variables` feature is enabled.
   final bool _wildCardVariablesEnabled;
 
-  DeadCodeVerifier(this._errorReporter, LibraryElement library)
+  DeadCodeVerifier(this._diagnosticReporter, LibraryElement library)
     : _wildCardVariablesEnabled = library.featureSet.isEnabled(
         Feature.wildcard_variables,
       );
@@ -77,7 +77,7 @@
     if (_wildCardVariablesEnabled &&
         element is LocalFunctionElement &&
         element.name3 == '_') {
-      _errorReporter.atNode(node, WarningCode.DEAD_CODE);
+      _diagnosticReporter.atNode(node, WarningCode.DEAD_CODE);
     }
     super.visitFunctionDeclaration(node);
   }
@@ -125,7 +125,7 @@
       if (_wildCardVariablesEnabled &&
           element is LocalVariableElement &&
           element.name3 == '_') {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           initializer,
           WarningCode.DEAD_CODE_LATE_WILDCARD_VARIABLE_INITIALIZER,
         );
@@ -155,7 +155,7 @@
       Element? element = namespace.get2(nameStr);
       element ??= namespace.get2("$nameStr=");
       if (element == null) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           name,
           warningCode,
           arguments: [library.identifier, nameStr],
@@ -171,7 +171,7 @@
       f();
     } finally {
       for (Label label in labelTracker.unusedLabels()) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           label,
           WarningCode.UNUSED_LABEL,
           arguments: [label.label.name],
@@ -193,7 +193,7 @@
 /// node, or contains it. So, we end the end of the covering control flow.
 class NullSafetyDeadCodeVerifier {
   final TypeSystemImpl _typeSystem;
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
   final FlowAnalysisHelper? _flowAnalysis;
 
   /// The stack of verifiers of (potentially nested) try statements.
@@ -212,7 +212,7 @@
 
   NullSafetyDeadCodeVerifier(
     this._typeSystem,
-    this._errorReporter,
+    this._diagnosticReporter,
     this._flowAnalysis,
   );
 
@@ -234,7 +234,7 @@
     }
 
     if (node is SwitchMember && node == firstDeadNode) {
-      _errorReporter.atToken(node.keyword, WarningCode.DEAD_CODE);
+      _diagnosticReporter.atToken(node.keyword, WarningCode.DEAD_CODE);
       _firstDeadNode = null;
       return;
     }
@@ -281,7 +281,7 @@
         offset = parent.operator.offset;
       }
       if (parent is ConstructorInitializer) {
-        _errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: parent.offset,
           length: parent.end - parent.offset,
           diagnosticCode: WarningCode.DEAD_CODE,
@@ -294,7 +294,7 @@
         if (body is Block) {
           whileOffset = body.rightBracket.offset;
         }
-        _errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: whileOffset,
           length: whileEnd - whileOffset,
           diagnosticCode: WarningCode.DEAD_CODE,
@@ -315,7 +315,7 @@
 
       var length = node.end - offset;
       if (length > 0) {
-        _errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: WarningCode.DEAD_CODE,
@@ -357,7 +357,7 @@
       var beginToken = updaters.beginToken;
       var endToken = updaters.endToken;
       if (beginToken != null && endToken != null) {
-        _errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: beginToken.offset,
           length: endToken.end - beginToken.offset,
           diagnosticCode: WarningCode.DEAD_CODE,
@@ -383,7 +383,7 @@
     ) {
       var offset = first.offset;
       var length = last.end - offset;
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: offset,
         length: length,
         diagnosticCode: errorCode,
@@ -494,7 +494,7 @@
           node = parent!;
           parent = node.parent;
         }
-        _errorReporter.atNode(node, WarningCode.DEAD_CODE);
+        _diagnosticReporter.atNode(node, WarningCode.DEAD_CODE);
       }
     }
   }
diff --git a/pkg/analyzer/lib/src/error/deprecated_member_use_verifier.dart b/pkg/analyzer/lib/src/error/deprecated_member_use_verifier.dart
index e97b66c..3fcf923 100644
--- a/pkg/analyzer/lib/src/error/deprecated_member_use_verifier.dart
+++ b/pkg/analyzer/lib/src/error/deprecated_member_use_verifier.dart
@@ -357,11 +357,11 @@
 
 class DeprecatedMemberUseVerifier extends BaseDeprecatedMemberUseVerifier {
   final WorkspacePackageImpl? _workspacePackage;
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
   DeprecatedMemberUseVerifier(
     this._workspacePackage,
-    this._errorReporter, {
+    this._diagnosticReporter, {
     required super.strictCasts,
   });
 
@@ -376,7 +376,7 @@
 
     message = message?.trim();
     if (message == null || message.isEmpty || message == '.') {
-      _errorReporter.atEntity(
+      _diagnosticReporter.atEntity(
         errorEntity,
         _isLibraryInWorkspacePackage(library)
             ? HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE
@@ -389,7 +389,7 @@
           !message.endsWith('!')) {
         message = '$message.';
       }
-      _errorReporter.atEntity(
+      _diagnosticReporter.atEntity(
         errorEntity,
         _isLibraryInWorkspacePackage(library)
             ? HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE_WITH_MESSAGE
diff --git a/pkg/analyzer/lib/src/error/doc_comment_verifier.dart b/pkg/analyzer/lib/src/error/doc_comment_verifier.dart
index b72ce86..26b29c8 100644
--- a/pkg/analyzer/lib/src/error/doc_comment_verifier.dart
+++ b/pkg/analyzer/lib/src/error/doc_comment_verifier.dart
@@ -10,9 +10,9 @@
 
 /// Verifies various data parsed in doc comments.
 class DocCommentVerifier {
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
-  DocCommentVerifier(this._errorReporter);
+  DocCommentVerifier(this._diagnosticReporter);
 
   void docDirective(DocDirective docDirective) {
     switch (docDirective) {
@@ -35,14 +35,14 @@
   void docImport(DocImport docImport) {
     var deferredKeyword = docImport.import.deferredKeyword;
     if (deferredKeyword != null) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         deferredKeyword,
         WarningCode.DOC_IMPORT_CANNOT_BE_DEFERRED,
       );
     }
     var configurations = docImport.import.configurations;
     if (configurations.isNotEmpty) {
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: configurations.first.offset,
         length: configurations.last.end - configurations.first.offset,
         diagnosticCode: WarningCode.DOC_IMPORT_CANNOT_HAVE_CONFIGURATIONS,
@@ -52,7 +52,7 @@
     // TODO(srawlins): Support combinators.
     var combinators = docImport.import.combinators;
     if (combinators.isNotEmpty) {
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: combinators.first.offset,
         length: combinators.last.end - combinators.first.offset,
         diagnosticCode: WarningCode.DOC_IMPORT_CANNOT_HAVE_COMBINATORS,
@@ -64,7 +64,7 @@
     // reverted as it increased memory usage.
     var prefix = docImport.import.prefix;
     if (prefix != null) {
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: prefix.offset,
         length: prefix.end - prefix.offset,
         diagnosticCode: WarningCode.DOC_IMPORT_CANNOT_HAVE_PREFIX,
@@ -80,7 +80,7 @@
     if (positionalArgumentCount < requiredCount) {
       var gap = requiredCount - positionalArgumentCount;
       if (gap == 1) {
-        _errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: tag.offset,
           length: tag.end - tag.offset,
           diagnosticCode: WarningCode.DOC_DIRECTIVE_MISSING_ONE_ARGUMENT,
@@ -91,7 +91,7 @@
           required[required.length - 2].name,
           required.last.name,
         ];
-        _errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: tag.offset,
           length: tag.end - tag.offset,
           diagnosticCode: WarningCode.DOC_DIRECTIVE_MISSING_TWO_ARGUMENTS,
@@ -103,7 +103,7 @@
           required[required.length - 2].name,
           required.last.name,
         ];
-        _errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: tag.offset,
           length: tag.end - tag.offset,
           diagnosticCode: WarningCode.DOC_DIRECTIVE_MISSING_THREE_ARGUMENTS,
@@ -121,7 +121,7 @@
     if (positionalArgumentCount > requiredCount) {
       var errorOffset = tag.positionalArguments[requiredCount].offset;
       var errorLength = tag.positionalArguments.last.end - errorOffset;
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: errorOffset,
         length: errorLength,
         diagnosticCode: WarningCode.DOC_DIRECTIVE_HAS_EXTRA_ARGUMENTS,
@@ -131,7 +131,7 @@
 
     for (var namedArgument in tag.namedArguments) {
       if (!tag.type.namedParameters.containsNamed(namedArgument.name)) {
-        _errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: namedArgument.offset,
           length: namedArgument.end - namedArgument.offset,
           diagnosticCode:
@@ -153,7 +153,7 @@
       var argument = tag.positionalArguments[i];
 
       void reportWrongFormat() {
-        _errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: argument.offset,
           length: argument.end - argument.offset,
           diagnosticCode: WarningCode.DOC_DIRECTIVE_ARGUMENT_WRONG_FORMAT,
diff --git a/pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart b/pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart
index f47115c..3d44bc1 100644
--- a/pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart
+++ b/pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart
@@ -20,7 +20,7 @@
 
 class DuplicateDefinitionVerifier {
   final LibraryElementImpl _currentLibrary;
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
   final DuplicationDefinitionContext context;
 
   final DiagnosticFactory _diagnosticFactory = DiagnosticFactory();
@@ -28,7 +28,7 @@
 
   DuplicateDefinitionVerifier(
     this._currentLibrary,
-    this._errorReporter,
+    this._diagnosticReporter,
     this.context,
   );
 
@@ -41,9 +41,9 @@
       if (element != null && element.isWildcardVariable) return;
       String exceptionName = exceptionParameter.name.lexeme;
       if (exceptionName == stackTraceParameter.name.lexeme) {
-        _errorReporter.reportError(
+        _diagnosticReporter.reportError(
           _diagnosticFactory.duplicateDefinitionForNodes(
-            _errorReporter.source,
+            _diagnosticReporter.source,
             CompileTimeErrorCode.DUPLICATE_DEFINITION,
             stackTraceParameter,
             exceptionParameter,
@@ -200,7 +200,7 @@
       var name = importPrefix.name3;
       if (name != null) {
         if (libraryDeclarations.withName(name) case var existing?) {
-          _errorReporter.reportError(
+          _diagnosticReporter.reportError(
             _diagnosticFactory.duplicateDefinition(
               CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER,
               importPrefix,
@@ -314,7 +314,7 @@
         var previous = setterScope[lookupName];
         if (previous != null) {
           _reportedTokens.add(identifier);
-          _errorReporter.reportError(
+          _diagnosticReporter.reportError(
             _diagnosticFactory.duplicateDefinition(
               getDiagnostic(previous, element),
               element,
@@ -330,7 +330,7 @@
       var previous = getterScope[lookupName];
       if (previous != null) {
         _reportedTokens.add(identifier);
-        _errorReporter.reportError(
+        _diagnosticReporter.reportError(
           _diagnosticFactory.duplicateDefinition(
             getDiagnostic(previous, element),
             element,
@@ -368,7 +368,7 @@
   final InheritanceManager3 _inheritanceManager;
   final LibraryElementImpl _currentLibrary;
   final LibraryFragmentImpl _currentUnit;
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
   final DuplicationDefinitionContext context;
   final DiagnosticFactory _diagnosticFactory = DiagnosticFactory();
 
@@ -376,7 +376,7 @@
     this._inheritanceManager,
     this._currentLibrary,
     this._currentUnit,
-    this._errorReporter,
+    this._diagnosticReporter,
     this.context,
   );
 
@@ -412,12 +412,12 @@
           var name = member.name?.lexeme ?? 'new';
           if (!constructorNames.add(name)) {
             if (name == 'new') {
-              _errorReporter.atConstructorDeclaration(
+              _diagnosticReporter.atConstructorDeclaration(
                 member,
                 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT,
               );
             } else {
-              _errorReporter.atConstructorDeclaration(
+              _diagnosticReporter.atConstructorDeclaration(
                 member,
                 CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME,
                 arguments: [name],
@@ -483,7 +483,7 @@
                 instanceSetters.containsKey(name)) {
               if (firstFragment is InterfaceFragmentImpl) {
                 String className = firstFragment.name2 ?? '';
-                _errorReporter.atToken(
+                _diagnosticReporter.atToken(
                   identifier,
                   CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE,
                   arguments: [className, name, className],
@@ -500,7 +500,7 @@
               instanceSetters.containsKey(name)) {
             if (firstFragment is InterfaceFragmentImpl) {
               String className = firstFragment.name2 ?? '';
-              _errorReporter.atToken(
+              _diagnosticReporter.atToken(
                 identifier,
                 CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE,
                 arguments: [className, name, className],
@@ -538,13 +538,13 @@
           errorCode =
               CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_AND_STATIC_SETTER;
         }
-        _errorReporter.atElement2(
+        _diagnosticReporter.atElement2(
           constructor.asElement2,
           errorCode,
           arguments: [name],
         );
       } else if (staticMember is MethodFragmentImpl) {
-        _errorReporter.atElement2(
+        _diagnosticReporter.atElement2(
           constructor.asElement2,
           CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_AND_STATIC_METHOD,
           arguments: [name],
@@ -607,7 +607,7 @@
     var previous = getterScope[name];
     if (previous != null) {
       if (!_isGetterSetterPair(element, previous)) {
-        _errorReporter.reportError(
+        _diagnosticReporter.reportError(
           _diagnosticFactory.duplicateDefinition(
             CompileTimeErrorCode.DUPLICATE_DEFINITION,
             element.asElement2!,
@@ -624,7 +624,7 @@
       if (element is PropertyAccessorFragmentImpl && element.isSetter) {
         previous = setterScope[name];
         if (previous != null) {
-          _errorReporter.reportError(
+          _diagnosticReporter.reportError(
             _diagnosticFactory.duplicateDefinition(
               CompileTimeErrorCode.DUPLICATE_DEFINITION,
               element.asElement2,
@@ -650,7 +650,7 @@
 
     for (var constant in node.constants) {
       if (constant.name.lexeme == declarationName) {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           constant.name,
           CompileTimeErrorCode.ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING,
         );
@@ -666,7 +666,7 @@
     _checkClassMembers(fragment, node.members);
 
     if (declarationName == 'values') {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         node.name,
         CompileTimeErrorCode.ENUM_WITH_NAME_VALUES,
       );
@@ -682,7 +682,7 @@
       var baseName = accessor.displayName;
       var inherited = _getInheritedMember(firstFragment, baseName);
       if (inherited is MethodFragmentImpl) {
-        _errorReporter.atElement2(
+        _diagnosticReporter.atElement2(
           accessor.asElement2,
           CompileTimeErrorCode.CONFLICTING_FIELD_AND_METHOD,
           arguments: [
@@ -704,7 +704,7 @@
       var baseName = method.displayName;
       var inherited = _getInheritedMember(firstFragment, baseName);
       if (inherited is PropertyAccessorFragmentImpl) {
-        _errorReporter.atElement2(
+        _diagnosticReporter.atElement2(
           method.asElement2,
           CompileTimeErrorCode.CONFLICTING_METHOD_AND_FIELD,
           arguments: [
@@ -733,7 +733,7 @@
       if (accessor.isStatic) {
         var instance = _getInterfaceMember(firstFragment, baseName);
         if (instance != null && baseName != 'values') {
-          _errorReporter.atElement2(
+          _diagnosticReporter.atElement2(
             accessor.asElement2,
             CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE,
             arguments: [declarationName, baseName, declarationName],
@@ -750,7 +750,7 @@
       if (method.isStatic) {
         var instance = _getInterfaceMember(firstFragment, baseName);
         if (instance != null) {
-          _errorReporter.atElement2(
+          _diagnosticReporter.atElement2(
             method.asElement2,
             CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE,
             arguments: [declarationName, baseName, declarationName],
@@ -782,7 +782,7 @@
             var name = identifier.lexeme;
             if (instanceGetters.containsKey(name) ||
                 instanceSetters.containsKey(name)) {
-              _errorReporter.atToken(
+              _diagnosticReporter.atToken(
                 identifier,
                 CompileTimeErrorCode.EXTENSION_CONFLICTING_STATIC_AND_INSTANCE,
                 arguments: [name],
@@ -796,7 +796,7 @@
           var name = identifier.lexeme;
           if (instanceGetters.containsKey(name) ||
               instanceSetters.containsKey(name)) {
-            _errorReporter.atToken(
+            _diagnosticReporter.atToken(
               identifier,
               CompileTimeErrorCode.EXTENSION_CONFLICTING_STATIC_AND_INSTANCE,
               arguments: [name],
@@ -876,7 +876,7 @@
 
   void _checkValuesDeclarationInEnum(Token name) {
     if (name.lexeme == 'values') {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         name,
         CompileTimeErrorCode.VALUES_DECLARATION_IN_ENUM,
       );
@@ -931,7 +931,7 @@
         inheritance,
         libraryElement,
         fileAnalysis.element,
-        fileAnalysis.errorReporter,
+        fileAnalysis.diagnosticReporter,
         libraryVerificationContext.duplicationDefinitionContext,
       );
     }
diff --git a/pkg/analyzer/lib/src/error/error_handler_verifier.dart b/pkg/analyzer/lib/src/error/error_handler_verifier.dart
index 8d12da4..ad584d2 100644
--- a/pkg/analyzer/lib/src/error/error_handler_verifier.dart
+++ b/pkg/analyzer/lib/src/error/error_handler_verifier.dart
@@ -35,7 +35,7 @@
 /// `Future<T>.catchError` must return `FutureOr<T>`, and any return statements
 /// in a function literal must return a value of type `FutureOr<T>`.
 class ErrorHandlerVerifier {
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
   final TypeProviderImpl _typeProvider;
 
@@ -46,7 +46,7 @@
   final bool _strictCasts;
 
   ErrorHandlerVerifier(
-    this._errorReporter,
+    this._diagnosticReporter,
     this._typeProvider,
     this._typeSystem, {
     required bool strictCasts,
@@ -54,7 +54,7 @@
        _returnTypeVerifier = ReturnTypeVerifier(
          typeProvider: _typeProvider,
          typeSystem: _typeSystem,
-         errorReporter: _errorReporter,
+         diagnosticReporter: _diagnosticReporter,
          strictCasts: strictCasts,
        );
 
@@ -201,7 +201,7 @@
     bool checkFirstParameterType = true,
   }) {
     void report() {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         expression,
         WarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE_TO_ERROR_HANDLER,
         arguments: [expressionType, expectedFunctionReturnType],
@@ -290,7 +290,7 @@
       expectedType,
       strictCasts: _strictCasts,
     )) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         callback,
         WarningCode.RETURN_TYPE_INVALID_FOR_CATCH_ERROR,
         arguments: [functionReturnType, expectedType],
diff --git a/pkg/analyzer/lib/src/error/getter_setter_types_verifier.dart b/pkg/analyzer/lib/src/error/getter_setter_types_verifier.dart
index c67711a..6b3312e 100644
--- a/pkg/analyzer/lib/src/error/getter_setter_types_verifier.dart
+++ b/pkg/analyzer/lib/src/error/getter_setter_types_verifier.dart
@@ -17,13 +17,13 @@
 class GetterSetterTypesVerifier {
   final LibraryElementImpl library;
   final TypeSystemImpl _typeSystem;
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
   GetterSetterTypesVerifier({
     required this.library,
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
   }) : _typeSystem = library.typeSystem,
-       _errorReporter = errorReporter;
+       _diagnosticReporter = diagnosticReporter;
 
   bool get _skipGetterSetterTypesCheck {
     return library.featureSet.isEnabled(Feature.getter_setter_error);
@@ -96,7 +96,7 @@
               setterName = '$setterClassName.$setterName';
             }
 
-            _errorReporter.atElement2(
+            _diagnosticReporter.atElement2(
               errorElement,
               CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES,
               arguments: [getterName, getterType, setterType, setterName],
@@ -137,7 +137,7 @@
 
     var getterType = _getGetterType(getter);
     if (!_typeSystem.isSubtypeOf(getterType, setterType)) {
-      _errorReporter.atElement2(
+      _diagnosticReporter.atElement2(
         getter,
         CompileTimeErrorCode.GETTER_NOT_SUBTYPE_SETTER_TYPES,
         arguments: [name, getterType, setterType, name],
diff --git a/pkg/analyzer/lib/src/error/ignore_validator.dart b/pkg/analyzer/lib/src/error/ignore_validator.dart
index e4561c7..2432c59 100644
--- a/pkg/analyzer/lib/src/error/ignore_validator.dart
+++ b/pkg/analyzer/lib/src/error/ignore_validator.dart
@@ -25,11 +25,11 @@
   static late DiagnosticCode unnecessaryIgnoreNameLocationLintCode;
   static late DiagnosticCode unnecessaryIgnoreNameFileLintCode;
 
-  /// The error reporter to which errors are to be reported.
-  final ErrorReporter _errorReporter;
+  /// The diagnostic reporter to which diagnostics are to be reported.
+  final DiagnosticReporter _diagnosticReporter;
 
   /// The diagnostics that are reported in the file being analyzed.
-  final List<Diagnostic> _reportedErrors;
+  final List<Diagnostic> _reportedDiagnostics;
 
   /// The information about the ignore comments in the file being analyzed.
   final IgnoreInfo _ignoreInfo;
@@ -50,8 +50,8 @@
   /// comments in the file being analyzed. The diagnostics will be reported to
   /// the [_errorReporter].
   IgnoreValidator(
-    this._errorReporter,
-    this._reportedErrors,
+    this._diagnosticReporter,
+    this._reportedDiagnostics,
     this._ignoreInfo,
     this._lineInfo,
     this._unignorableNames,
@@ -123,7 +123,7 @@
     //
     // Remove all of the errors that are actually being ignored.
     //
-    for (var error in _reportedErrors) {
+    for (var error in _reportedDiagnostics) {
       var lineNumber = _lineInfo.getLocation(error.offset).lineNumber;
       var ignoredOnLine = ignoredOnLineMap[lineNumber];
 
@@ -168,7 +168,7 @@
     for (var ignoredElement in duplicated) {
       if (ignoredElement is IgnoredDiagnosticName) {
         var name = ignoredElement.name;
-        _errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: ignoredElement.offset,
           length: name.length,
           diagnosticCode: WarningCode.DUPLICATE_IGNORE,
@@ -176,7 +176,7 @@
         );
         list.remove(ignoredElement);
       } else if (ignoredElement is IgnoredDiagnosticType) {
-        _errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: ignoredElement.offset,
           length: ignoredElement.length,
           diagnosticCode: WarningCode.DUPLICATE_IGNORE,
@@ -211,7 +211,7 @@
           } else if (state.isRemoved) {
             var replacedBy = state.replacedBy;
             if (replacedBy != null) {
-              _errorReporter.atOffset(
+              _diagnosticReporter.atOffset(
                 diagnosticCode: WarningCode.REPLACED_LINT_USE,
                 offset: ignoredName.offset,
                 length: name.length,
@@ -219,7 +219,7 @@
               );
               continue;
             } else {
-              _errorReporter.atOffset(
+              _diagnosticReporter.atOffset(
                 diagnosticCode: WarningCode.REMOVED_LINT_USE,
                 offset: ignoredName.offset,
                 length: name.length,
@@ -273,7 +273,7 @@
                   : unnecessaryIgnoreLocationLintCode;
         }
 
-        _errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           diagnosticCode: lintCode,
           offset: ignoredName.offset,
           length: name.length,
diff --git a/pkg/analyzer/lib/src/error/imports_verifier.dart b/pkg/analyzer/lib/src/error/imports_verifier.dart
index 31a043b..fdfc05b 100644
--- a/pkg/analyzer/lib/src/error/imports_verifier.dart
+++ b/pkg/analyzer/lib/src/error/imports_verifier.dart
@@ -100,10 +100,10 @@
   /// visitor, this method can be called to report an
   /// [WarningCode.DUPLICATE_EXPORT] hint for each of the export
   /// directives in the [_duplicateExports] list.
-  void generateDuplicateExportWarnings(ErrorReporter errorReporter) {
+  void generateDuplicateExportWarnings(DiagnosticReporter diagnosticReporter) {
     var length = _duplicateExports.length;
     for (var i = 0; i < length; i++) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         _duplicateExports[i].uri,
         WarningCode.DUPLICATE_EXPORT,
       );
@@ -114,10 +114,10 @@
   /// visitor, this method can be called to report an
   /// [WarningCode.DUPLICATE_IMPORT] hint for each of the import
   /// directives in the [_duplicateImports] list.
-  void generateDuplicateImportWarnings(ErrorReporter errorReporter) {
+  void generateDuplicateImportWarnings(DiagnosticReporter diagnosticReporter) {
     var length = _duplicateImports.length;
     for (var i = 0; i < length; i++) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         _duplicateImports[i].uri,
         WarningCode.DUPLICATE_IMPORT,
       );
@@ -130,7 +130,7 @@
   ///
   /// Only call this method after all of the compilation units have been visited
   /// by this visitor.
-  void generateDuplicateShownHiddenNameWarnings(ErrorReporter reporter) {
+  void generateDuplicateShownHiddenNameWarnings(DiagnosticReporter reporter) {
     _duplicateHiddenNamesMap.forEach((
       NamespaceDirective directive,
       List<SimpleIdentifier> identifiers,
@@ -161,7 +161,7 @@
   /// there exists at least one other import directive with the same prefix
   /// as the first import directive, and a "used elements" set which is a
   /// proper superset of the first import directive's "used elements" set.
-  void generateUnnecessaryImportHints(ErrorReporter errorReporter) {
+  void generateUnnecessaryImportHints(DiagnosticReporter diagnosticReporter) {
     var importsTracking = fileAnalysis.importsTracking;
     var usedImports = {..._allImports}..removeAll(_unusedImports);
 
@@ -213,7 +213,7 @@
         var secondElementUri = secondElement.uri;
         if (firstElementUri is DirectiveUriWithLibraryImpl &&
             secondElementUri is DirectiveUriWithLibraryImpl) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             firstDirective.uri,
             HintCode.UNNECESSARY_IMPORT,
             arguments: [
@@ -229,7 +229,7 @@
   }
 
   /// Reports [WarningCode.UNUSED_IMPORT] for each unused import.
-  void generateUnusedImportWarnings(ErrorReporter errorReporter) {
+  void generateUnusedImportWarnings(DiagnosticReporter diagnosticReporter) {
     var importsTracking = fileAnalysis.importsTracking;
     for (var importDirective in fileAnalysis.unit.directives) {
       if (importDirective is ImportDirectiveImpl) {
@@ -260,7 +260,7 @@
           var isUsed = tracking.importToUsedElements.containsKey(importElement);
           if (!isUsed) {
             _unusedImports.add(importDirective);
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               importDirective.uri,
               WarningCode.UNUSED_IMPORT,
               arguments: [uri.relativeUriString],
@@ -275,7 +275,7 @@
   /// for each unused shown name.
   ///
   /// This method should be invoked after [generateUnusedImportWarnings].
-  void generateUnusedShownNameHints(ErrorReporter reporter) {
+  void generateUnusedShownNameHints(DiagnosticReporter reporter) {
     var importsTracking = fileAnalysis.importsTracking;
     for (var importDirective in fileAnalysis.unit.directives) {
       if (importDirective is! ImportDirectiveImpl) {
diff --git a/pkg/analyzer/lib/src/error/inheritance_override.dart b/pkg/analyzer/lib/src/error/inheritance_override.dart
index b2c7b99..16b9289 100644
--- a/pkg/analyzer/lib/src/error/inheritance_override.dart
+++ b/pkg/analyzer/lib/src/error/inheritance_override.dart
@@ -29,7 +29,7 @@
   final TypeSystemImpl _typeSystem;
   final TypeProvider _typeProvider;
   final InheritanceManager3 _inheritance;
-  final ErrorReporter _reporter;
+  final DiagnosticReporter _reporter;
 
   InheritanceOverrideVerifier(
     this._typeSystem,
@@ -151,7 +151,7 @@
   final TypeSystemImpl typeSystem;
   final TypeProvider typeProvider;
   final InheritanceManager3 inheritance;
-  final ErrorReporter reporter;
+  final DiagnosticReporter reporter;
 
   final FeatureSet featureSet;
   final LibraryElementImpl library;
@@ -294,7 +294,7 @@
 
     GetterSetterTypesVerifier(
       library: library,
-      errorReporter: reporter,
+      diagnosticReporter: reporter,
     ).checkInterface(element, interface);
 
     if (firstFragment is ClassFragmentImpl && !firstFragment.isAbstract ||
@@ -352,7 +352,7 @@
           thisMember: concreteElement,
         ).verify(
           superMember: interfaceElement,
-          errorReporter: reporter,
+          diagnosticReporter: reporter,
           errorNode: classNameToken,
           diagnosticCode:
               concreteElement is SetterElement2OrMember
@@ -406,7 +406,7 @@
 
       correctOverrideHelper.verify(
         superMember: superMember.asElement2,
-        errorReporter: reporter,
+        diagnosticReporter: reporter,
         errorNode: node,
         diagnosticCode:
             member is SetterElement
diff --git a/pkg/analyzer/lib/src/error/language_version_override_verifier.dart b/pkg/analyzer/lib/src/error/language_version_override_verifier.dart
index a39b972..55cd29c 100644
--- a/pkg/analyzer/lib/src/error/language_version_override_verifier.dart
+++ b/pkg/analyzer/lib/src/error/language_version_override_verifier.dart
@@ -11,9 +11,9 @@
 class LanguageVersionOverrideVerifier {
   static final _overrideCommentLine = RegExp(r'^\s*//\s*@dart\s*=\s*\d+\.\d+');
 
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
-  LanguageVersionOverrideVerifier(this._errorReporter);
+  LanguageVersionOverrideVerifier(this._diagnosticReporter);
 
   void verify(CompilationUnit unit) {
     _verifyMisplaced(unit);
@@ -186,7 +186,7 @@
     // language version override comment.
 
     if (slashCount > 2) {
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: offset,
         length: length,
         diagnosticCode:
@@ -196,7 +196,7 @@
     }
 
     if (!atSignPresent) {
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: offset,
         length: length,
         diagnosticCode: WarningCode.INVALID_LANGUAGE_VERSION_OVERRIDE_AT_SIGN,
@@ -206,7 +206,7 @@
 
     if (possibleDart != 'dart') {
       // The 4 characters after `@` are "dart", but in the wrong case.
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: offset,
         length: length,
         diagnosticCode:
@@ -219,7 +219,7 @@
         comment.codeUnitAt(dartVersionSeparatorStartIndex) != 0x3D) {
       // The separator between "@dart" and the version number is either not
       // present, or is not a single "=" character.
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: offset,
         length: length,
         diagnosticCode: WarningCode.INVALID_LANGUAGE_VERSION_OVERRIDE_EQUALS,
@@ -228,7 +228,7 @@
     }
 
     if (containsInvalidVersionNumberPrefix) {
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: offset,
         length: length,
         diagnosticCode: WarningCode.INVALID_LANGUAGE_VERSION_OVERRIDE_PREFIX,
@@ -237,7 +237,7 @@
     }
 
     void reportInvalidNumber() {
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: offset,
         length: length,
         diagnosticCode: WarningCode.INVALID_LANGUAGE_VERSION_OVERRIDE_NUMBER,
@@ -273,7 +273,7 @@
 
     // This comment is a valid language version override, except for trailing
     // characters.
-    _errorReporter.atOffset(
+    _diagnosticReporter.atOffset(
       offset: offset,
       length: length,
       diagnosticCode:
@@ -303,7 +303,7 @@
           var match = _overrideCommentLine.firstMatch(lexeme);
           if (match != null) {
             var atDartStart = lexeme.indexOf('@dart');
-            _errorReporter.atOffset(
+            _diagnosticReporter.atOffset(
               offset: commentToken.offset + atDartStart,
               length: match.end - atDartStart,
               diagnosticCode:
diff --git a/pkg/analyzer/lib/src/error/literal_element_verifier.dart b/pkg/analyzer/lib/src/error/literal_element_verifier.dart
index d902de9..aee725a 100644
--- a/pkg/analyzer/lib/src/error/literal_element_verifier.dart
+++ b/pkg/analyzer/lib/src/error/literal_element_verifier.dart
@@ -17,7 +17,7 @@
 class LiteralElementVerifier {
   final TypeProvider typeProvider;
   final TypeSystemImpl typeSystem;
-  final ErrorReporter errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
   final FeatureSet featureSet;
   final ErrorVerifier _errorVerifier;
 
@@ -32,7 +32,7 @@
   LiteralElementVerifier(
     this.typeProvider,
     this.typeSystem,
-    this.errorReporter,
+    this._diagnosticReporter,
     this._errorVerifier, {
     this.forList = false,
     this.forSet = false,
@@ -77,7 +77,7 @@
         (forList: true, assignableWhenNullable: true) =>
           CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE_NULLABILITY,
       };
-      errorReporter.atNode(
+      _diagnosticReporter.atNode(
         errorNode,
         errorCode,
         arguments: [type, elementType],
@@ -97,7 +97,10 @@
           }
           _checkAssignableToElementType(element.typeOrThrow, element);
         } else {
-          errorReporter.atNode(element, CompileTimeErrorCode.EXPRESSION_IN_MAP);
+          _diagnosticReporter.atNode(
+            element,
+            CompileTimeErrorCode.EXPRESSION_IN_MAP,
+          );
         }
       case ForElementImpl():
         _verifyElement(element.body);
@@ -108,7 +111,7 @@
         if (forMap) {
           _verifyMapLiteralEntry(element);
         } else {
-          errorReporter.atNode(
+          _diagnosticReporter.atNode(
             element,
             CompileTimeErrorCode.MAP_ENTRY_NOT_IN_MAP,
           );
@@ -132,7 +135,10 @@
             element,
           );
         } else {
-          errorReporter.atNode(element, CompileTimeErrorCode.EXPRESSION_IN_MAP);
+          _diagnosticReporter.atNode(
+            element,
+            CompileTimeErrorCode.EXPRESSION_IN_MAP,
+          );
         }
       case null:
         break;
@@ -171,13 +177,13 @@
             typeSystem.makeNullable(mapKeyType),
             strictCasts: _strictCasts,
           )) {
-        errorReporter.atNode(
+        _diagnosticReporter.atNode(
           entry.key,
           CompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE_NULLABILITY,
           arguments: [keyType, mapKeyType],
         );
       } else {
-        errorReporter.atNode(
+        _diagnosticReporter.atNode(
           entry.key,
           CompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE,
           arguments: [keyType, mapKeyType],
@@ -202,13 +208,13 @@
             typeSystem.makeNullable(mapValueType),
             strictCasts: _strictCasts,
           )) {
-        errorReporter.atNode(
+        _diagnosticReporter.atNode(
           entry.value,
           CompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE_NULLABILITY,
           arguments: [valueType, mapValueType],
         );
       } else {
-        errorReporter.atNode(
+        _diagnosticReporter.atNode(
           entry.value,
           CompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE,
           arguments: [valueType, mapValueType],
@@ -223,7 +229,7 @@
     var expressionType = expression.typeOrThrow;
     if (expressionType is DynamicType) {
       if (_errorVerifier.strictCasts) {
-        errorReporter.atNode(
+        _diagnosticReporter.atNode(
           expression,
           CompileTimeErrorCode.NOT_ITERABLE_SPREAD,
         );
@@ -239,7 +245,7 @@
       if (isNullAware) {
         return;
       }
-      errorReporter.atNode(
+      _diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.NOT_NULL_AWARE_NULL_SPREAD,
       );
@@ -251,7 +257,7 @@
     );
 
     if (iterableType == null) {
-      return errorReporter.atNode(
+      return _diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.NOT_ITERABLE_SPREAD,
       );
@@ -276,7 +282,7 @@
         expression,
       );
       if (implicitCallMethod == null) {
-        errorReporter.atNode(
+        _diagnosticReporter.atNode(
           expression,
           errorCode,
           arguments: [iterableElementType, elementType],
@@ -287,7 +293,7 @@
           var typeArguments = typeSystem.inferFunctionTypeInstantiation(
             elementType as FunctionTypeImpl,
             tearoffType,
-            errorReporter: errorReporter,
+            diagnosticReporter: _diagnosticReporter,
             errorNode: expression,
             genericMetadataIsEnabled: true,
             inferenceUsingBoundsIsEnabled: featureSet.isEnabled(
@@ -309,7 +315,7 @@
           elementType,
           strictCasts: _strictCasts,
         )) {
-          errorReporter.atNode(
+          _diagnosticReporter.atNode(
             expression,
             errorCode,
             arguments: [iterableElementType, elementType],
@@ -325,7 +331,10 @@
     var expressionType = expression.typeOrThrow;
     if (expressionType is DynamicType) {
       if (_errorVerifier.strictCasts) {
-        errorReporter.atNode(expression, CompileTimeErrorCode.NOT_MAP_SPREAD);
+        _diagnosticReporter.atNode(
+          expression,
+          CompileTimeErrorCode.NOT_MAP_SPREAD,
+        );
       }
       return;
     }
@@ -338,7 +347,7 @@
       if (isNullAware) {
         return;
       }
-      errorReporter.atNode(
+      _diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.NOT_NULL_AWARE_NULL_SPREAD,
       );
@@ -348,7 +357,7 @@
     var mapType = expressionType.asInstanceOf2(typeProvider.mapElement2);
 
     if (mapType == null) {
-      return errorReporter.atNode(
+      return _diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.NOT_MAP_SPREAD,
       );
@@ -361,7 +370,7 @@
       mapKeyType!,
       strictCasts: _strictCasts,
     )) {
-      errorReporter.atNode(
+      _diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE,
         arguments: [keyType, mapKeyType],
@@ -375,7 +384,7 @@
       mapValueType!,
       strictCasts: _strictCasts,
     )) {
-      errorReporter.atNode(
+      _diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE,
         arguments: [valueType, mapValueType],
diff --git a/pkg/analyzer/lib/src/error/must_call_super_verifier.dart b/pkg/analyzer/lib/src/error/must_call_super_verifier.dart
index cdc98df..458a2e4 100644
--- a/pkg/analyzer/lib/src/error/must_call_super_verifier.dart
+++ b/pkg/analyzer/lib/src/error/must_call_super_verifier.dart
@@ -12,9 +12,9 @@
 import 'package:analyzer/src/error/codes.g.dart';
 
 class MustCallSuperVerifier {
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
-  MustCallSuperVerifier(this._errorReporter);
+  MustCallSuperVerifier(this._diagnosticReporter);
 
   void checkMethodDeclaration(MethodDeclaration node) {
     if (node.isStatic || node.isAbstract) {
@@ -177,7 +177,7 @@
     if (!declaredElement.invokesSuperSelf) {
       // Overridable elements are always enclosed in named elements, so it is
       // safe to assume [overriddenEnclosingName] is non-`null`.
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         node.name,
         WarningCode.MUST_CALL_SUPER,
         arguments: [overriddenEnclosingName!],
diff --git a/pkg/analyzer/lib/src/error/null_safe_api_verifier.dart b/pkg/analyzer/lib/src/error/null_safe_api_verifier.dart
index 2002f7e..b3fe3a6 100644
--- a/pkg/analyzer/lib/src/error/null_safe_api_verifier.dart
+++ b/pkg/analyzer/lib/src/error/null_safe_api_verifier.dart
@@ -18,10 +18,10 @@
 ///
 /// This verifier detects and reports those scenarios.
 class NullSafeApiVerifier {
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
   final TypeSystemImpl _typeSystem;
 
-  NullSafeApiVerifier(this._errorReporter, this._typeSystem);
+  NullSafeApiVerifier(this._diagnosticReporter, this._typeSystem);
 
   /// Reports an error if the expression creates a `Future<T>.value` with a non-
   /// nullable value `T` and an argument that is effectively `null`.
@@ -81,7 +81,7 @@
     var argumentIsNull = argument == null || _typeSystem.isNull(argumentType!);
 
     if (argumentIsNull) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         argument ?? node,
         WarningCode.NULL_ARGUMENT_TO_NON_NULL_TYPE,
         arguments: [memberName, type.getDisplayString()],
diff --git a/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart b/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart
index 2a2949a..71e93ab 100644
--- a/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart
+++ b/pkg/analyzer/lib/src/error/nullable_dereference_verifier.dart
@@ -17,17 +17,17 @@
 /// Helper for checking potentially nullable dereferences.
 class NullableDereferenceVerifier {
   final TypeSystemImpl _typeSystem;
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
   /// The resolver driving this participant.
   final ResolverVisitor _resolver;
 
   NullableDereferenceVerifier({
     required TypeSystemImpl typeSystem,
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
     required ResolverVisitor resolver,
   }) : _typeSystem = typeSystem,
-       _errorReporter = errorReporter,
+       _diagnosticReporter = diagnosticReporter,
        _resolver = resolver;
 
   bool expression(
@@ -51,14 +51,14 @@
       arguments = [];
     }
     if (errorEntity is AstNode) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         errorEntity,
         diagnosticCode,
         arguments: arguments,
         contextMessages: messages,
       );
     } else if (errorEntity is Token) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         errorEntity,
         diagnosticCode,
         arguments: arguments,
diff --git a/pkg/analyzer/lib/src/error/override_verifier.dart b/pkg/analyzer/lib/src/error/override_verifier.dart
index 789f617..0e7a250 100644
--- a/pkg/analyzer/lib/src/error/override_verifier.dart
+++ b/pkg/analyzer/lib/src/error/override_verifier.dart
@@ -13,7 +13,7 @@
 /// being used correctly.
 class OverrideVerifier extends RecursiveAstVisitor<void> {
   /// The error reporter used to report errors.
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _errorReporter;
 
   /// The current class or mixin.
   InterfaceElement? _currentClass;
diff --git a/pkg/analyzer/lib/src/error/redeclare_verifier.dart b/pkg/analyzer/lib/src/error/redeclare_verifier.dart
index ce07ad3..065a300 100644
--- a/pkg/analyzer/lib/src/error/redeclare_verifier.dart
+++ b/pkg/analyzer/lib/src/error/redeclare_verifier.dart
@@ -13,7 +13,7 @@
 /// have a redeclare annotation it is being used correctly.
 class RedeclareVerifier extends RecursiveAstVisitor<void> {
   /// The error reporter used to report errors.
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _errorReporter;
 
   /// The current extension type.
   InterfaceElement? _currentExtensionType;
diff --git a/pkg/analyzer/lib/src/error/required_parameters_verifier.dart b/pkg/analyzer/lib/src/error/required_parameters_verifier.dart
index a61dea4..628a987 100644
--- a/pkg/analyzer/lib/src/error/required_parameters_verifier.dart
+++ b/pkg/analyzer/lib/src/error/required_parameters_verifier.dart
@@ -14,7 +14,7 @@
 
 /// Checks for missing arguments for required named parameters.
 class RequiredParametersVerifier extends SimpleAstVisitor<void> {
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _errorReporter;
 
   RequiredParametersVerifier(this._errorReporter);
 
diff --git a/pkg/analyzer/lib/src/error/return_type_verifier.dart b/pkg/analyzer/lib/src/error/return_type_verifier.dart
index 59b9794..35f286c 100644
--- a/pkg/analyzer/lib/src/error/return_type_verifier.dart
+++ b/pkg/analyzer/lib/src/error/return_type_verifier.dart
@@ -18,7 +18,7 @@
 class ReturnTypeVerifier {
   final TypeProviderImpl _typeProvider;
   final TypeSystemImpl _typeSystem;
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
   final bool _strictCasts;
 
   late EnclosingExecutableContext enclosingExecutable;
@@ -26,11 +26,11 @@
   ReturnTypeVerifier({
     required TypeProviderImpl typeProvider,
     required TypeSystemImpl typeSystem,
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
     required bool strictCasts,
   }) : _typeProvider = typeProvider,
        _typeSystem = typeSystem,
-       _errorReporter = errorReporter,
+       _diagnosticReporter = diagnosticReporter,
        _strictCasts = strictCasts;
 
   DartType get _flattenedReturnType {
@@ -56,7 +56,7 @@
 
     if (enclosingExecutable.isGenerativeConstructor) {
       if (expression != null) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           expression,
           CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR,
         );
@@ -85,7 +85,7 @@
     void checkElement(ClassElementImpl2 expectedElement, DiagnosticCode code) {
       void reportError() {
         enclosingExecutable.hasLegalReturnType = false;
-        _errorReporter.atNode(returnType, code);
+        _diagnosticReporter.atNode(returnType, code);
       }
 
       // It is a compile-time error if the declared return type of
@@ -147,13 +147,13 @@
 
     void reportTypeError() {
       if (enclosingExecutable.catchErrorOnErrorReturnType != null) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           expression,
           WarningCode.RETURN_OF_INVALID_TYPE_FROM_CATCH_ERROR,
           arguments: [S, T],
         );
       } else if (enclosingExecutable.isClosure) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           expression,
           CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE,
           arguments: [S, T],
@@ -163,7 +163,7 @@
         // there is no enclosing element, in which case the `if` test above
         // would have failed.  So it's safe to assume that
         // `enclosingExecutable.displayName` is non-`null`.
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           expression,
           CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_CONSTRUCTOR,
           arguments: [S, T, enclosingExecutable.displayName!],
@@ -173,7 +173,7 @@
         // there is no enclosing element, in which case the `if` test above
         // would have failed.  So it's safe to assume that
         // `enclosingExecutable.displayName` is non-`null`.
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           expression,
           CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION,
           arguments: [S, T, enclosingExecutable.displayName!],
@@ -183,7 +183,7 @@
         // there is no enclosing element, in which case the `if` test above
         // would have failed.  So it's safe to assume that
         // `enclosingExecutable.displayName` is non-`null`.
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           expression,
           CompileTimeErrorCode.RETURN_OF_INVALID_TYPE_FROM_METHOD,
           arguments: [S, T, enclosingExecutable.displayName!],
@@ -221,7 +221,7 @@
             S,
             strictCasts: _strictCasts,
           )) {
-            _errorReporter.atNode(
+            _diagnosticReporter.atNode(
               expression,
               CompileTimeErrorCode
                   .RECORD_LITERAL_ONE_POSITIONAL_NO_TRAILING_COMMA,
@@ -285,7 +285,7 @@
       }
     }
 
-    _errorReporter.atToken(
+    _diagnosticReporter.atToken(
       statement.returnKeyword,
       CompileTimeErrorCode.RETURN_WITHOUT_VALUE,
     );
diff --git a/pkg/analyzer/lib/src/error/super_formal_parameters_verifier.dart b/pkg/analyzer/lib/src/error/super_formal_parameters_verifier.dart
index 6d86878..c83a5aa 100644
--- a/pkg/analyzer/lib/src/error/super_formal_parameters_verifier.dart
+++ b/pkg/analyzer/lib/src/error/super_formal_parameters_verifier.dart
@@ -9,7 +9,7 @@
 
 VerifySuperFormalParametersResult verifySuperFormalParameters({
   required ConstructorDeclaration constructor,
-  ErrorReporter? errorReporter,
+  DiagnosticReporter? diagnosticReporter,
   bool hasExplicitPositionalArguments = false,
 }) {
   var result = VerifySuperFormalParametersResult();
@@ -25,7 +25,7 @@
       } else {
         result.positionalArgumentCount++;
         if (hasExplicitPositionalArguments) {
-          errorReporter?.atToken(
+          diagnosticReporter?.atToken(
             parameter.name,
             CompileTimeErrorCode
                 .POSITIONAL_SUPER_FORMAL_PARAMETER_WITH_POSITIONAL_ARGUMENT,
diff --git a/pkg/analyzer/lib/src/error/todo_finder.dart b/pkg/analyzer/lib/src/error/todo_finder.dart
index eda9b83..4407dff 100644
--- a/pkg/analyzer/lib/src/error/todo_finder.dart
+++ b/pkg/analyzer/lib/src/error/todo_finder.dart
@@ -10,8 +10,8 @@
 
 /// Instances of the class `ToDoFinder` find to-do comments in Dart code.
 class TodoFinder {
-  /// The error reporter by which to-do comments will be reported.
-  final ErrorReporter _errorReporter;
+  /// The diagnostic reporter by which to-do comments will be reported.
+  final DiagnosticReporter _diagnosticReporter;
 
   /// A regex for whitespace and comment markers to be removed from the text
   /// of multiline TODOs in multiline comments.
@@ -27,7 +27,7 @@
   ///
   /// @param errorReporter the error reporter by which to-do comments will be
   ///        reported
-  TodoFinder(this._errorReporter);
+  TodoFinder(this._diagnosticReporter);
 
   /// Search the comments in the given compilation unit for to-do comments and
   /// report an error for each.
@@ -130,7 +130,7 @@
         }
       }
 
-      _errorReporter.atOffset(
+      _diagnosticReporter.atOffset(
         offset: offset,
         length: end - offset,
         diagnosticCode: Todo.forKind(todoKind),
diff --git a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
index 1f10412..fac6483 100644
--- a/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
+++ b/pkg/analyzer/lib/src/error/type_arguments_verifier.dart
@@ -24,12 +24,12 @@
 class TypeArgumentsVerifier {
   final AnalysisOptions _options;
   final LibraryElement _libraryElement;
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
   TypeArgumentsVerifier(
     this._options,
     this._libraryElement,
-    this._errorReporter,
+    this._diagnosticReporter,
   );
 
   TypeSystemImpl get _typeSystem =>
@@ -91,7 +91,7 @@
       if (!_typeSystem.isSubtypeOf(typeArgument, bound)) {
         var errorNode =
             i < typeArgumentListLength ? typeArgumentList.arguments[i] : node;
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           errorNode,
           CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
           arguments: [typeArgument, typeParameter.name3!, bound],
@@ -120,7 +120,7 @@
     if (typeArgumentList != null &&
         typeArgumentNodes != null &&
         typeArgumentNodes.length != typeParameters.length) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         typeArgumentList,
         CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_ENUM,
         arguments: [typeParameters.length, typeArgumentNodes.length],
@@ -147,7 +147,7 @@
 
       if (!_typeSystem.isSubtypeOf(typeArgument, bound)) {
         var errorTarget = typeArgumentNodes?[i] ?? node.name;
-        _errorReporter.atEntity(
+        _diagnosticReporter.atEntity(
           errorTarget,
           CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
           arguments: [typeArgument, typeParameter.name3!, bound],
@@ -286,7 +286,7 @@
         // Do not report a "Strict raw type" error in this case; too noisy.
         // See https://github.com/dart-lang/language/blob/master/resources/type-system/strict-raw-types.md#conditions-for-a-raw-type-hint
       } else {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           WarningCode.STRICT_RAW_TYPE,
           arguments: [type],
@@ -342,7 +342,7 @@
       if (typeArgument is FunctionTypeImpl &&
           typeArgument.typeParameters.isNotEmpty) {
         if (!_libraryElement.featureSet.isEnabled(Feature.generic_metadata)) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             _typeArgumentErrorNode(namedType, i),
             CompileTimeErrorCode.GENERIC_FUNCTION_TYPE_CANNOT_BE_TYPE_ARGUMENT,
           );
@@ -384,7 +384,7 @@
       void addMessage(String message) {
         messages.add(
           DiagnosticMessageImpl(
-            filePath: _errorReporter.source.fullName,
+            filePath: _diagnosticReporter.source.fullName,
             length: namedType.length,
             message: message,
             offset: namedType.offset,
@@ -420,7 +420,7 @@
     // If not allowed to be super-bounded, report issues.
     if (!_shouldAllowSuperBoundedTypes(namedType)) {
       for (var issue in issues) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           _typeArgumentErrorNode(namedType, issue.index),
           CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
           arguments: [
@@ -468,7 +468,7 @@
       bound = invertedSubstitution.substituteType(bound);
 
       if (!_typeSystem.isSubtypeOf(typeArgument, bound)) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           _typeArgumentErrorNode(namedType, i),
           CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
           arguments: [typeArgument, typeParameterName, bound],
@@ -518,7 +518,7 @@
 
       if (argType is FunctionTypeImpl && argType.typeParameters.isNotEmpty) {
         if (!_libraryElement.featureSet.isEnabled(Feature.generic_metadata)) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             typeArgumentList[i],
             CompileTimeErrorCode.GENERIC_FUNCTION_TYPE_CANNOT_BE_TYPE_ARGUMENT,
           );
@@ -540,7 +540,7 @@
       var substitution = Substitution.fromPairs2(fnTypeParams, typeArgs);
       var bound = substitution.substituteType(rawBound);
       if (!_typeSystem.isSubtypeOf(argType, bound)) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           typeArgumentList[i],
           CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
           arguments: [argType, fnTypeParamName, bound],
@@ -562,7 +562,7 @@
     switch (typeAnnotation) {
       case NamedType(:var type, :var typeArguments):
         if (type is TypeParameterType) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             typeAnnotation,
             errorCode,
             arguments: [typeAnnotation.name.lexeme],
@@ -576,7 +576,7 @@
         for (var parameter in parameters.parameters) {
           if (parameter case SimpleFormalParameter(type: var typeAnnotation?)) {
             if (typeAnnotation case TypeAnnotation(:TypeParameterType type)) {
-              _errorReporter.atNode(
+              _diagnosticReporter.atNode(
                 typeAnnotation,
                 errorCode,
                 arguments: [type],
@@ -591,7 +591,11 @@
         }
         if (returnType case TypeAnnotation(:var type)) {
           if (type is TypeParameterType) {
-            _errorReporter.atNode(returnType, errorCode, arguments: [type]);
+            _diagnosticReporter.atNode(
+              returnType,
+              errorCode,
+              arguments: [type],
+            );
           } else {
             _checkTypeArgumentConst(returnType, errorCode);
           }
@@ -600,7 +604,11 @@
         for (var field in fields) {
           var typeAnnotation = field.type;
           if (typeAnnotation case TypeAnnotation(:TypeParameterType type)) {
-            _errorReporter.atNode(typeAnnotation, errorCode, arguments: [type]);
+            _diagnosticReporter.atNode(
+              typeAnnotation,
+              errorCode,
+              arguments: [type],
+            );
           } else {
             _checkTypeArgumentConst(typeAnnotation, errorCode);
           }
@@ -617,7 +625,7 @@
   ) {
     int actualCount = typeArguments.arguments.length;
     if (actualCount != expectedCount) {
-      _errorReporter.atNode(typeArguments, code, arguments: [actualCount]);
+      _diagnosticReporter.atNode(typeArguments, code, arguments: [actualCount]);
     }
   }
 
diff --git a/pkg/analyzer/lib/src/error/unicode_text_verifier.dart b/pkg/analyzer/lib/src/error/unicode_text_verifier.dart
index b04407f..4a24893 100644
--- a/pkg/analyzer/lib/src/error/unicode_text_verifier.dart
+++ b/pkg/analyzer/lib/src/error/unicode_text_verifier.dart
@@ -9,8 +9,8 @@
 /// A verifier that checks for unsafe Unicode text.
 /// See: https://nvd.nist.gov/vuln/detail/CVE-2021-22567
 class UnicodeTextVerifier {
-  final ErrorReporter errorReporter;
-  UnicodeTextVerifier(this.errorReporter);
+  final DiagnosticReporter _diagnosticReporter;
+  UnicodeTextVerifier(this._diagnosticReporter);
 
   void verify(CompilationUnit unit, String source) {
     for (var offset = 0; offset < source.length; ++offset) {
@@ -28,7 +28,7 @@
                 ? WarningCode.TEXT_DIRECTION_CODE_POINT_IN_LITERAL
                 : WarningCode.TEXT_DIRECTION_CODE_POINT_IN_COMMENT;
         var code = codeUnit.toRadixString(16).toUpperCase();
-        errorReporter.atOffset(
+        _diagnosticReporter.atOffset(
           offset: offset,
           length: 1,
           diagnosticCode: errorCode,
diff --git a/pkg/analyzer/lib/src/error/use_result_verifier.dart b/pkg/analyzer/lib/src/error/use_result_verifier.dart
index 31dffd6..176204b 100644
--- a/pkg/analyzer/lib/src/error/use_result_verifier.dart
+++ b/pkg/analyzer/lib/src/error/use_result_verifier.dart
@@ -10,9 +10,9 @@
 import 'package:collection/collection.dart';
 
 class UseResultVerifier {
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
-  UseResultVerifier(this._errorReporter);
+  UseResultVerifier(this._diagnosticReporter);
 
   void checkFunctionExpressionInvocation(FunctionExpressionInvocation node) {
     var element = node.element;
@@ -108,13 +108,13 @@
 
     var message = _getUseResultMessage(annotation);
     if (message == null || message.isEmpty) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         toAnnotate,
         WarningCode.UNUSED_RESULT,
         arguments: [displayName],
       );
     } else {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         toAnnotate,
         WarningCode.UNUSED_RESULT_WITH_MESSAGE,
         arguments: [displayName, message],
diff --git a/pkg/analyzer/lib/src/error/widget_preview_verifier.dart b/pkg/analyzer/lib/src/error/widget_preview_verifier.dart
index bdc6269..14380b6f 100644
--- a/pkg/analyzer/lib/src/error/widget_preview_verifier.dart
+++ b/pkg/analyzer/lib/src/error/widget_preview_verifier.dart
@@ -27,9 +27,9 @@
 ///  - Are statically accessible (e.g., no instance methods)
 ///  - Have explicit implementations (e.g., not abstract or external)
 class WidgetPreviewVerifier {
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
-  WidgetPreviewVerifier(this._errorReporter);
+  WidgetPreviewVerifier(this._diagnosticReporter);
 
   /// Check is [node] is a Widget Preview application and verify its
   /// correctness.
@@ -64,14 +64,14 @@
     };
 
     if (!isValidApplication) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node.name,
         WarningCode.INVALID_WIDGET_PREVIEW_APPLICATION,
       );
     }
 
     var visitor = _InvalidWidgetPreviewArgumentDetectorVisitor(
-      errorReporter: _errorReporter,
+      errorReporter: _diagnosticReporter,
     );
     node.arguments!.accept(visitor);
   }
@@ -205,7 +205,7 @@
 }
 
 class _InvalidWidgetPreviewArgumentDetectorVisitor extends RecursiveAstVisitor {
-  final ErrorReporter errorReporter;
+  final DiagnosticReporter errorReporter;
 
   NamedExpression? rootArgument;
   _InvalidWidgetPreviewArgumentDetectorVisitor({required this.errorReporter});
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 285b5d4..9d99063 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -76,7 +76,7 @@
 
 /// A parser listener that builds the analyzer's AST structure.
 class AstBuilder extends StackListener {
-  final FastaErrorReporter errorReporter;
+  final FastaErrorReporter diagnosticReporter;
   final Uri fileUri;
   ScriptTagImpl? scriptTag;
   final List<DirectiveImpl> directives = [];
@@ -175,14 +175,14 @@
   Token? _enclosingDeclarationAugmentToken;
 
   AstBuilder(
-    ErrorReporter? errorReporter,
+    DiagnosticReporter? errorReporter,
     this.fileUri,
     this.isFullAst,
     this._featureSet,
     this._languageVersion,
     this._lineInfo, [
     Uri? uri,
-  ]) : errorReporter = FastaErrorReporter(errorReporter),
+  ]) : diagnosticReporter = FastaErrorReporter(errorReporter),
        enableAugmentations = _featureSet.isEnabled(Feature.augmentations),
        enableTripleShift = _featureSet.isEnabled(Feature.triple_shift),
        enableNonFunctionTypeAliases = _featureSet.isEnabled(
@@ -230,7 +230,7 @@
             false)) {
       message = messageDirectiveAfterDeclaration;
     }
-    errorReporter.reportMessage(message, charOffset, length);
+    diagnosticReporter.reportMessage(message, charOffset, length);
   }
 
   @override
@@ -1912,7 +1912,7 @@
       // Check for extension type name conflict.
       var representationName = representation.fieldName;
       if (representationName.lexeme == builder.name.lexeme) {
-        errorReporter.errorReporter?.atToken(
+        diagnosticReporter.diagnosticReporter?.atToken(
           representationName,
           ParserErrorCode.MEMBER_WITH_CLASS_NAME,
         );
@@ -2884,7 +2884,7 @@
     var withClause = pop(NullValues.WithClause) as WithClauseImpl;
     var superclass = pop() as TypeAnnotationImpl;
     if (superclass is! NamedTypeImpl) {
-      errorReporter.errorReporter?.atNode(
+      diagnosticReporter.diagnosticReporter?.atNode(
         superclass,
         ParserErrorCode.EXPECTED_NAMED_TYPE_EXTENDS,
       );
@@ -3045,7 +3045,10 @@
         components: libraryNameOrUri as List<SimpleIdentifierImpl>,
       );
       if (_featureSet.isEnabled(Feature.enhanced_parts)) {
-        errorReporter.errorReporter?.atNode(name, ParserErrorCode.PART_OF_NAME);
+        diagnosticReporter.diagnosticReporter?.atNode(
+          name,
+          ParserErrorCode.PART_OF_NAME,
+        );
       }
     }
     var metadata = pop() as List<AnnotationImpl>?;
@@ -3108,7 +3111,7 @@
         case var formalParameterType?:
           fieldType = formalParameterType;
         case null:
-          errorReporter.errorReporter?.atToken(
+          diagnosticReporter.diagnosticReporter?.atToken(
             leftParenthesis.next!,
             ParserErrorCode.EXPECTED_REPRESENTATION_TYPE,
           );
@@ -3124,7 +3127,7 @@
       }
       if (firstFormalParameter.keyword case var keyword?) {
         if (keyword.keyword != Keyword.CONST) {
-          errorReporter.errorReporter?.atToken(
+          diagnosticReporter.diagnosticReporter?.atToken(
             keyword,
             ParserErrorCode.REPRESENTATION_FIELD_MODIFIER,
           );
@@ -3135,19 +3138,19 @@
       var maybeComma = firstFormalParameter.endToken.next;
       if (maybeComma != null && maybeComma.type == TokenType.COMMA) {
         if (formalParameterList.parameters.length == 1) {
-          errorReporter.errorReporter?.atToken(
+          diagnosticReporter.diagnosticReporter?.atToken(
             maybeComma,
             ParserErrorCode.REPRESENTATION_FIELD_TRAILING_COMMA,
           );
         } else {
-          errorReporter.errorReporter?.atToken(
+          diagnosticReporter.diagnosticReporter?.atToken(
             maybeComma,
             ParserErrorCode.MULTIPLE_REPRESENTATION_FIELDS,
           );
         }
       }
     } else {
-      errorReporter.errorReporter?.atToken(
+      diagnosticReporter.diagnosticReporter?.atToken(
         leftParenthesis.next!,
         ParserErrorCode.EXPECTED_REPRESENTATION_FIELD,
       );
@@ -4185,7 +4188,7 @@
       //  any type annotation for recovery purposes, and (b) extending the
       //  parser to parse a generic function type at this location.
       if (supertype != null) {
-        errorReporter.errorReporter?.atNode(
+        diagnosticReporter.diagnosticReporter?.atNode(
           supertype,
           ParserErrorCode.EXPECTED_NAMED_TYPE_EXTENDS,
         );
@@ -4303,7 +4306,7 @@
 
     if (_enclosingDeclarationAugmentToken != null) {
       if (variable.lexeme == 'augmented') {
-        errorReporter.errorReporter?.atToken(
+        diagnosticReporter.diagnosticReporter?.atToken(
           variable,
           ParserErrorCode.DECLARATION_NAMED_AUGMENTED_INSIDE_AUGMENTATION,
         );
@@ -4547,7 +4550,7 @@
 
   @override
   void handleErrorToken(ErrorToken token) {
-    translateErrorToken(token, errorReporter.reportScannerError);
+    translateErrorToken(token, diagnosticReporter.reportScannerError);
   }
 
   @override
@@ -4790,7 +4793,7 @@
     if (_enclosingDeclarationAugmentToken != null) {
       if (token.lexeme == 'augmented') {
         if (context.inDeclaration) {
-          errorReporter.errorReporter?.atToken(
+          diagnosticReporter.diagnosticReporter?.atToken(
             token,
             ParserErrorCode.DECLARATION_NAMED_AUGMENTED_INSIDE_AUGMENTATION,
           );
@@ -5307,7 +5310,7 @@
     SimpleIdentifierImpl name;
     var nameCandidate = pop();
     if (nameCandidate is AugmentedExpressionImpl) {
-      errorReporter.errorReporter?.atNode(
+      diagnosticReporter.diagnosticReporter?.atNode(
         nameCandidate,
         ParserErrorCode.INVALID_USE_OF_IDENTIFIER_AUGMENTED,
       );
@@ -5683,7 +5686,7 @@
     }
     debugEvent("Error: ${message.problemMessage}");
     if (message.code.analyzerCodes == null && startToken is ErrorToken) {
-      translateErrorToken(startToken, errorReporter.reportScannerError);
+      translateErrorToken(startToken, diagnosticReporter.reportScannerError);
     } else {
       int offset = startToken.offset;
       int length = endToken.end - offset;
@@ -5923,7 +5926,7 @@
     IdentifierImpl name;
     var nameCandidate = pop();
     if (nameCandidate is AugmentedExpressionImpl) {
-      errorReporter.errorReporter?.atNode(
+      diagnosticReporter.diagnosticReporter?.atNode(
         nameCandidate,
         ParserErrorCode.INVALID_USE_OF_IDENTIFIER_AUGMENTED,
       );
@@ -6074,7 +6077,7 @@
     // Build and return the comment.
     return DocCommentBuilder(
       parser,
-      errorReporter.errorReporter,
+      diagnosticReporter.diagnosticReporter,
       uri,
       _featureSet,
       _languageVersion,
@@ -6213,7 +6216,7 @@
       for (var formalParameter in parameters.parameters) {
         var notDefault = formalParameter.notDefault;
         if (notDefault is FieldFormalParameterImpl) {
-          errorReporter.errorReporter?.atToken(
+          diagnosticReporter.diagnosticReporter?.atToken(
             notDefault.thisKeyword,
             ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_FIELD_INITIALIZERS,
           );
@@ -6371,7 +6374,7 @@
       if (type is NamedTypeImpl) {
         namedTypes.add(type);
       } else {
-        errorReporter.errorReporter?.atNode(type, code);
+        diagnosticReporter.diagnosticReporter?.atNode(type, code);
       }
     }
     return namedTypes;
diff --git a/pkg/analyzer/lib/src/fasta/doc_comment_builder.dart b/pkg/analyzer/lib/src/fasta/doc_comment_builder.dart
index 7b86e4a..c528543 100644
--- a/pkg/analyzer/lib/src/fasta/doc_comment_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/doc_comment_builder.dart
@@ -113,7 +113,7 @@
 /// is ultimately built with [build].
 final class DocCommentBuilder {
   final Parser _parser;
-  final ErrorReporter? _errorReporter;
+  final DiagnosticReporter? _diagnosticReporter;
   final Uri _uri;
   final FeatureSet _featureSet;
   final LibraryLanguageVersion _languageVersion;
@@ -130,7 +130,7 @@
 
   DocCommentBuilder(
     this._parser,
-    this._errorReporter,
+    this._diagnosticReporter,
     this._uri,
     this._featureSet,
     this._languageVersion,
@@ -202,7 +202,7 @@
           // `null`.
           var openingTag = builder.openingTag;
           if (openingTag != null) {
-            _errorReporter?.atOffset(
+            _diagnosticReporter?.atOffset(
               offset: openingTag.offset,
               length: openingTag.end - openingTag.offset,
               diagnosticCode: WarningCode.DOC_DIRECTIVE_MISSING_CLOSING_TAG,
@@ -219,7 +219,7 @@
     }
 
     // No matching opening tag was found.
-    _errorReporter?.atOffset(
+    _diagnosticReporter?.atOffset(
       offset: closingTag.offset,
       length: closingTag.end - closingTag.offset,
       diagnosticCode: WarningCode.DOC_DIRECTIVE_MISSING_OPENING_TAG,
@@ -301,7 +301,7 @@
       // `null`.
       var openingTag = builder.openingTag;
       if (openingTag != null) {
-        _errorReporter?.atOffset(
+        _diagnosticReporter?.atOffset(
           offset: openingTag.offset,
           length: openingTag.end - openingTag.offset,
           diagnosticCode: WarningCode.DOC_DIRECTIVE_MISSING_CLOSING_TAG,
@@ -349,7 +349,7 @@
       nameEnd: _characterSequence._offset + nameEnd,
       content: content,
       index: index,
-      errorReporter: _errorReporter,
+      diagnosticReporter: _diagnosticReporter,
     );
 
     switch (name) {
@@ -392,7 +392,7 @@
         _pushDocDirective(parser.simpleDirective(DocDirectiveType.youtube));
         return true;
     }
-    _errorReporter?.atOffset(
+    _diagnosticReporter?.atOffset(
       offset: _characterSequence._offset + nameIndex,
       length: nameEnd - nameIndex,
       diagnosticCode: WarningCode.DOC_DIRECTIVE_UNKNOWN,
@@ -439,7 +439,7 @@
 
     var token = result.tokens;
     var docImportListener = AstBuilder(
-      _errorReporter,
+      _diagnosticReporter,
       _uri,
       true /* isFullAst */,
       _featureSet,
@@ -1079,7 +1079,7 @@
   /// The length of [content].
   final int _length;
 
-  final ErrorReporter? _errorReporter;
+  final DiagnosticReporter? _diagnosticReporter;
 
   /// The current position in [content].
   int index;
@@ -1097,11 +1097,11 @@
     required this.nameEnd,
     required this.content,
     required this.index,
-    required ErrorReporter? errorReporter,
+    required DiagnosticReporter? diagnosticReporter,
   }) : _contentOffset = contentOffset,
        _offset = offset,
        _length = content.length,
-       _errorReporter = errorReporter;
+       _diagnosticReporter = diagnosticReporter;
 
   /// Parses a non-block (single line) doc directive.
   DocDirectiveTag directive(DocDirectiveType type) {
@@ -1212,7 +1212,7 @@
 
     // We've hit EOL without closing brace.
     _end = _offset + index;
-    _errorReporter?.atOffset(
+    _diagnosticReporter?.atOffset(
       offset: _offset + index - 1,
       length: 1,
       diagnosticCode: WarningCode.DOC_DIRECTIVE_MISSING_CLOSING_BRACE,
@@ -1247,7 +1247,7 @@
       index++;
       if (index == _length) {
         // Found extra arguments and no closing brace.
-        _errorReporter?.atOffset(
+        _diagnosticReporter?.atOffset(
           offset: _offset + index - 1,
           length: 1,
           diagnosticCode: WarningCode.DOC_DIRECTIVE_MISSING_CLOSING_BRACE,
@@ -1257,7 +1257,7 @@
     }
 
     var errorLength = _offset + index - extraArgumentsOffset;
-    _errorReporter?.atOffset(
+    _diagnosticReporter?.atOffset(
       offset: extraArgumentsOffset,
       length: errorLength,
       diagnosticCode: WarningCode.DOC_DIRECTIVE_HAS_EXTRA_ARGUMENTS,
diff --git a/pkg/analyzer/lib/src/fasta/error_converter.dart b/pkg/analyzer/lib/src/fasta/error_converter.dart
index d5a5bab..8c5384a 100644
--- a/pkg/analyzer/lib/src/fasta/error_converter.dart
+++ b/pkg/analyzer/lib/src/fasta/error_converter.dart
@@ -18,12 +18,12 @@
 /// An error reporter that knows how to convert a Fasta error into an analyzer
 /// error.
 class FastaErrorReporter {
-  /// The underlying error reporter to which errors are reported.
-  final ErrorReporter? errorReporter;
+  /// The underlying diagnostic reporter to which diagnostics are reported.
+  final DiagnosticReporter? diagnosticReporter;
 
-  /// Initialize a newly created error reporter to report errors to the given
-  /// [errorReporter].
-  FastaErrorReporter(this.errorReporter);
+  /// Initialize a newly created error reporter to report diagnostics to the
+  /// given [diagnosticReporter].
+  FastaErrorReporter(this.diagnosticReporter);
 
   void reportByCode(
     String? analyzerCode,
@@ -37,28 +37,28 @@
 
     switch (analyzerCode) {
       case "ASYNC_FOR_IN_WRONG_CONTEXT":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.ASYNC_FOR_IN_WRONG_CONTEXT,
         );
         return;
       case "ASYNC_KEYWORD_USED_AS_IDENTIFIER":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER,
         );
         return;
       case "AWAIT_IN_WRONG_CONTEXT":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT,
         );
         return;
       case "BUILT_IN_IDENTIFIER_AS_TYPE":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE,
@@ -66,7 +66,7 @@
         );
         return;
       case "CONCRETE_CLASS_WITH_ABSTRACT_MEMBER":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode:
@@ -74,7 +74,7 @@
         );
         return;
       case "CONST_CONSTRUCTOR_WITH_BODY":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY,
@@ -82,7 +82,7 @@
         return;
       case "CONST_NOT_INITIALIZED":
         var name = arguments['name'] as String;
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.CONST_NOT_INITIALIZED,
@@ -90,14 +90,14 @@
         );
         return;
       case "DEFAULT_VALUE_IN_FUNCTION_TYPE":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE,
         );
         return;
       case "LABEL_UNDEFINED":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.LABEL_UNDEFINED,
@@ -105,35 +105,35 @@
         );
         return;
       case "EMPTY_ENUM_BODY":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.EMPTY_ENUM_BODY,
         );
         return;
       case "EXPECTED_CLASS_MEMBER":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.EXPECTED_CLASS_MEMBER,
         );
         return;
       case "EXPECTED_EXECUTABLE":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.EXPECTED_EXECUTABLE,
         );
         return;
       case "EXPECTED_STRING_LITERAL":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.EXPECTED_STRING_LITERAL,
         );
         return;
       case "EXPECTED_TOKEN":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.EXPECTED_TOKEN,
@@ -141,7 +141,7 @@
         );
         return;
       case "EXPECTED_TYPE_NAME":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.EXPECTED_TYPE_NAME,
@@ -152,7 +152,7 @@
         // [ErrorVerifier._checkForExtensionDeclaresInstanceField]
         return;
       case "FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode:
@@ -161,7 +161,7 @@
         return;
       case "FINAL_NOT_INITIALIZED":
         var name = arguments['name'] as String;
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.FINAL_NOT_INITIALIZED,
@@ -170,7 +170,7 @@
         return;
       case "FINAL_NOT_INITIALIZED_CONSTRUCTOR_1":
         var name = arguments['name'] as String;
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode:
@@ -179,14 +179,14 @@
         );
         return;
       case "GETTER_WITH_PARAMETERS":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.GETTER_WITH_PARAMETERS,
         );
         return;
       case "ILLEGAL_CHARACTER":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ScannerErrorCode.ILLEGAL_CHARACTER,
@@ -195,7 +195,7 @@
       case "INVALID_ASSIGNMENT":
         var type1 = arguments['type'] as Object;
         var type2 = arguments['type2'] as Object;
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.INVALID_ASSIGNMENT,
@@ -203,77 +203,77 @@
         );
         return;
       case "INVALID_INLINE_FUNCTION_TYPE":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.INVALID_INLINE_FUNCTION_TYPE,
         );
         return;
       case "INVALID_LITERAL_IN_CONFIGURATION":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.INVALID_LITERAL_IN_CONFIGURATION,
         );
         return;
       case "IMPORT_OF_NON_LIBRARY":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY,
         );
         return;
       case "INVALID_CAST_FUNCTION":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.INVALID_CAST_FUNCTION,
         );
         return;
       case "INVALID_CAST_FUNCTION_EXPR":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.INVALID_CAST_FUNCTION_EXPR,
         );
         return;
       case "INVALID_CAST_LITERAL_LIST":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.INVALID_CAST_LITERAL_LIST,
         );
         return;
       case "INVALID_CAST_LITERAL_MAP":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.INVALID_CAST_LITERAL_MAP,
         );
         return;
       case "INVALID_CAST_LITERAL_SET":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.INVALID_CAST_LITERAL_SET,
         );
         return;
       case "INVALID_CAST_METHOD":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.INVALID_CAST_METHOD,
         );
         return;
       case "INVALID_CAST_NEW_EXPR":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.INVALID_CAST_NEW_EXPR,
         );
         return;
       case "INVALID_CODE_POINT":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.INVALID_CODE_POINT,
@@ -281,14 +281,14 @@
         );
         return;
       case "INVALID_GENERIC_FUNCTION_TYPE":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.INVALID_GENERIC_FUNCTION_TYPE,
         );
         return;
       case "INVALID_METHOD_OVERRIDE":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.INVALID_OVERRIDE,
@@ -311,175 +311,175 @@
         );
         return;
       case "MISSING_DIGIT":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           diagnosticCode: ScannerErrorCode.MISSING_DIGIT,
           offset: offset,
           length: length,
         );
         return;
       case "MISSING_ENUM_BODY":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.MISSING_ENUM_BODY,
         );
         return;
       case "MISSING_FUNCTION_BODY":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.MISSING_FUNCTION_BODY,
         );
         return;
       case "MISSING_FUNCTION_PARAMETERS":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.MISSING_FUNCTION_PARAMETERS,
         );
         return;
       case "MISSING_HEX_DIGIT":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ScannerErrorCode.MISSING_HEX_DIGIT,
         );
         return;
       case "MISSING_IDENTIFIER":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.MISSING_IDENTIFIER,
         );
         return;
       case "MISSING_METHOD_PARAMETERS":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.MISSING_METHOD_PARAMETERS,
         );
         return;
       case "MISSING_STAR_AFTER_SYNC":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.MISSING_STAR_AFTER_SYNC,
         );
         return;
       case "MISSING_TYPEDEF_PARAMETERS":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.MISSING_TYPEDEF_PARAMETERS,
         );
         return;
       case "MULTIPLE_IMPLEMENTS_CLAUSES":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.MULTIPLE_IMPLEMENTS_CLAUSES,
         );
         return;
       case "NAMED_FUNCTION_EXPRESSION":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.NAMED_FUNCTION_EXPRESSION,
         );
         return;
       case "NAMED_PARAMETER_OUTSIDE_GROUP":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP,
         );
         return;
       case "NON_PART_OF_DIRECTIVE_IN_PART":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.NON_PART_OF_DIRECTIVE_IN_PART,
         );
         return;
       case "NON_SYNC_FACTORY":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.NON_SYNC_FACTORY,
         );
         return;
       case "POSITIONAL_AFTER_NAMED_ARGUMENT":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.POSITIONAL_AFTER_NAMED_ARGUMENT,
         );
         return;
       case "RECURSIVE_CONSTRUCTOR_REDIRECT":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT,
         );
         return;
       case "RETURN_IN_GENERATOR":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.RETURN_IN_GENERATOR,
         );
         return;
       case "SUPER_INVOCATION_NOT_LAST":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.SUPER_INVOCATION_NOT_LAST,
         );
         return;
       case "SUPER_IN_REDIRECTING_CONSTRUCTOR":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR,
         );
         return;
       case "UNDEFINED_CLASS":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.UNDEFINED_CLASS,
         );
         return;
       case "UNDEFINED_GETTER":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.UNDEFINED_GETTER,
         );
         return;
       case "UNDEFINED_METHOD":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.UNDEFINED_METHOD,
         );
         return;
       case "UNDEFINED_SETTER":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: CompileTimeErrorCode.UNDEFINED_SETTER,
         );
         return;
       case "UNEXPECTED_DOLLAR_IN_STRING":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ScannerErrorCode.UNEXPECTED_DOLLAR_IN_STRING,
         );
         return;
       case "UNEXPECTED_TOKEN":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ParserErrorCode.UNEXPECTED_TOKEN,
@@ -487,21 +487,21 @@
         );
         return;
       case "UNTERMINATED_MULTI_LINE_COMMENT":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ScannerErrorCode.UNTERMINATED_MULTI_LINE_COMMENT,
         );
         return;
       case "UNTERMINATED_STRING_LITERAL":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode: ScannerErrorCode.UNTERMINATED_STRING_LITERAL,
         );
         return;
       case "WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode:
@@ -509,7 +509,7 @@
         );
         return;
       case "WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER":
-        errorReporter?.atOffset(
+        diagnosticReporter?.atOffset(
           offset: offset,
           length: length,
           diagnosticCode:
@@ -569,9 +569,9 @@
     if (index > 0 && index < fastaAnalyzerErrorCodes.length) {
       var errorCode = fastaAnalyzerErrorCodes[index];
       if (errorCode != null) {
-        errorReporter!.reportError(
+        diagnosticReporter!.reportError(
           Diagnostic.tmp(
-            source: errorReporter!.source,
+            source: diagnosticReporter!.source,
             offset: offset,
             length: length,
             errorCode: errorCode,
@@ -591,7 +591,7 @@
   ) {
     // TODO(danrubel): update client to pass length in addition to offset.
     int length = 1;
-    errorReporter?.atOffset(
+    diagnosticReporter?.atOffset(
       diagnosticCode: errorCode,
       offset: offset,
       length: length,
@@ -605,10 +605,10 @@
     required DiagnosticCode code,
     required Message message,
   }) {
-    if (errorReporter != null) {
-      errorReporter!.reportError(
+    if (diagnosticReporter != null) {
+      diagnosticReporter!.reportError(
         Diagnostic.tmp(
-          source: errorReporter!.source,
+          source: diagnosticReporter!.source,
           offset: offset,
           length: length,
           errorCode: code,
diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart
index d7e3a53..0a2123e 100644
--- a/pkg/analyzer/lib/src/generated/element_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/element_resolver.dart
@@ -105,7 +105,7 @@
     return false;
   }
 
-  ErrorReporter get _errorReporter => _resolver.errorReporter;
+  DiagnosticReporter get _diagnosticReporter => _resolver.diagnosticReporter;
 
   TypeProviderImpl get _typeProvider => _resolver.typeProvider;
 
@@ -393,13 +393,13 @@
     var element = superType.lookUpConstructor2(superName, _definingLibrary);
     if (element == null || !element.isAccessibleIn2(_definingLibrary)) {
       if (name != null) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER,
           arguments: [superType, name.name],
         );
       } else {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT,
           arguments: [superType],
@@ -412,7 +412,7 @@
           !element.enclosingElement.constructors.every(
             (constructor) => constructor.isFactory,
           )) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR,
           arguments: [element],
@@ -449,14 +449,17 @@
     switch (context) {
       case SuperContext.annotation:
       case SuperContext.static:
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT,
         );
       case SuperContext.extension:
-        _errorReporter.atNode(node, CompileTimeErrorCode.SUPER_IN_EXTENSION);
+        _diagnosticReporter.atNode(
+          node,
+          CompileTimeErrorCode.SUPER_IN_EXTENSION,
+        );
       case SuperContext.extensionType:
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.SUPER_IN_EXTENSION_TYPE,
         );
@@ -491,7 +494,7 @@
     return ResolverVisitor.resolveArgumentsToParameters(
       argumentList: argumentList,
       formalParameters: executableElement.formalParameters,
-      errorReporter: _errorReporter,
+      diagnosticReporter: _diagnosticReporter,
       enclosingConstructor: enclosingConstructor,
     );
   }
diff --git a/pkg/analyzer/lib/src/generated/error_detection_helpers.dart b/pkg/analyzer/lib/src/generated/error_detection_helpers.dart
index 8af16e1..7801cf5 100644
--- a/pkg/analyzer/lib/src/generated/error_detection_helpers.dart
+++ b/pkg/analyzer/lib/src/generated/error_detection_helpers.dart
@@ -27,7 +27,7 @@
 /// more easily shared between the two visitors that do the majority of error
 /// reporting (ResolverVisitor and ErrorVerifier).
 mixin ErrorDetectionHelpers {
-  ErrorReporter get errorReporter;
+  DiagnosticReporter get diagnosticReporter;
 
   InheritanceManager3 get inheritance;
 
@@ -115,7 +115,7 @@
           actualStaticType,
           strictCasts: strictCasts,
         )) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             expression,
             CompileTimeErrorCode
                 .RECORD_LITERAL_ONE_POSITIONAL_NO_TRAILING_COMMA,
@@ -158,7 +158,7 @@
             }
           }
         }
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           getErrorNode(expression),
           diagnosticCode,
           arguments: [
@@ -173,7 +173,7 @@
         );
         return;
       }
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         getErrorNode(expression),
         diagnosticCode,
         arguments: [actualStaticType, expectedStaticType],
@@ -221,14 +221,14 @@
     if (isConstConstructor) {
       // TODO(paulberry): this error should be based on the actual type of the
       // constant, not the static type.  See dartbug.com/21119.
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE,
         arguments: [staticType, fieldType],
         contextMessages: messages,
       );
     } else {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.FIELD_INITIALIZER_NOT_ASSIGNABLE,
         arguments: [staticType, fieldType],
@@ -272,9 +272,15 @@
 
     if (expression is MethodInvocation) {
       SimpleIdentifier methodName = expression.methodName;
-      errorReporter.atNode(methodName, CompileTimeErrorCode.USE_OF_VOID_RESULT);
+      diagnosticReporter.atNode(
+        methodName,
+        CompileTimeErrorCode.USE_OF_VOID_RESULT,
+      );
     } else {
-      errorReporter.atNode(expression, CompileTimeErrorCode.USE_OF_VOID_RESULT);
+      diagnosticReporter.atNode(
+        expression,
+        CompileTimeErrorCode.USE_OF_VOID_RESULT,
+      );
     }
 
     return true;
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 9fafe01..6af6799 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -60,7 +60,7 @@
 ///
 /// See [CompileTimeErrorCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND].
 void checkForTypeParameterBoundRecursion(
-  ErrorReporter errorReporter,
+  DiagnosticReporter diagnosticReporter,
   List<TypeParameter> parameters,
 ) {
   Map<TypeParameterElement, TypeParameter>? elementToNode;
@@ -87,7 +87,7 @@
           var element = parameter.declaredFragment!.element;
           // This error can only occur if there is a bound, so we can safely
           // assume `element.bound` is non-`null`.
-          errorReporter.atToken(
+          diagnosticReporter.atToken(
             parameter.name,
             CompileTimeErrorCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND,
             arguments: [element.displayName, element.bound!],
@@ -202,7 +202,7 @@
 
   /// The error reporter by which errors will be reported.
   @override
-  final ErrorReporter errorReporter;
+  final DiagnosticReporter diagnosticReporter;
 
   /// The current library that is being analyzed.
   final LibraryElementImpl _currentLibrary;
@@ -298,7 +298,7 @@
 
   /// Initialize a newly created error verifier.
   ErrorVerifier(
-    this.errorReporter,
+    this.diagnosticReporter,
     this._currentLibrary,
     this._currentUnit,
     this._typeProvider,
@@ -306,13 +306,17 @@
     this.libraryContext,
     this.options, {
     required this.typeSystemOperations,
-  }) : _uninstantiatedBoundChecker = _UninstantiatedBoundChecker(errorReporter),
-       _checkUseVerifier = UseResultVerifier(errorReporter),
-       _requiredParametersVerifier = RequiredParametersVerifier(errorReporter),
-       _constArgumentsVerifier = ConstArgumentsVerifier(errorReporter),
+  }) : _uninstantiatedBoundChecker = _UninstantiatedBoundChecker(
+         diagnosticReporter,
+       ),
+       _checkUseVerifier = UseResultVerifier(diagnosticReporter),
+       _requiredParametersVerifier = RequiredParametersVerifier(
+         diagnosticReporter,
+       ),
+       _constArgumentsVerifier = ConstArgumentsVerifier(diagnosticReporter),
        _duplicateDefinitionVerifier = DuplicateDefinitionVerifier(
          _currentLibrary,
-         errorReporter,
+         diagnosticReporter,
          libraryContext.duplicationDefinitionContext,
        ) {
     _isInSystemLibrary = _currentLibrary.source.uri.isScheme('dart');
@@ -323,12 +327,12 @@
     _typeArgumentsVerifier = TypeArgumentsVerifier(
       options,
       _currentLibrary,
-      errorReporter,
+      diagnosticReporter,
     );
     _returnTypeVerifier = ReturnTypeVerifier(
       typeProvider: _typeProvider,
       typeSystem: typeSystem,
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
       strictCasts: strictCasts,
     );
   }
@@ -404,7 +408,7 @@
   @override
   void visitAwaitExpression(AwaitExpression node) {
     if (!_enclosingExecutable.isAsynchronous) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         node.awaitKeyword,
         CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT,
       );
@@ -463,7 +467,7 @@
     if (labelNode != null) {
       var labelElement = labelNode.element;
       if (labelElement is LabelElementImpl2 && labelElement.isOnSwitchMember) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           labelNode,
           CompileTimeErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER,
         );
@@ -524,7 +528,7 @@
 
       if (node.nativeClause == null) {
         libraryContext.constructorFieldsVerifier.addConstructors(
-          errorReporter,
+          diagnosticReporter,
           augmented,
           members,
         );
@@ -543,7 +547,7 @@
 
       GetterSetterTypesVerifier(
         library: _currentLibrary,
-        errorReporter: errorReporter,
+        diagnosticReporter: diagnosticReporter,
       ).checkStaticGetters(augmented.getters);
 
       super.visitClassDeclaration(node);
@@ -611,7 +615,7 @@
 
     GetterSetterTypesVerifier(
       library: _currentLibrary,
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
     ).checkStaticGetters(fragment.element.getters);
 
     super.visitCompilationUnit(node);
@@ -754,7 +758,7 @@
 
       if (!declaredFragment.isAugmentation) {
         if (element.constants2.isEmpty) {
-          errorReporter.atToken(
+          diagnosticReporter.atToken(
             node.name,
             CompileTimeErrorCode.ENUM_WITHOUT_CONSTANTS,
           );
@@ -763,7 +767,7 @@
 
       var members = node.members;
       libraryContext.constructorFieldsVerifier.addConstructors(
-        errorReporter,
+        diagnosticReporter,
         element,
         members,
       );
@@ -774,7 +778,7 @@
 
       GetterSetterTypesVerifier(
         library: _currentLibrary,
-        errorReporter: errorReporter,
+        diagnosticReporter: diagnosticReporter,
       ).checkStaticGetters(declaredElement.getters);
 
       super.visitEnumDeclaration(node);
@@ -818,7 +822,7 @@
 
     GetterSetterTypesVerifier(
       library: _currentLibrary,
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
     ).checkExtension(declaredElement);
 
     var name = node.name;
@@ -858,7 +862,7 @@
       _checkForConflictingClassMembers(declaredFragment);
       _checkForConflictingGenerics(node);
       libraryContext.constructorFieldsVerifier.addConstructors(
-        errorReporter,
+        diagnosticReporter,
         declaredElement,
         members,
       );
@@ -880,7 +884,7 @@
       var interface = _inheritanceManager.getInterface(firstFragment);
       GetterSetterTypesVerifier(
         library: _currentLibrary,
-        errorReporter: errorReporter,
+        diagnosticReporter: diagnosticReporter,
       ).checkExtensionType(declaredElement, interface);
 
       super.visitExtensionTypeDeclaration(node);
@@ -897,7 +901,7 @@
         !node.isStatic && !node.fields.isLate;
     if (!_isInStaticVariableDeclaration) {
       if (fields.isConst) {
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           fields.keyword!,
           CompileTimeErrorCode.CONST_INSTANCE_FIELD,
         );
@@ -942,7 +946,7 @@
     DeclaredIdentifier loopVariable = node.loopVariable;
     if (_checkForEachParts(node, loopVariable.declaredFragment?.element)) {
       if (loopVariable.isConst) {
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           loopVariable.keyword!,
           CompileTimeErrorCode.FOR_IN_WITH_CONST_VARIABLE,
         );
@@ -1325,7 +1329,10 @@
     // TODO(brianwilkerson): Figure out the right rule for when 'native' is
     // allowed.
     if (!_isInSystemLibrary) {
-      errorReporter.atNode(node, ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE);
+      diagnosticReporter.atNode(
+        node,
+        ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE,
+      );
     }
     super.visitNativeClause(node);
   }
@@ -1512,7 +1519,7 @@
     super.visitSuperFormalParameter(node);
 
     if (_enclosingClass is ExtensionTypeElement) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         node.superKeyword,
         CompileTimeErrorCode
             .EXTENSION_TYPE_CONSTRUCTOR_WITH_SUPER_FORMAL_PARAMETER,
@@ -1523,7 +1530,7 @@
     var constructor = node.parentFormalParameterList.parent;
     if (!(constructor is ConstructorDeclaration &&
         constructor.isNonRedirectingGenerative)) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         node.superKeyword,
         CompileTimeErrorCode.INVALID_SUPER_FORMAL_PARAMETER_LOCATION,
       );
@@ -1535,7 +1542,7 @@
     var superParameter = element.superConstructorParameter2;
 
     if (superParameter == null) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         node.name,
         node.isNamed
             ? CompileTimeErrorCode
@@ -1550,7 +1557,7 @@
       element.type,
       superParameter.type,
     )) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         node.name,
         CompileTimeErrorCode
             .SUPER_FORMAL_PARAMETER_TYPE_IS_NOT_SUBTYPE_OF_ASSOCIATED,
@@ -1757,7 +1764,7 @@
       for (int i = 0; i < count; i++) {
         var deferredToken = directives[i].deferredKeyword;
         if (deferredToken != null) {
-          errorReporter.atToken(
+          diagnosticReporter.atToken(
             deferredToken,
             CompileTimeErrorCode.SHARED_DEFERRED_PREFIX,
           );
@@ -1771,13 +1778,13 @@
     FieldElement fieldElement,
   ) {
     if (fieldElement.isAbstract) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         identifier,
         CompileTimeErrorCode.ABSTRACT_FIELD_CONSTRUCTOR_INITIALIZER,
       );
     }
     if (fieldElement.isExternal) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         identifier,
         CompileTimeErrorCode.EXTERNAL_FIELD_CONSTRUCTOR_INITIALIZER,
       );
@@ -1791,20 +1798,20 @@
     if (node.initializer != null) {
       if (declaredElement is FieldElement) {
         if (declaredElement.isAbstract) {
-          errorReporter.atToken(
+          diagnosticReporter.atToken(
             node.name,
             CompileTimeErrorCode.ABSTRACT_FIELD_INITIALIZER,
           );
         }
         if (declaredElement.isExternal) {
-          errorReporter.atToken(
+          diagnosticReporter.atToken(
             node.name,
             CompileTimeErrorCode.EXTERNAL_FIELD_INITIALIZER,
           );
         }
       } else if (declaredElement is TopLevelVariableElement) {
         if (declaredElement.isExternal) {
-          errorReporter.atToken(
+          diagnosticReporter.atToken(
             node.name,
             CompileTimeErrorCode.EXTERNAL_VARIABLE_INITIALIZER,
           );
@@ -1904,7 +1911,7 @@
         if (redirectedConstructor.name != null) {
           constructorStrName += ".${redirectedConstructor.name!.name}";
         }
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           redirectedConstructor,
           CompileTimeErrorCode.REDIRECT_TO_MISSING_CONSTRUCTOR,
           arguments: [constructorStrName, redirectedType],
@@ -1923,7 +1930,7 @@
       constructorReturnType,
       strictCasts: strictCasts,
     )) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         redirectedConstructor,
         CompileTimeErrorCode.REDIRECT_TO_INVALID_RETURN_TYPE,
         arguments: [redirectedReturnType, constructorReturnType],
@@ -1931,7 +1938,7 @@
       return;
     } else if (!typeSystem.isSubtypeOf(redirectedType, constructorType)) {
       // Check parameters.
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         redirectedConstructor,
         CompileTimeErrorCode.REDIRECT_TO_INVALID_FUNCTION_TYPE,
         arguments: [redirectedType, constructorType],
@@ -1963,7 +1970,7 @@
       var element = definedNames[name]!;
       var prevElement = libraryContext._exportedElements[name];
       if (prevElement != null && prevElement != element) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           directive.uri,
           CompileTimeErrorCode.AMBIGUOUS_EXPORT,
           arguments: [name, prevElement.library2!.uri, element.library2!.uri],
@@ -1986,7 +1993,7 @@
       var libraryNames =
           conflictingMembers.map((e) => _getLibraryName(e)).toList();
       libraryNames.sort();
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         name,
         CompileTimeErrorCode.AMBIGUOUS_IMPORT,
         arguments: [name.lexeme, libraryNames.quotedAndCommaSeparatedWithAnd],
@@ -2018,7 +2025,7 @@
     // check if element is assignable
     if (element is VariableElement) {
       if (element.isConst) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           expression,
           CompileTimeErrorCode.ASSIGNMENT_TO_CONST,
         );
@@ -2029,18 +2036,18 @@
         return;
       }
       if (variable.isConst) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           expression,
           CompileTimeErrorCode.ASSIGNMENT_TO_CONST,
         );
       } else if (variable is FieldElement && variable.isSynthetic) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           highlightedNode,
           CompileTimeErrorCode.ASSIGNMENT_TO_FINAL_NO_SETTER,
           arguments: [variable.name3!, variable.enclosingElement.displayName],
         );
       } else {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           highlightedNode,
           CompileTimeErrorCode.ASSIGNMENT_TO_FINAL,
           arguments: [variable.name3!],
@@ -2048,25 +2055,28 @@
       }
     } else if (element is LocalFunctionElement ||
         element is TopLevelFunctionElement) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.ASSIGNMENT_TO_FUNCTION,
       );
     } else if (element is MethodElement) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.ASSIGNMENT_TO_METHOD,
       );
     } else if (element is InterfaceElement ||
         element is DynamicElementImpl2 ||
         element is TypeParameterElement) {
-      errorReporter.atNode(expression, CompileTimeErrorCode.ASSIGNMENT_TO_TYPE);
+      diagnosticReporter.atNode(
+        expression,
+        CompileTimeErrorCode.ASSIGNMENT_TO_TYPE,
+      );
     }
   }
 
   void _checkForAwaitInLateLocalVariableInitializer(AwaitExpression node) {
     if (_isInLateLocalVariable.last) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         node.awaitKeyword,
         CompileTimeErrorCode.AWAIT_IN_LATE_LOCAL_VARIABLE_INITIALIZER,
       );
@@ -2077,7 +2087,7 @@
     var expression = node.expression;
     var expressionType = expression.typeOrThrow;
     if (typeSystem.isIncompatibleWithAwait(expressionType)) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         node.awaitKeyword,
         CompileTimeErrorCode.AWAIT_OF_INCOMPATIBLE_TYPE,
       );
@@ -2098,7 +2108,7 @@
     if (superclass != null) {
       var type = superclass.type;
       if (type != null && type.isDartCoreFunction) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           superclass,
           WarningCode.DEPRECATED_EXTENDS_FUNCTION,
         );
@@ -2109,7 +2119,7 @@
       for (var interface in implementsClause.interfaces) {
         var type = interface.type;
         if (type != null && type.isDartCoreFunction) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             interface,
             WarningCode.DEPRECATED_IMPLEMENTS_FUNCTION,
           );
@@ -2122,7 +2132,10 @@
       for (NamedType mixin in withClause.mixinTypes) {
         var type = mixin.type;
         if (type != null && type.isDartCoreFunction) {
-          errorReporter.atNode(mixin, WarningCode.DEPRECATED_MIXIN_FUNCTION);
+          diagnosticReporter.atNode(
+            mixin,
+            WarningCode.DEPRECATED_MIXIN_FUNCTION,
+          );
         }
       }
     }
@@ -2156,13 +2169,13 @@
             // to avoid double errors if implementing `int`.
             if (interfaceElement is ClassElementImpl2 &&
                 !interfaceElement.isSealed) {
-              errorReporter.atNode(
+              diagnosticReporter.atNode(
                 interface,
                 CompileTimeErrorCode.BASE_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY,
                 arguments: [interfaceElement.name3!],
               );
             } else if (interfaceElement is MixinElement) {
-              errorReporter.atNode(
+              diagnosticReporter.atNode(
                 interface,
                 CompileTimeErrorCode.BASE_MIXIN_IMPLEMENTED_OUTSIDE_OF_LIBRARY,
                 arguments: [interfaceElement.name3!],
@@ -2184,7 +2197,7 @@
   /// [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME].
   void _checkForBuiltInIdentifierAsName(Token token, DiagnosticCode code) {
     if (token.type.isKeyword && token.keyword?.isPseudo != true) {
-      errorReporter.atToken(token, code, arguments: [token.lexeme]);
+      diagnosticReporter.atToken(token, code, arguments: [token.lexeme]);
     }
   }
 
@@ -2204,7 +2217,7 @@
                 Feature.class_modifiers,
               ) &&
               !_mayIgnoreClassModifiers(withElement.library2)) {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               withMixin,
               CompileTimeErrorCode.CLASS_USED_AS_MIXIN,
               arguments: [withElement.name3!],
@@ -2250,7 +2263,7 @@
 
       if (method.isStatic) {
         void reportStaticConflict(ExecutableElementOrMember inherited) {
-          errorReporter.atElement2(
+          diagnosticReporter.atElement2(
             method.asElement2,
             CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE,
             arguments: [
@@ -2278,7 +2291,7 @@
       }
 
       void reportFieldConflict(PropertyAccessorElementOrMember inherited) {
-        errorReporter.atElement2(
+        diagnosticReporter.atElement2(
           method.asElement2,
           CompileTimeErrorCode.CONFLICTING_METHOD_AND_FIELD,
           arguments: [
@@ -2315,7 +2328,7 @@
               ?.asElement;
 
       if (accessor.isStatic && inherited != null) {
-        errorReporter.atElement2(
+        diagnosticReporter.atElement2(
           accessor.asElement2,
           CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE,
           arguments: [
@@ -2330,7 +2343,7 @@
         if (enclosingClass is ExtensionTypeElementImpl2) {
           continue;
         }
-        errorReporter.atElement2(
+        diagnosticReporter.atElement2(
           accessor.asElement2,
           CompileTimeErrorCode.CONFLICTING_FIELD_AND_METHOD,
           arguments: [
@@ -2357,7 +2370,7 @@
         var setterName = methodName.forSetter;
         var setter = inherited[setterName];
         if (setter is PropertyAccessorElementOrMember) {
-          errorReporter.atElement2(
+          diagnosticReporter.atElement2(
             enclosingClass,
             CompileTimeErrorCode.CONFLICTING_INHERITED_METHOD_AND_SETTER,
             arguments: [
@@ -2410,7 +2423,7 @@
             enclosingClass is MixinElement
                 ? CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MIXIN
                 : CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS;
-        errorReporter.atElement2(typeParameter, code, arguments: [name]);
+        diagnosticReporter.atElement2(typeParameter, code, arguments: [name]);
       }
       // check members
       if (enclosingClass.getNamedConstructor2(name) != null ||
@@ -2423,7 +2436,7 @@
                     .CONFLICTING_TYPE_VARIABLE_AND_MEMBER_MIXIN
                 : CompileTimeErrorCode
                     .CONFLICTING_TYPE_VARIABLE_AND_MEMBER_CLASS;
-        errorReporter.atElement2(typeParameter, code, arguments: [name]);
+        diagnosticReporter.atElement2(typeParameter, code, arguments: [name]);
       }
     }
   }
@@ -2435,7 +2448,7 @@
       var name = typeParameter.name2 ?? '';
       // name is same as the name of the enclosing enum
       if (fragment.name2 == name) {
-        errorReporter.atElement2(
+        diagnosticReporter.atElement2(
           typeParameter.asElement2,
           CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_ENUM,
           arguments: [name],
@@ -2446,7 +2459,7 @@
       if (element.getMethod(name) != null ||
           element.getGetter(name) != null ||
           element.getSetter(name) != null) {
-        errorReporter.atElement2(
+        diagnosticReporter.atElement2(
           typeParameter.asElement2,
           CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_ENUM,
           arguments: [name],
@@ -2464,7 +2477,7 @@
       var name = typeParameter.name2 ?? '';
       // name is same as the name of the enclosing class
       if (fragment.name2 == name) {
-        errorReporter.atElement2(
+        diagnosticReporter.atElement2(
           typeParameter.asElement2,
           CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_EXTENSION_TYPE,
           arguments: [name],
@@ -2476,7 +2489,7 @@
           element.getMethod(name) != null ||
           element.getGetter(name) != null ||
           element.getSetter(name) != null) {
-        errorReporter.atElement2(
+        diagnosticReporter.atElement2(
           typeParameter.asElement2,
           CompileTimeErrorCode
               .CONFLICTING_TYPE_VARIABLE_AND_MEMBER_EXTENSION_TYPE,
@@ -2498,7 +2511,7 @@
 
       // name is same as the name of the enclosing class
       if (_enclosingExtension!.name3 == name) {
-        errorReporter.atElement2(
+        diagnosticReporter.atElement2(
           typeParameter,
           CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_EXTENSION,
           arguments: [name],
@@ -2508,7 +2521,7 @@
       if (_enclosingExtension!.getMethod(name) != null ||
           _enclosingExtension!.getGetter(name) != null ||
           _enclosingExtension!.getSetter(name) != null) {
-        errorReporter.atElement2(
+        diagnosticReporter.atElement2(
           typeParameter,
           CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER_EXTENSION,
           arguments: [name],
@@ -2530,7 +2543,7 @@
 
     for (var error in errors) {
       if (error is IncompatibleInterfacesClassHierarchyError) {
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           node.name,
           CompileTimeErrorCode.CONFLICTING_GENERIC_INTERFACES,
           arguments: [
@@ -2563,7 +2576,7 @@
     for (ConstructorInitializer initializer in declaration.initializers) {
       if (initializer is RedirectingConstructorInvocation) {
         if (redirectingInitializerCount > 0) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             initializer,
             CompileTimeErrorCode.MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS,
           );
@@ -2577,14 +2590,14 @@
             if (invocation.constructorName != null) {
               constructorStrName += ".${invocation.constructorName!.name}";
             }
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               invocation,
               CompileTimeErrorCode.REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR,
               arguments: [constructorStrName, enclosingNamedType],
             );
           } else {
             if (redirectingElement.isFactory) {
-              errorReporter.atNode(
+              diagnosticReporter.atNode(
                 initializer,
                 CompileTimeErrorCode
                     .REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR,
@@ -2602,13 +2615,13 @@
         redirectingInitializerCount++;
       } else if (initializer is SuperConstructorInvocation) {
         if (enclosingClass is EnumElement) {
-          errorReporter.atToken(
+          diagnosticReporter.atToken(
             initializer.superKeyword,
             CompileTimeErrorCode.SUPER_IN_ENUM_CONSTRUCTOR,
           );
         } else if (superInitializerCount == 1) {
           // Only report the second (first illegal) superinitializer.
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             initializer,
             CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS,
           );
@@ -2623,20 +2636,20 @@
       for (ConstructorInitializer initializer in declaration.initializers) {
         if (initializer is SuperConstructorInvocation) {
           if (enclosingClass is! EnumElement) {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               initializer,
               CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR,
             );
           }
         }
         if (initializer is ConstructorFieldInitializer) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             initializer,
             CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR,
           );
         }
         if (initializer is AssertInitializer) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             initializer,
             CompileTimeErrorCode.ASSERT_IN_REDIRECTING_CONSTRUCTOR,
           );
@@ -2655,7 +2668,7 @@
         if (constructorName != null) {
           constructorStrName += '.${constructorName.name}';
         }
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           superInitializer.superKeyword,
           CompileTimeErrorCode.SUPER_INVOCATION_NOT_LAST,
           arguments: [constructorStrName],
@@ -2710,7 +2723,7 @@
     }
     if (instanceFields.length == 1) {
       var field = instanceFields.single;
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         constructor.returnType,
         CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELD,
         arguments: ["'${field.enclosingElement.name3}.${field.name3}'"],
@@ -2720,7 +2733,7 @@
       var fieldNames = instanceFields
           .map((field) => "'${field.enclosingElement.name3}.${field.name3}'")
           .join(', ');
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         constructor.returnType,
         CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN_WITH_FIELDS,
         arguments: [fieldNames],
@@ -2755,7 +2768,7 @@
             .firstOrNull;
     var errorNode = superInvocation ?? constructor.returnType;
 
-    errorReporter.atNode(
+    diagnosticReporter.atNode(
       errorNode,
       CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER,
       arguments: [element.enclosingElement.displayName],
@@ -2781,7 +2794,7 @@
     if (classElement is! ClassElement || !classElement.hasNonFinalField) {
       return;
     }
-    errorReporter.atConstructorDeclaration(
+    diagnosticReporter.atConstructorDeclaration(
       constructor,
       CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD,
     );
@@ -2799,7 +2812,7 @@
     NamedType namedType,
   ) {
     if (namedType.isDeferred) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         constructorName,
         CompileTimeErrorCode.CONST_DEFERRED_CLASS,
       );
@@ -2812,7 +2825,7 @@
   /// See [CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION].
   void _checkForConstEvalThrowsException(ThrowExpression expression) {
     if (_enclosingExecutable.isConstConstructor) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION,
       );
@@ -2833,7 +2846,7 @@
     if (element is ClassElement && element.isAbstract) {
       var constructorElement = expression.constructorName.element;
       if (constructorElement != null && !constructorElement.isFactory) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           namedType,
           CompileTimeErrorCode.INSTANTIATE_ABSTRACT_CLASS,
         );
@@ -2848,7 +2861,10 @@
     InterfaceType type,
   ) {
     if (type.element3 is MixinElement) {
-      errorReporter.atNode(namedType, CompileTimeErrorCode.MIXIN_INSTANTIATE);
+      diagnosticReporter.atNode(
+        namedType,
+        CompileTimeErrorCode.MIXIN_INSTANTIATE,
+      );
     }
   }
 
@@ -2866,12 +2882,12 @@
   ) {
     if (constructorElement != null && !constructorElement.isConst) {
       if (keyword != null) {
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           keyword,
           CompileTimeErrorCode.CONST_WITH_NON_CONST,
         );
       } else {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           expression,
           CompileTimeErrorCode.CONST_WITH_NON_CONST,
         );
@@ -2901,13 +2917,13 @@
     // report as named or default constructor absence
     var name = constructorName.name;
     if (name != null) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         name,
         CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR,
         arguments: [namedType.qualifiedName, name.name],
       );
     } else {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         constructorName,
         CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT,
         arguments: [namedType.qualifiedName],
@@ -2917,7 +2933,10 @@
 
   void _checkForDeadNullCoalesce(TypeImpl lhsType, Expression rhs) {
     if (typeSystem.isStrictlyNonNullable(lhsType)) {
-      errorReporter.atNode(rhs, StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION);
+      diagnosticReporter.atNode(
+        rhs,
+        StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION,
+      );
     }
   }
 
@@ -2929,7 +2948,7 @@
   ) {
     for (var element in importElement.namespace.definedNames2.values) {
       if (element is ExtensionElement) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           directive.uri,
           CompileTimeErrorCode.DEFERRED_IMPORT_OF_EXTENSION,
         );
@@ -2991,7 +3010,7 @@
     String loopNamedType = awaitKeyword != null ? 'Stream' : 'Iterable';
 
     if (iterableType is DynamicType && strictCasts) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         node.iterable,
         CompileTimeErrorCode.FOR_IN_OF_INVALID_TYPE,
         arguments: [iterableType, loopNamedType],
@@ -3031,7 +3050,7 @@
       requiredSequenceType,
       strictCasts: strictCasts,
     )) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         node.iterable,
         CompileTimeErrorCode.FOR_IN_OF_INVALID_TYPE,
         arguments: [iterableType, loopNamedType],
@@ -3074,7 +3093,7 @@
         node.iterable,
       );
       if (implicitCallMethod == null) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           node.iterable,
           CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE,
           arguments: [iterableType, loopNamedType, variableType],
@@ -3088,7 +3107,7 @@
           var typeArguments = typeSystem.inferFunctionTypeInstantiation(
             variableType as FunctionTypeImpl,
             tearoffType,
-            errorReporter: errorReporter,
+            diagnosticReporter: diagnosticReporter,
             errorNode: node.iterable,
             genericMetadataIsEnabled: true,
             inferenceUsingBoundsIsEnabled:
@@ -3109,7 +3128,7 @@
           variableType,
           strictCasts: strictCasts,
         )) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             node.iterable,
             CompileTimeErrorCode.FOR_IN_OF_INVALID_ELEMENT_TYPE,
             arguments: [iterableType, loopNamedType, variableType],
@@ -3132,7 +3151,7 @@
         allowSuperBounded: true,
       );
       if (isWellBounded is NotWellBoundedTypeResult) {
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           node.name,
           CompileTimeErrorCode.ENUM_INSTANTIATED_TO_BOUNDS_IS_NOT_WELL_BOUNDED,
         );
@@ -3175,7 +3194,7 @@
     // because the only time it is `null` is if the URI contains a string
     // interpolation, in which case the export would never have resolved in the
     // first place.
-    errorReporter.atNode(
+    diagnosticReporter.atNode(
       directive,
       CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY,
       arguments: [directive.uri.stringValue!],
@@ -3226,7 +3245,7 @@
       return false;
     }
     if (namedType.isDeferred) {
-      errorReporter.atNode(namedType, code);
+      diagnosticReporter.atNode(namedType, code);
       return true;
     }
     return false;
@@ -3266,7 +3285,7 @@
     }
 
     for (var field in node.fields.variables) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         field.name,
         CompileTimeErrorCode.EXTENSION_DECLARES_INSTANCE_FIELD,
       );
@@ -3276,7 +3295,7 @@
   void _checkForExtensionDeclaresMemberOfObject(MethodDeclaration node) {
     if (_enclosingExtension != null) {
       if (node.hasObjectMemberName) {
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           node.name,
           CompileTimeErrorCode.EXTENSION_DECLARES_MEMBER_OF_OBJECT,
         );
@@ -3285,7 +3304,7 @@
 
     if (_enclosingClass is ExtensionTypeElement) {
       if (node.hasObjectMemberName) {
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           node.name,
           CompileTimeErrorCode.EXTENSION_TYPE_DECLARES_MEMBER_OF_OBJECT,
         );
@@ -3297,7 +3316,7 @@
     SuperConstructorInvocation node,
   ) {
     if (_enclosingClass is ExtensionTypeElement) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         node.superKeyword,
         CompileTimeErrorCode.EXTENSION_TYPE_CONSTRUCTOR_WITH_SUPER_INVOCATION,
       );
@@ -3314,7 +3333,7 @@
     }
 
     for (var field in node.fields.variables) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         field.name,
         CompileTimeErrorCode.EXTENSION_TYPE_DECLARES_INSTANCE_FIELD,
       );
@@ -3342,7 +3361,7 @@
     ExtensionTypeFragmentImpl element,
   ) {
     if (element.hasImplementsSelfReference) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         node.name,
         CompileTimeErrorCode.EXTENSION_TYPE_IMPLEMENTS_ITSELF,
       );
@@ -3367,7 +3386,7 @@
               url: null,
             );
           }).toList();
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         node.name,
         CompileTimeErrorCode.EXTENSION_TYPE_INHERITED_MEMBER_CONFLICT,
         arguments: [node.name.lexeme, memberName],
@@ -3396,7 +3415,7 @@
     ExtensionTypeFragmentImpl element,
   ) {
     if (element.hasRepresentationSelfReference) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         node.name,
         CompileTimeErrorCode.EXTENSION_TYPE_REPRESENTATION_DEPENDS_ON_ITSELF,
       );
@@ -3409,7 +3428,7 @@
   ) {
     var representationType = element.representation.type;
     if (representationType.isBottom) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         node.representation.fieldType,
         CompileTimeErrorCode.EXTENSION_TYPE_REPRESENTATION_TYPE_BOTTOM,
       );
@@ -3422,7 +3441,7 @@
     for (var member in node.members) {
       if (member is MethodDeclarationImpl && !member.isStatic) {
         if (member.isAbstract) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             member,
             CompileTimeErrorCode.EXTENSION_TYPE_WITH_ABSTRACT_MEMBER,
             arguments: [member.name.lexeme, node.name.lexeme],
@@ -3449,7 +3468,7 @@
     if (constructor is ConstructorDeclaration) {
       // constructor cannot be a factory
       if (constructor.factoryKeyword != null) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           parameter,
           CompileTimeErrorCode.FIELD_INITIALIZER_FACTORY_CONSTRUCTOR,
         );
@@ -3458,7 +3477,7 @@
       // constructor cannot have a redirection
       for (ConstructorInitializer initializer in constructor.initializers) {
         if (initializer is RedirectingConstructorInvocation) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             parameter,
             CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR,
           );
@@ -3466,7 +3485,7 @@
         }
       }
     } else {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         parameter,
         CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR,
       );
@@ -3496,7 +3515,7 @@
     for (VariableDeclaration variable in variables) {
       if (variable.initializer == null) {
         if (isConst) {
-          errorReporter.atToken(
+          diagnosticReporter.atToken(
             variable.name,
             CompileTimeErrorCode.CONST_NOT_INITIALIZED,
             arguments: [variable.name.lexeme],
@@ -3510,7 +3529,7 @@
               variableElement.isExternal) {
             // External top level variables can't be initialized, so no error.
           } else if (!variable.isLate) {
-            errorReporter.atToken(
+            diagnosticReporter.atToken(
               variable.name,
               CompileTimeErrorCode.FINAL_NOT_INITIALIZED,
               arguments: [variable.name.lexeme],
@@ -3571,7 +3590,7 @@
             !element.isSealed &&
             element.library2 != _currentLibrary &&
             !_mayIgnoreClassModifiers(element.library2)) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             superclass,
             CompileTimeErrorCode.FINAL_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY,
             arguments: [element.name3!],
@@ -3604,7 +3623,7 @@
                 continue;
               }
 
-              errorReporter.atNode(
+              diagnosticReporter.atNode(
                 namedType,
                 CompileTimeErrorCode.FINAL_CLASS_IMPLEMENTED_OUTSIDE_OF_LIBRARY,
                 arguments: [element.name3!],
@@ -3625,7 +3644,7 @@
               !element.isSealed &&
               element.library2 != _currentLibrary &&
               !_mayIgnoreClassModifiers(element.library2)) {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               namedType,
               CompileTimeErrorCode
                   .FINAL_CLASS_USED_AS_MIXIN_CONSTRAINT_OUTSIDE_OF_LIBRARY,
@@ -3646,7 +3665,7 @@
     }
     DartType type = node.typeOrThrow;
     if (type is FunctionType && type.typeParameters.isNotEmpty) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         node,
         CompileTimeErrorCode.GENERIC_FUNCTION_TYPE_CANNOT_BE_BOUND,
       );
@@ -3667,7 +3686,7 @@
 
     var languageVersionToken = node.languageVersionToken;
     if (languageVersionToken != null) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         languageVersionToken,
         CompileTimeErrorCode.ILLEGAL_LANGUAGE_VERSION_OVERRIDE,
         arguments: ['$sourceLanguageConstraint'],
@@ -3729,7 +3748,7 @@
     // contained interpolations, in which case the import would have failed to
     // resolve, and we would never reach here.  So it is safe to assume that
     // `directive.uri.stringValue` is non-`null`.
-    errorReporter.atNode(
+    diagnosticReporter.atNode(
       directive.uri,
       CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY,
       arguments: [directive.uri.stringValue!],
@@ -3800,7 +3819,7 @@
             !superclassElement.isSealed &&
             superclassElement.library2 != _currentLibrary &&
             !_mayIgnoreClassModifiers(superclassElement.library2)) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             superclass,
             CompileTimeErrorCode.INTERFACE_CLASS_EXTENDED_OUTSIDE_OF_LIBRARY,
             arguments: [superclassElement.name3!],
@@ -3834,7 +3853,7 @@
   void _checkForInvalidAnnotationFromDeferredLibrary(Annotation annotation) {
     Identifier nameIdentifier = annotation.name;
     if (nameIdentifier is PrefixedIdentifier && nameIdentifier.isDeferred) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         annotation.name,
         CompileTimeErrorCode.INVALID_ANNOTATION_FROM_DEFERRED_LIBRARY,
       );
@@ -3852,20 +3871,20 @@
   ) {
     if (staticElement is FieldElement) {
       if (staticElement.isSynthetic) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           initializer,
           CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD,
           arguments: [fieldName.name],
         );
       } else if (staticElement.isStatic) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           initializer,
           CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD,
           arguments: [fieldName.name],
         );
       }
     } else {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         initializer,
         CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD,
         arguments: [fieldName.name],
@@ -3884,12 +3903,12 @@
         constructorElement.isGenerative &&
         constructorElement.enclosingElement is EnumElement) {
       if (_currentLibrary.featureSet.isEnabled(Feature.enhanced_enums)) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.INVALID_REFERENCE_TO_GENERATIVE_ENUM_CONSTRUCTOR,
         );
       } else {
-        errorReporter.atNode(node, CompileTimeErrorCode.INSTANTIATE_ENUM);
+        diagnosticReporter.atNode(node, CompileTimeErrorCode.INSTANTIATE_ENUM);
       }
     }
   }
@@ -3948,17 +3967,17 @@
     }
 
     if (_enclosingExecutable.inStaticMethod) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         identifier,
         CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC,
       );
     } else if (_enclosingExecutable.inFactoryConstructor) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         identifier,
         CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_FACTORY,
       );
     } else {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         identifier,
         CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER,
         arguments: [identifier.name],
@@ -3974,7 +3993,11 @@
   ) {
     var keyword = body.keyword;
     if (keyword != null) {
-      errorReporter.atToken(keyword, errorCode, arguments: [keyword.lexeme]);
+      diagnosticReporter.atToken(
+        keyword,
+        errorCode,
+        arguments: [keyword.lexeme],
+      );
     }
   }
 
@@ -3983,7 +4006,7 @@
   /// See [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS].
   void _checkForInvalidReferenceToThis(ThisExpression expression) {
     if (!_hasAccessToThis) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS,
       );
@@ -4010,7 +4033,7 @@
     );
     if (!hasGenerativeConstConstructor) return;
 
-    errorReporter.atToken(
+    diagnosticReporter.atToken(
       lateKeyword,
       CompileTimeErrorCode.LATE_FINAL_FIELD_WITH_CONST_CONSTRUCTOR,
     );
@@ -4036,7 +4059,7 @@
     var verifier = LiteralElementVerifier(
       _typeProvider,
       typeSystem,
-      errorReporter,
+      diagnosticReporter,
       this,
       forList: true,
       elementType: listElementType,
@@ -4058,7 +4081,7 @@
     }
 
     if (declaredFragment is! TopLevelFunctionFragment) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         nameToken,
         CompileTimeErrorCode.MAIN_IS_NOT_FUNCTION,
       );
@@ -4085,14 +4108,14 @@
         parameters.where((e) => e.isRequiredPositional).toList();
 
     if (requiredPositional.length > 2) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         functionDeclaration.name,
         CompileTimeErrorCode.MAIN_HAS_TOO_MANY_REQUIRED_POSITIONAL_PARAMETERS,
       );
     }
 
     if (parameters.any((e) => e.isRequiredNamed)) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         functionDeclaration.name,
         CompileTimeErrorCode.MAIN_HAS_REQUIRED_NAMED_PARAMETERS,
       );
@@ -4103,7 +4126,7 @@
       var type = first.declaredFragment!.element.type;
       var listOfString = _typeProvider.listType(_typeProvider.stringType);
       if (!typeSystem.isSubtypeOf(listOfString, type)) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           first.notDefault.typeOrSelf,
           CompileTimeErrorCode.MAIN_FIRST_POSITIONAL_PARAMETER_TYPE,
         );
@@ -4130,7 +4153,7 @@
       var verifier = LiteralElementVerifier(
         _typeProvider,
         typeSystem,
-        errorReporter,
+        diagnosticReporter,
         this,
         forMap: true,
         mapKeyType: keyType,
@@ -4196,7 +4219,7 @@
         for (var constantName in constantNames) {
           int offset = statement.offset;
           int end = statement.rightParenthesis.end;
-          errorReporter.atOffset(
+          diagnosticReporter.atOffset(
             offset: offset,
             length: end - offset,
             diagnosticCode: StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH,
@@ -4207,7 +4230,7 @@
         if (typeSystem.isNullable(expressionType) && !hasCaseNull) {
           int offset = statement.offset;
           int end = statement.rightParenthesis.end;
-          errorReporter.atOffset(
+          diagnosticReporter.atOffset(
             offset: offset,
             length: end - offset,
             diagnosticCode: StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH,
@@ -4229,7 +4252,7 @@
   ) {
     for (var constructor in mixinElement.constructors) {
       if (!constructor.isSynthetic && !constructor.isFactory) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           mixinName,
           CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR,
           arguments: [mixinElement.name3!],
@@ -4260,7 +4283,7 @@
             // Report errors on non-trivial generative constructors on mixin
             // classes.
             if (!member.isTrivial) {
-              errorReporter.atNode(
+              diagnosticReporter.atNode(
                 member.returnType,
                 CompileTimeErrorCode.MIXIN_CLASS_DECLARES_CONSTRUCTOR,
                 arguments: [element.name3!],
@@ -4271,14 +4294,14 @@
       }
       // Check that the class has 'Object' as their superclass.
       if (superclass != null && !superclass.typeOrThrow.isDartCoreObject) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           superclass,
           CompileTimeErrorCode.MIXIN_CLASS_DECLARATION_EXTENDS_NOT_OBJECT,
           arguments: [element.name3!],
         );
       } else if (withClause != null &&
           !(element.isMixinApplication && withClause.mixinTypes.length < 2)) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           withClause,
           CompileTimeErrorCode.MIXIN_CLASS_DECLARATION_EXTENDS_NOT_OBJECT,
           arguments: [element.name3!],
@@ -4311,7 +4334,7 @@
       }
     }
 
-    errorReporter.atNode(
+    diagnosticReporter.atNode(
       mixinName,
       CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT,
       arguments: [mixinElement.name3!],
@@ -4343,7 +4366,7 @@
       if (!isSatisfied) {
         // This error can only occur if [mixinName] resolved to an actual mixin,
         // so we can safely rely on `mixinName.type` being non-`null`.
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           mixinName.name,
           CompileTimeErrorCode.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE,
           arguments: [mixinName.type!, superType, constraint],
@@ -4394,7 +4417,7 @@
           name = name.substring(0, name.length - 1);
         }
 
-        errorReporter.atNode(mixinName, errorCode, arguments: [name]);
+        diagnosticReporter.atNode(mixinName, errorCode, arguments: [name]);
         return true;
       }
 
@@ -4410,7 +4433,7 @@
           thisMember: superMember.asElement2,
         ).isCorrectOverrideOf(superMember: mixinMember.asElement2);
         if (!isCorrect) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             mixinName,
             CompileTimeErrorCode
                 .MIXIN_APPLICATION_CONCRETE_SUPER_INVOKED_MEMBER_TYPE,
@@ -4454,7 +4477,7 @@
           if (name.endsWith('=')) {
             name = name.substring(0, name.length - 1);
           }
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             namedType,
             CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION,
             arguments: [name, namedType.name.lexeme, conflictingName],
@@ -4474,7 +4497,7 @@
           // Inherited members are always contained inside named elements, so we
           // can safely assume `inheritedMember.enclosingElement3.name` is
           // non-`null`.
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             namedType,
             CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION,
             arguments: [
@@ -4528,7 +4551,7 @@
   /// See [ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE].
   void _checkForNativeFunctionBodyInNonSdkCode(NativeFunctionBody body) {
     if (!_isInSystemLibrary) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         body,
         ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE,
       );
@@ -4563,13 +4586,13 @@
     // report as named or default constructor absence
     var name = constructorName.name;
     if (name != null) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         name,
         CompileTimeErrorCode.NEW_WITH_UNDEFINED_CONSTRUCTOR,
         arguments: [namedType.qualifiedName, name.name],
       );
     } else {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         constructorName,
         CompileTimeErrorCode.NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT,
         arguments: [namedType.qualifiedName],
@@ -4598,7 +4621,7 @@
     var superUnnamedConstructor = superElement.unnamedConstructor2;
     if (superUnnamedConstructor != null) {
       if (superUnnamedConstructor.isFactory) {
-        errorReporter.atElement2(
+        diagnosticReporter.atElement2(
           fragment.asElement2,
           CompileTimeErrorCode.NON_GENERATIVE_IMPLICIT_CONSTRUCTOR,
           arguments: [
@@ -4617,7 +4640,7 @@
     if (!_typeProvider.isNonSubtypableClass2(superType.element3)) {
       // Don't report this diagnostic for non-subtypable classes because the
       // real problem was already reported.
-      errorReporter.atElement2(
+      diagnosticReporter.atElement2(
         fragment.asElement2,
         CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT,
         arguments: [superType, fragment.displayName],
@@ -4647,7 +4670,7 @@
     )) {
       // For `E extends Exception`, etc., this will never work, because it has
       // no generative constructors. State this clearly to users.
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         superclass!,
         CompileTimeErrorCode.NO_GENERATIVE_CONSTRUCTORS_IN_SUPERCLASS,
         arguments: [_enclosingClass!.name3!, superElement.name3!],
@@ -4661,7 +4684,7 @@
     if (_enclosingClass is EnumElement &&
         node.constKeyword == null &&
         node.factoryKeyword == null) {
-      errorReporter.atConstructorDeclaration(
+      diagnosticReporter.atConstructorDeclaration(
         node,
         CompileTimeErrorCode.NON_CONST_GENERATIVE_ENUM_CONSTRUCTOR,
       );
@@ -4694,7 +4717,7 @@
     }
 
     // TODO(srawlins): Add any tests showing this is reported.
-    errorReporter.atNode(
+    diagnosticReporter.atNode(
       literal,
       CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT,
     );
@@ -4719,7 +4742,7 @@
         ], initialVariance: Variance.covariant),
       );
       if (nonCovariant) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           typeParameterNode,
           CompileTimeErrorCode
               .NON_COVARIANT_TYPE_PARAMETER_POSITION_IN_REPRESENTATION_TYPE,
@@ -4739,7 +4762,7 @@
       return;
     }
 
-    errorReporter.atToken(
+    diagnosticReporter.atToken(
       variableList.variables.first.name,
       CompileTimeErrorCode.NON_FINAL_FIELD_IN_ENUM,
     );
@@ -4759,7 +4782,7 @@
     if (annotation != null) {
       DartType type = annotation.typeOrThrow;
       if (type is! VoidType) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           annotation,
           CompileTimeErrorCode.NON_VOID_RETURN_FOR_OPERATOR,
         );
@@ -4775,7 +4798,7 @@
     if (namedType != null) {
       DartType type = namedType.typeOrThrow;
       if (type is! VoidType) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           namedType,
           CompileTimeErrorCode.NON_VOID_RETURN_FOR_SETTER,
         );
@@ -4803,7 +4826,7 @@
       var type = fieldElement.type;
       if (!typeSystem.isPotentiallyNonNullable(type)) continue;
 
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         field,
         CompileTimeErrorCode.NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD,
         arguments: [field.name.lexeme],
@@ -4853,7 +4876,7 @@
 
     for (var variable in node.variables) {
       if (variable.initializer == null) {
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           variable.name,
           CompileTimeErrorCode.NOT_INITIALIZED_NON_NULLABLE_VARIABLE,
           arguments: [variable.name.lexeme],
@@ -4908,7 +4931,7 @@
     NodeList<FormalParameter> formalParameters = parameterList.parameters;
     for (FormalParameter formalParameter in formalParameters) {
       if (formalParameter.isOptional) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           formalParameter,
           CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR,
         );
@@ -4961,7 +4984,7 @@
           BigInt.from(IntegerLiteralImpl.nearestValidDouble(source)).toString(),
       ];
 
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         node,
         treatedAsDouble
             ? CompileTimeErrorCode.INTEGER_LITERAL_IMPRECISE_AS_DOUBLE
@@ -4983,7 +5006,7 @@
       return;
     }
 
-    errorReporter.atToken(
+    diagnosticReporter.atToken(
       name,
       CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER,
     );
@@ -5007,7 +5030,7 @@
     for (ConstructorInitializer initializer in declaration.initializers) {
       if (initializer is RedirectingConstructorInvocation) {
         if (_hasRedirectingFactoryConstructorCycle(constructorElement)) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             initializer,
             CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT,
           );
@@ -5036,7 +5059,7 @@
       return false;
     }
     // report error
-    errorReporter.atNode(
+    diagnosticReporter.atNode(
       redirectedConstructorNode,
       CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
     );
@@ -5056,7 +5079,7 @@
     for (FormalParameter parameter in declaration.parameters.parameters) {
       if (parameter is DefaultFormalParameter &&
           parameter.defaultValue != null) {
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           parameter.name!,
           CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR,
         );
@@ -5078,7 +5101,7 @@
       if (declaration.name != null) {
         constructorStrName += ".${declaration.name!.lexeme}";
       }
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         redirectedConstructor,
         CompileTimeErrorCode.REDIRECT_TO_ABSTRACT_CLASS_CONSTRUCTOR,
         arguments: [constructorStrName, redirectedClass.name3!],
@@ -5103,7 +5126,7 @@
     if (redirectedElement != null &&
         element.isConst &&
         !redirectedElement.isConst) {
-      errorReporter.atEntity(
+      diagnosticReporter.atEntity(
         errorEntity,
         CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR,
       );
@@ -5118,9 +5141,9 @@
         _hiddenElements != null &&
         _hiddenElements!.contains(element)) {
       _hiddenElements!.contains(element);
-      errorReporter.reportError(
+      diagnosticReporter.reportError(
         _diagnosticFactory.referencedBeforeDeclaration(
-          errorReporter.source,
+          diagnosticReporter.source,
           nameToken: nameToken,
           element2: element,
         ),
@@ -5143,7 +5166,11 @@
         var element = type.element3;
         var added = accumulatedElements.add(element);
         if (!added) {
-          errorReporter.atNode(namedType, code, arguments: [element.name3!]);
+          diagnosticReporter.atNode(
+            namedType,
+            code,
+            arguments: [element.name3!],
+          );
         }
       }
     }
@@ -5154,7 +5181,7 @@
   /// See [CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH].
   void _checkForRethrowOutsideCatch(RethrowExpression expression) {
     if (_enclosingExecutable.catchClauseLevel == 0) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH,
       );
@@ -5178,7 +5205,7 @@
       return;
     }
 
-    errorReporter.atNode(
+    diagnosticReporter.atNode(
       body,
       CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR,
     );
@@ -5202,7 +5229,7 @@
           if (element is ClassElement &&
               element.isSealed &&
               element.library2 != _currentLibrary) {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               namedType,
               CompileTimeErrorCode.SEALED_CLASS_SUBTYPE_OUTSIDE_OF_LIBRARY,
               arguments: [element.name3!],
@@ -5249,7 +5276,7 @@
       var verifier = LiteralElementVerifier(
         _typeProvider,
         typeSystem,
-        errorReporter,
+        diagnosticReporter,
         this,
         forSet: true,
         elementType: setElementType,
@@ -5284,7 +5311,7 @@
       if (element.isStatic || element is ConstructorElement) {
         return;
       }
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         name,
         CompileTimeErrorCode.STATIC_ACCESS_TO_INSTANCE_MEMBER,
         arguments: [name.name],
@@ -5301,7 +5328,7 @@
       typeSystem.objectNone,
       strictCasts: strictCasts,
     )) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         expression,
         CompileTimeErrorCode.THROW_OF_INVALID_TYPE,
         arguments: [type],
@@ -5318,7 +5345,7 @@
     TypeAliasFragmentImpl element,
   ) {
     if (element.hasSelfReference) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         nameToken,
         CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF,
       );
@@ -5330,7 +5357,7 @@
   /// See [CompileTimeErrorCode.TYPE_ANNOTATION_DEFERRED_CLASS].
   void _checkForTypeAnnotationDeferredClass(TypeAnnotation? type) {
     if (type is NamedType && type.isDeferred) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         type,
         CompileTimeErrorCode.TYPE_ANNOTATION_DEFERRED_CLASS,
         arguments: [type.qualifiedName],
@@ -5342,7 +5369,7 @@
   ///
   /// See [CompileTimeErrorCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND].
   void _checkForTypeParameterBoundRecursion(List<TypeParameter> parameters) {
-    checkForTypeParameterBoundRecursion(errorReporter, parameters);
+    checkForTypeParameterBoundRecursion(diagnosticReporter, parameters);
   }
 
   void _checkForTypeParameterReferencedByStatic({
@@ -5355,7 +5382,7 @@
         // The class's type parameters are not in scope for static methods.
         // However all other type parameters are legal (e.g. the static method's
         // type parameters, or a local function's type parameters).
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           name,
           CompileTimeErrorCode.TYPE_PARAMETER_REFERENCED_BY_STATIC,
         );
@@ -5415,7 +5442,7 @@
 
     var superUnnamedConstructor = superElement.unnamedConstructor2;
     if (superUnnamedConstructor == null) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         constructor.returnType,
         CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT,
         arguments: [superElement.name3!],
@@ -5424,7 +5451,7 @@
     }
 
     if (superUnnamedConstructor.isFactory) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         constructor.returnType,
         CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR,
         arguments: [superUnnamedConstructor],
@@ -5447,7 +5474,7 @@
       var name = constructor.name;
       int offset = returnType.offset;
       int length = (name != null ? name.end : returnType.end) - offset;
-      errorReporter.atOffset(
+      diagnosticReporter.atOffset(
         offset: offset,
         length: length,
         diagnosticCode: code,
@@ -5468,7 +5495,7 @@
 
     var superParametersResult = verifySuperFormalParameters(
       constructor: constructor,
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
     );
     requiredNamedParameters.removeAll(superParametersResult.namedArgumentNames);
 
@@ -5564,7 +5591,7 @@
         if (targetElement is InterfaceElement ||
             targetElement is ExtensionElement ||
             targetElement is TypeAliasElement) {
-          errorReporter.atOffset(
+          diagnosticReporter.atOffset(
             offset: operator.offset,
             length: endToken.end - operator.offset,
             diagnosticCode: code,
@@ -5579,9 +5606,9 @@
       if (code == StaticWarningCode.INVALID_NULL_AWARE_OPERATOR) {
         var previousOperator = previousShortCircuitingOperator(target);
         if (previousOperator != null) {
-          errorReporter.reportError(
+          diagnosticReporter.reportError(
             _diagnosticFactory.invalidNullAwareAfterShortCircuit(
-              errorReporter.source,
+              diagnosticReporter.source,
               operator.offset,
               endToken.end - operator.offset,
               arguments,
@@ -5591,7 +5618,7 @@
           return;
         }
       }
-      errorReporter.atOffset(
+      diagnosticReporter.atOffset(
         offset: operator.offset,
         length: endToken.end - operator.offset,
         diagnosticCode: code,
@@ -5638,14 +5665,14 @@
       return;
     }
     if (_enclosingExtension != null) {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         name,
         CompileTimeErrorCode
             .UNQUALIFIED_REFERENCE_TO_STATIC_MEMBER_OF_EXTENDED_TYPE,
         arguments: [enclosingElement.displayName],
       );
     } else {
-      errorReporter.atNode(
+      diagnosticReporter.atNode(
         name,
         CompileTimeErrorCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER,
         arguments: [enclosingElement.displayName],
@@ -5663,7 +5690,7 @@
     if (element is FieldFormalParameterElementImpl2) {
       var fieldElement = element.field2;
       if (fieldElement == null || fieldElement.isSynthetic) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           parameter,
           CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD,
           arguments: [parameter.name.lexeme],
@@ -5674,19 +5701,19 @@
           var declaredType = parameterElement.type;
           var fieldType = fieldElement.type;
           if (fieldElement.isSynthetic) {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               parameter,
               CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD,
               arguments: [parameter.name.lexeme],
             );
           } else if (fieldElement.isStatic) {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               parameter,
               CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD,
               arguments: [parameter.name.lexeme],
             );
           } else if (!typeSystem.isSubtypeOf(declaredType, fieldType)) {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               parameter,
               CompileTimeErrorCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE,
               arguments: [declaredType, fieldType],
@@ -5694,13 +5721,13 @@
           }
         } else {
           if (fieldElement.isSynthetic) {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               parameter,
               CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD,
               arguments: [parameter.name.lexeme],
             );
           } else if (fieldElement.isStatic) {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               parameter,
               CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD,
               arguments: [parameter.name.lexeme],
@@ -5760,14 +5787,14 @@
       expected = 0;
     }
     if (expected != -1 && numParameters != expected) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         nameToken,
         CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR,
         arguments: [name, expected, numParameters],
       );
       return true;
     } else if ("-" == name && numParameters > 1) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         nameToken,
         CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS,
         arguments: [numParameters],
@@ -5795,7 +5822,7 @@
 
     NodeList<FormalParameter> parameters = parameterList.parameters;
     if (parameters.length != 1 || !parameters[0].isRequiredPositional) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         setterName,
         CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER,
       );
@@ -5913,7 +5940,7 @@
           // position.
           if (!superVariance.greaterThanOrEqual(typeParameter.variance)) {
             if (!typeParameter.isLegacyCovariant) {
-              errorReporter.atElement2(
+              diagnosticReporter.atElement2(
                 typeParameter.asElement2,
                 CompileTimeErrorCode
                     .WRONG_EXPLICIT_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE,
@@ -5925,7 +5952,7 @@
                 ],
               );
             } else {
-              errorReporter.atElement2(
+              diagnosticReporter.atElement2(
                 typeParameter.asElement2,
                 CompileTimeErrorCode
                     .WRONG_TYPE_PARAMETER_VARIANCE_IN_SUPERINTERFACE,
@@ -5966,7 +5993,7 @@
     SyntacticEntity errorTarget,
   ) {
     if (!variance.greaterThanOrEqual(typeParameter.variance)) {
-      errorReporter.atEntity(
+      diagnosticReporter.atEntity(
         errorTarget,
         CompileTimeErrorCode.WRONG_TYPE_PARAMETER_VARIANCE_POSITION,
         arguments: [
@@ -5995,7 +6022,7 @@
     for (var interfaceNode in implementsClause.interfaces) {
       var type = interfaceNode.type;
       if (type is InterfaceType && type.element3 == superElement) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           interfaceNode,
           CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS,
           arguments: [superElement],
@@ -6061,7 +6088,7 @@
     for (var mixinNode in withClause.mixinTypes) {
       var type = mixinNode.type;
       if (type is InterfaceType && type.element3 == superElement) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           mixinNode,
           CompileTimeErrorCode.MIXINS_SUPER_CLASS,
           arguments: [superElement],
@@ -6099,7 +6126,7 @@
       var parameter = parameters[i].notDefault;
       var keyword = parameter.covariantKeyword;
       if (keyword != null) {
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           keyword,
           CompileTimeErrorCode.INVALID_USE_OF_COVARIANT,
         );
@@ -6144,7 +6171,7 @@
         if (parameter.isRequiredNamed) {
           if (parameter.defaultValue != null) {
             var errorTarget = _parameterName(parameter) ?? parameter;
-            errorReporter.atEntity(
+            diagnosticReporter.atEntity(
               errorTarget,
               CompileTimeErrorCode.DEFAULT_VALUE_ON_REQUIRED_PARAMETER,
             );
@@ -6157,14 +6184,14 @@
               var parameterName = _parameterName(parameter);
               var errorTarget = parameterName ?? parameter;
               if (parameterElement.metadata.hasRequired) {
-                errorReporter.atEntity(
+                diagnosticReporter.atEntity(
                   errorTarget,
                   CompileTimeErrorCode
                       .MISSING_DEFAULT_VALUE_FOR_PARAMETER_WITH_ANNOTATION,
                 );
               } else {
                 if (!_isWildcardSuperFormalPositionalParameter(parameter)) {
-                  errorReporter.atEntity(
+                  diagnosticReporter.atEntity(
                     errorTarget,
                     parameterElement.isPositional
                         ? CompileTimeErrorCode
@@ -6371,7 +6398,7 @@
     if (combinators.length > 1) {
       var offset = combinators.beginToken!.offset;
       var length = combinators.endToken!.end - offset;
-      errorReporter.atOffset(
+      diagnosticReporter.atOffset(
         offset: offset,
         length: length,
         diagnosticCode: WarningCode.MULTIPLE_COMBINATORS,
@@ -6573,9 +6600,9 @@
 
 /// Recursively visits a type annotation, looking uninstantiated bounds.
 class _UninstantiatedBoundChecker extends RecursiveAstVisitor<void> {
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _diagnosticReporter;
 
-  _UninstantiatedBoundChecker(this._errorReporter);
+  _UninstantiatedBoundChecker(this._diagnosticReporter);
 
   @override
   void visitNamedType(NamedType node) {
@@ -6589,7 +6616,10 @@
     if (element is TypeParameterizedElement && !element.isSimplyBounded) {
       // TODO(srawlins): Don't report this if TYPE_ALIAS_CANNOT_REFERENCE_ITSELF
       //  has been reported.
-      _errorReporter.atNode(node, CompileTimeErrorCode.NOT_INSTANTIATED_BOUND);
+      _diagnosticReporter.atNode(
+        node,
+        CompileTimeErrorCode.NOT_INSTANTIATED_BOUND,
+      );
     }
   }
 }
diff --git a/pkg/analyzer/lib/src/generated/ffi_verifier.dart b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
index 6e19d54..1333cc6 100644
--- a/pkg/analyzer/lib/src/generated/ffi_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/ffi_verifier.dart
@@ -97,8 +97,8 @@
   /// Whether implicit casts should be reported as potential problems.
   final bool strictCasts;
 
-  /// The error reporter used to report errors.
-  final ErrorReporter _errorReporter;
+  /// The diagnostic reporter used to report diagnostics.
+  final DiagnosticReporter _diagnosticReporter;
 
   /// A flag indicating whether we are currently visiting inside a subclass of
   /// `Struct`.
@@ -113,7 +113,7 @@
   /// Initialize a newly created verifier.
   FfiVerifier(
     this.typeSystem,
-    this._errorReporter, {
+    this._diagnosticReporter, {
     required this.strictCasts,
   });
 
@@ -132,7 +132,7 @@
           inCompound = true;
           compound = node;
           if (node.declaredFragment!.element.isEmptyStruct) {
-            _errorReporter.atToken(
+            _diagnosticReporter.atToken(
               node.name,
               FfiCode.EMPTY_STRUCT,
               arguments: [node.name.lexeme, className ?? '<null>'],
@@ -150,7 +150,7 @@
         }
       } else if (superclass.isCompoundSubtype ||
           superclass.isAbiSpecificIntegerSubtype) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           superclass,
           FfiCode.SUBTYPE_OF_STRUCT_CLASS_IN_EXTENDS,
           arguments: [node.name.lexeme, superclass.name.lexeme],
@@ -166,7 +166,7 @@
         return;
       }
       if (typename.isCompoundSubtype || typename.isAbiSpecificIntegerSubtype) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           typename,
           subtypeOfStructCode,
           arguments: [node.name.lexeme, typename.name.lexeme],
@@ -189,7 +189,7 @@
 
     if (inCompound) {
       if (node.declaredFragment!.element.typeParameters2.isNotEmpty) {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           node.name,
           FfiCode.GENERIC_STRUCT_SUBCLASS,
           arguments: [node.name.lexeme],
@@ -203,7 +203,7 @@
         var finalizableElement = ffiLibrary.getClass2(_finalizableClassName)!;
         var finalizableType = finalizableElement.thisType;
         if (typeSystem.isSubtypeOf(compoundType, finalizableType)) {
-          _errorReporter.atToken(
+          _diagnosticReporter.atToken(
             node.name,
             FfiCode.COMPOUND_IMPLEMENTS_FINALIZABLE,
             arguments: [node.name.lexeme],
@@ -288,7 +288,7 @@
     var class_ = constructor?.enclosingElement;
     if (class_.isStructSubclass || class_.isUnionSubclass) {
       if (!constructor!.isFactory) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node.constructorName,
           FfiCode.CREATION_OF_STRUCT_OR_UNION,
         );
@@ -311,7 +311,7 @@
         if (annotationValue != null && annotationValue.isDefaultAsset) {
           if (hasDefaultAsset) {
             var name = annotation.annotationAst.name;
-            _errorReporter.atNode(
+            _diagnosticReporter.atNode(
               name,
               FfiCode.FFI_NATIVE_INVALID_DUPLICATE_DEFAULT_ASSET,
             );
@@ -466,7 +466,7 @@
 
       if (hadNativeAnnotation) {
         var name = (annotation as ElementAnnotationImpl).annotationAst.name;
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           name,
           FfiCode.FFI_NATIVE_INVALID_MULTIPLE_ANNOTATIONS,
         );
@@ -476,7 +476,10 @@
       hadNativeAnnotation = true;
 
       if (!isExternal) {
-        _errorReporter.atToken(errorNode, FfiCode.FFI_NATIVE_MUST_BE_EXTERNAL);
+        _diagnosticReporter.atToken(
+          errorNode,
+          FfiCode.FFI_NATIVE_MUST_BE_EXTERNAL,
+        );
       }
 
       var ffiSignature = annotationType.typeArguments[0]; // The T in @Native<T>
@@ -492,7 +495,7 @@
           );
         } else {
           // Field annotated with a function type, that can't work.
-          _errorReporter.atToken(
+          _diagnosticReporter.atToken(
             errorNode,
             FfiCode.NATIVE_FIELD_INVALID_TYPE,
             arguments: [ffiSignature],
@@ -532,7 +535,7 @@
           }
 
           // Function annotated with something that isn't a function type.
-          _errorReporter.atToken(
+          _diagnosticReporter.atToken(
             errorNode,
             FfiCode.MUST_BE_A_NATIVE_FUNCTION_TYPE,
             arguments: ['T', 'Native'],
@@ -563,7 +566,10 @@
 
     if (declarationElement is FieldElement2OrMember) {
       if (!declarationElement.isStatic) {
-        _errorReporter.atToken(errorToken, FfiCode.NATIVE_FIELD_NOT_STATIC);
+        _diagnosticReporter.atToken(
+          errorToken,
+          FfiCode.NATIVE_FIELD_NOT_STATIC,
+        );
       }
       type = declarationElement.type;
     } else if (declarationElement is TopLevelVariableElementImpl2) {
@@ -575,7 +581,7 @@
       }
       type = variable.type;
     } else {
-      _errorReporter.atToken(errorToken, FfiCode.NATIVE_FIELD_NOT_STATIC);
+      _diagnosticReporter.atToken(errorToken, FfiCode.NATIVE_FIELD_NOT_STATIC);
       return;
     }
 
@@ -584,7 +590,10 @@
       var canonical = _canonicalFfiTypeForDartType(type);
 
       if (canonical == null) {
-        _errorReporter.atToken(errorToken, FfiCode.NATIVE_FIELD_MISSING_TYPE);
+        _diagnosticReporter.atToken(
+          errorToken,
+          FfiCode.NATIVE_FIELD_MISSING_TYPE,
+        );
         return;
       } else {
         ffiSignature = canonical;
@@ -600,7 +609,7 @@
       // invalid field type.
       allowFunctions: true,
     )) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         errorToken,
         FfiCode.MUST_BE_A_SUBTYPE,
         arguments: [type, ffiSignature, 'Native'],
@@ -614,7 +623,7 @@
         allowVariableLength,
       );
     } else if (ffiSignature.isHandle || ffiSignature.isNativeFunction) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         errorToken,
         FfiCode.NATIVE_FIELD_INVALID_TYPE,
         arguments: [ffiSignature],
@@ -645,7 +654,7 @@
       // Instance methods must have the receiver as an extra parameter in the
       // Native annotation.
       if (formalParameters.length + 1 != ffiParameterTypes.length) {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           errorToken,
           FfiCode.FFI_NATIVE_UNEXPECTED_NUMBER_OF_PARAMETERS_WITH_RECEIVER,
           arguments: [formalParameters.length + 1, ffiParameterTypes.length],
@@ -658,7 +667,7 @@
       if (ffiSignature.normalParameterTypes[0].isPointer) {
         var cls = declarationElement.enclosingElement as InterfaceElement;
         if (!_extendsNativeFieldWrapperClass1(cls.thisType)) {
-          _errorReporter.atToken(
+          _diagnosticReporter.atToken(
             errorToken,
             FfiCode
                 .FFI_NATIVE_ONLY_CLASSES_EXTENDING_NATIVEFIELDWRAPPERCLASS1_CAN_BE_POINTER,
@@ -672,7 +681,7 @@
       // Number of parameters in the Native annotation must match the
       // annotated declaration.
       if (formalParameters.length != ffiParameterTypes.length) {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           errorToken,
           FfiCode.FFI_NATIVE_UNEXPECTED_NUMBER_OF_PARAMETERS,
           arguments: [ffiParameterTypes.length, formalParameters.length],
@@ -690,7 +699,7 @@
             (!type.isPointer &&
                 !_extendsNativeFieldWrapperClass1(type) &&
                 !type.isTypedData)) {
-          _errorReporter.atToken(
+          _diagnosticReporter.atToken(
             errorToken,
             FfiCode
                 .FFI_NATIVE_ONLY_CLASSES_EXTENDING_NATIVEFIELDWRAPPERCLASS1_CAN_BE_POINTER,
@@ -711,12 +720,12 @@
           (annotationValue.type! as InterfaceType).typeArguments[0]
               is DynamicType;
       if (nativeTypeIsOmitted) {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           errorToken,
           FfiCode.NATIVE_FUNCTION_MISSING_TYPE,
         );
       } else {
-        _errorReporter.atToken(
+        _diagnosticReporter.atToken(
           errorToken,
           FfiCode.MUST_BE_A_NATIVE_FUNCTION_TYPE,
           arguments: [nativeType, 'Native'],
@@ -730,7 +739,7 @@
       nativeType,
       nativeFieldWrappersAsPointer: true,
     )) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         errorToken,
         FfiCode.MUST_BE_A_SUBTYPE,
         arguments: [nativeType, dartType, 'Native'],
@@ -1002,7 +1011,10 @@
         node.members.length != 1 ||
         node.members.single is! ConstructorDeclaration ||
         (node.members.single as ConstructorDeclaration).constKeyword == null) {
-      _errorReporter.atToken(node.name, FfiCode.ABI_SPECIFIC_INTEGER_INVALID);
+      _diagnosticReporter.atToken(
+        node.name,
+        FfiCode.ABI_SPECIFIC_INTEGER_INVALID,
+      );
     }
   }
 
@@ -1017,7 +1029,7 @@
             .toList();
 
     if (ffiPackedAnnotations.isEmpty) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         errorToken,
         FfiCode.ABI_SPECIFIC_INTEGER_MAPPING_MISSING,
       );
@@ -1027,7 +1039,7 @@
     if (ffiPackedAnnotations.length > 1) {
       var extraAnnotations = ffiPackedAnnotations.skip(1);
       for (var annotation in extraAnnotations) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           annotation.name,
           FfiCode.ABI_SPECIFIC_INTEGER_MAPPING_EXTRA,
         );
@@ -1049,7 +1061,7 @@
             if (valueType is InterfaceType) {
               var name = valueType.element3.name3!;
               if (!_primitiveIntegerNativeTypesFixedSize.contains(name)) {
-                _errorReporter.atNode(
+                _diagnosticReporter.atNode(
                   element.value,
                   FfiCode.ABI_SPECIFIC_INTEGER_MAPPING_UNSUPPORTED,
                   arguments: [name],
@@ -1072,7 +1084,7 @@
       if (type is InterfaceType) {
         var nativeTypeName = type.element3.name3!;
         if (!_primitiveIntegerNativeTypesFixedSize.contains(nativeTypeName)) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             arguments.first,
             FfiCode.ABI_SPECIFIC_INTEGER_MAPPING_UNSUPPORTED,
             arguments: [nativeTypeName],
@@ -1099,7 +1111,7 @@
     if (parent is! ArgumentList ||
         grandParent is! MethodInvocation ||
         !grandParent.isNativeLeafInvocation) {
-      _errorReporter.atNode(errorNode, FfiCode.ADDRESS_POSITION);
+      _diagnosticReporter.atNode(errorNode, FfiCode.ADDRESS_POSITION);
     }
   }
 
@@ -1159,7 +1171,7 @@
         }
       default:
     }
-    _errorReporter.atNode(errorNode, FfiCode.ADDRESS_RECEIVER);
+    _diagnosticReporter.atNode(errorNode, FfiCode.ADDRESS_RECEIVER);
   }
 
   void _validateAllocate(FunctionExpressionInvocationImpl node) {
@@ -1174,7 +1186,7 @@
       allowEmptyStruct: true,
     )) {
       AstNode errorNode = node;
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         errorNode,
         FfiCode.NON_CONSTANT_TYPE_ARGUMENT,
         arguments: ['$_allocatorExtensionName.$_allocateExtensionMethodName'],
@@ -1211,19 +1223,19 @@
     if (extraAnnotations.isNotEmpty) {
       if (!requiredFound) {
         Annotation invalidAnnotation = extraAnnotations.removeAt(0);
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           invalidAnnotation,
           FfiCode.MISMATCHED_ANNOTATION_ON_STRUCT_FIELD,
         );
       }
       for (Annotation extraAnnotation in extraAnnotations) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           extraAnnotation,
           FfiCode.EXTRA_ANNOTATION_ON_STRUCT_FIELD,
         );
       }
     } else if (!requiredFound) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         errorNode,
         FfiCode.MISSING_ANNOTATION_ON_STRUCT_FIELD,
         arguments: [
@@ -1256,7 +1268,7 @@
       }
       var pointerTypeArg = (T as InterfaceTypeImpl).typeArguments.single;
       if (pointerTypeArg is TypeParameterType) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           target,
           FfiCode.NON_CONSTANT_TYPE_ARGUMENT,
           arguments: ['asFunction'],
@@ -1264,7 +1276,7 @@
         return;
       }
       if (!_isValidFfiNativeFunctionType(pointerTypeArg)) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           errorNode,
           FfiCode.NON_NATIVE_FUNCTION_TYPE_ARGUMENT_TO_POINTER,
           arguments: [T],
@@ -1280,7 +1292,7 @@
         F,
         TPrime,
       )) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           FfiCode.MUST_BE_A_SUBTYPE,
           arguments: [TPrime, F, 'asFunction'],
@@ -1427,7 +1439,7 @@
     var dartType = typeArgumentTypes[0];
     if (!_isValidFfiNativeType(dartType)) {
       AstNode errorNode = node;
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         errorNode,
         FfiCode.NON_CONSTANT_TYPE_ARGUMENT,
         arguments: ['$errorClass.create'],
@@ -1442,7 +1454,7 @@
 
       if (!_isValidFfiNativeType(T, allowVoid: true, allowEmptyStruct: true)) {
         AstNode errorNode = node;
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           errorNode,
           FfiCode.NON_CONSTANT_TYPE_ARGUMENT,
           arguments: ['elementAt'],
@@ -1458,14 +1470,14 @@
     if (nativeType is FunctionType) {
       if (_primitiveNativeType(nativeType.returnType) ==
           _PrimitiveDartType.handle) {
-        _errorReporter.atEntity(
+        _diagnosticReporter.atEntity(
           errorEntity,
           FfiCode.LEAF_CALL_MUST_NOT_RETURN_HANDLE,
         );
       }
       for (var param in nativeType.normalParameterTypes) {
         if (_primitiveNativeType(param) == _PrimitiveDartType.handle) {
-          _errorReporter.atEntity(
+          _diagnosticReporter.atEntity(
             errorEntity,
             FfiCode.LEAF_CALL_MUST_NOT_TAKE_HANDLE,
           );
@@ -1485,7 +1497,7 @@
     NodeList<Annotation> annotations = node.metadata;
 
     if (node.externalKeyword == null) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         fields.variables[0].name,
         FfiCode.FIELD_MUST_BE_EXTERNAL_IN_STRUCT,
       );
@@ -1493,14 +1505,14 @@
 
     var fieldType = fields.type;
     if (fieldType == null) {
-      _errorReporter.atToken(
+      _diagnosticReporter.atToken(
         fields.variables[0].name,
         FfiCode.MISSING_FIELD_TYPE_IN_STRUCT,
       );
     } else {
       DartType declaredType = fieldType.typeOrThrow;
       if (declaredType.nullabilitySuffix == NullabilitySuffix.question) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           fieldType,
           FfiCode.INVALID_FIELD_TYPE_IN_STRUCT,
           arguments: [fieldType.toSource()],
@@ -1523,7 +1535,7 @@
               errorNode = typeArguments[0];
             }
           }
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             errorNode,
             FfiCode.NON_SIZED_TYPE_ARGUMENT,
             arguments: [_arrayClassName, typeArg],
@@ -1555,14 +1567,14 @@
       } else if (declaredType.isCompoundSubtype) {
         var clazz = (declaredType as InterfaceType).element3;
         if (clazz.isEmptyStruct) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             node,
             FfiCode.EMPTY_STRUCT,
             arguments: [clazz.name3!, clazz.supertype!.getDisplayString()],
           );
         }
       } else {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           fieldType,
           FfiCode.INVALID_FIELD_TYPE_IN_STRUCT,
           arguments: [fieldType.toSource()],
@@ -1588,7 +1600,7 @@
       if (typeArgument != null) {
         errorNode = typeArgument;
       }
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         errorNode,
         FfiCode.MUST_BE_A_NATIVE_FUNCTION_TYPE,
         arguments: [T, 'fromFunction'],
@@ -1603,7 +1615,7 @@
       FT,
       T,
     )) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         f,
         FfiCode.MUST_BE_A_SUBTYPE,
         arguments: [FT, T, 'fromFunction'],
@@ -1618,14 +1630,14 @@
         R.isHandle ||
         R.isCompoundSubtype) {
       if (argCount != 1) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node.argumentList.arguments[1],
           FfiCode.INVALID_EXCEPTION_VALUE,
           arguments: ['fromFunction'],
         );
       }
     } else if (argCount != 2) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node.methodName,
         FfiCode.MISSING_EXCEPTION_VALUE,
         arguments: ['fromFunction'],
@@ -1638,14 +1650,14 @@
         eType,
         R,
       )) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           e,
           FfiCode.MUST_BE_A_SUBTYPE,
           arguments: [eType, R, 'fromFunction'],
         );
       }
       if (!_isConst(e)) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           e,
           FfiCode.ARGUMENT_MUST_BE_A_CONSTANT,
           arguments: ['exceptionalReturn'],
@@ -1663,7 +1675,7 @@
         if (arg is NamedExpression) {
           if (arg.element2?.name3 == _isLeafParamName) {
             if (!_isConst(arg.expression)) {
-              _errorReporter.atNode(
+              _diagnosticReporter.atNode(
                 arg.expression,
                 FfiCode.ARGUMENT_MUST_BE_A_CONSTANT,
                 arguments: [_isLeafParamName],
@@ -1690,7 +1702,7 @@
     var F = argTypes[1];
     if (!_isValidFfiNativeFunctionType(S)) {
       AstNode errorNode = typeArguments[0];
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         errorNode,
         FfiCode.MUST_BE_A_NATIVE_FUNCTION_TYPE,
         arguments: [S, 'lookupFunction'],
@@ -1704,7 +1716,7 @@
       S,
     )) {
       AstNode errorNode = typeArguments[1];
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         errorNode,
         FfiCode.MUST_BE_A_SUBTYPE,
         arguments: [S, F, 'lookupFunction'],
@@ -1753,14 +1765,14 @@
             if (targetType case InterfaceTypeImpl(isNativeFunction: true)) {
               var targetFunctionType = targetType.typeArguments[0];
               if (!typeSystem.isEqualTo(nativeType, targetFunctionType)) {
-                _errorReporter.atNode(
+                _diagnosticReporter.atNode(
                   node,
                   FfiCode.MUST_BE_A_SUBTYPE,
                   arguments: [nativeType, targetFunctionType, _nativeAddressOf],
                 );
               }
             } else {
-              _errorReporter.atNode(
+              _diagnosticReporter.atNode(
                 node,
                 FfiCode.MUST_BE_A_NATIVE_FUNCTION_TYPE,
                 arguments: [targetType, _nativeAddressOf],
@@ -1790,7 +1802,7 @@
                 if (targetType case InterfaceTypeImpl(isNativeFunction: true)) {
                   var targetFunctionType = targetType.typeArguments[0];
                   if (!typeSystem.isEqualTo(staticType, targetFunctionType)) {
-                    _errorReporter.atNode(
+                    _diagnosticReporter.atNode(
                       node,
                       FfiCode.MUST_BE_A_SUBTYPE,
                       arguments: [
@@ -1801,7 +1813,7 @@
                     );
                   }
                 } else {
-                  _errorReporter.atNode(
+                  _diagnosticReporter.atNode(
                     node,
                     FfiCode.MUST_BE_A_NATIVE_FUNCTION_TYPE,
                     arguments: [targetType, _nativeAddressOf],
@@ -1809,7 +1821,7 @@
                 }
               } else {
                 if (!typeSystem.isEqualTo(staticType, targetType)) {
-                  _errorReporter.atNode(
+                  _diagnosticReporter.atNode(
                     node,
                     FfiCode.MUST_BE_A_SUBTYPE,
                     arguments: [staticType, targetType, _nativeAddressOf],
@@ -1826,7 +1838,7 @@
     }
 
     if (!validTarget) {
-      _errorReporter.atNode(argument, FfiCode.ARGUMENT_MUST_BE_NATIVE);
+      _diagnosticReporter.atNode(argument, FfiCode.ARGUMENT_MUST_BE_NATIVE);
     }
   }
 
@@ -1851,7 +1863,7 @@
 
     var typeArg = nodeType.typeArguments[0];
     if (!_isValidFfiNativeFunctionType(typeArg)) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node.constructorName,
         FfiCode.MUST_BE_A_NATIVE_FUNCTION_TYPE,
         arguments: [typeArg, _nativeCallable],
@@ -1866,7 +1878,7 @@
       funcType,
       typeArg,
     )) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         f,
         FfiCode.MUST_BE_A_SUBTYPE,
         arguments: [funcType, typeArg, _nativeCallable],
@@ -1881,14 +1893,14 @@
           natRetType.isHandle ||
           natRetType.isCompoundSubtype) {
         if (argCount != 1) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             node.argumentList.arguments[1],
             FfiCode.INVALID_EXCEPTION_VALUE,
             arguments: [name],
           );
         }
       } else if (argCount != 2) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           node,
           FfiCode.MISSING_EXCEPTION_VALUE,
           arguments: [name],
@@ -1901,14 +1913,14 @@
           eType,
           natRetType,
         )) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             e,
             FfiCode.MUST_BE_A_SUBTYPE,
             arguments: [eType, natRetType, name],
           );
         }
         if (!_isConst(e)) {
-          _errorReporter.atNode(
+          _diagnosticReporter.atNode(
             e,
             FfiCode.ARGUMENT_MUST_BE_A_CONSTANT,
             arguments: ['exceptionalReturn'],
@@ -1917,7 +1929,7 @@
       }
     } else {
       if (_primitiveNativeType(natRetType) != _PrimitiveDartType.void_) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           f,
           FfiCode.MUST_RETURN_VOID,
           arguments: [natRetType],
@@ -1930,7 +1942,10 @@
   void _validateNoAnnotations(NodeList<Annotation> annotations) {
     for (Annotation annotation in annotations) {
       if (annotation.element2.ffiClass != null) {
-        _errorReporter.atNode(annotation, FfiCode.ANNOTATION_ON_POINTER_FIELD);
+        _diagnosticReporter.atNode(
+          annotation,
+          FfiCode.ANNOTATION_ON_POINTER_FIELD,
+        );
       }
     }
   }
@@ -1947,7 +1962,7 @@
     if (ffiPackedAnnotations.length > 1) {
       var extraAnnotations = ffiPackedAnnotations.skip(1);
       for (var annotation in extraAnnotations) {
-        _errorReporter.atNode(annotation, FfiCode.PACKED_ANNOTATION);
+        _diagnosticReporter.atNode(annotation, FfiCode.PACKED_ANNOTATION);
       }
     }
 
@@ -1960,7 +1975,10 @@
       if (arguments != null && arguments.isNotEmpty) {
         errorNode = arguments[0];
       }
-      _errorReporter.atNode(errorNode, FfiCode.PACKED_ANNOTATION_ALIGNMENT);
+      _diagnosticReporter.atNode(
+        errorNode,
+        FfiCode.PACKED_ANNOTATION_ALIGNMENT,
+      );
     }
   }
 
@@ -1972,7 +1990,7 @@
       allowArray: true,
     )) {
       AstNode errorNode = node;
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         errorNode,
         FfiCode.NON_CONSTANT_TYPE_ARGUMENT,
         arguments: ['[]'],
@@ -1986,7 +2004,7 @@
     var targetType = node.prefix.staticType;
     if (!_isValidFfiNativeType(targetType, allowEmptyStruct: true)) {
       AstNode errorNode = node;
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         errorNode,
         FfiCode.NON_CONSTANT_TYPE_ARGUMENT,
         arguments: ['ref'],
@@ -1998,7 +2016,7 @@
     var targetType = node.realTarget.typeOrThrow;
     if (!_isValidFfiNativeType(targetType, allowEmptyStruct: true)) {
       AstNode errorNode = node;
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         errorNode,
         FfiCode.NON_CONSTANT_TYPE_ARGUMENT,
         arguments: ['ref'],
@@ -2012,7 +2030,7 @@
   void _validateRefWithFinalizer(MethodInvocationImpl node) {
     var targetType = node.realTarget?.typeOrThrow;
     if (!_isValidFfiNativeType(targetType, allowEmptyStruct: true)) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         node,
         FfiCode.NON_CONSTANT_TYPE_ARGUMENT,
         arguments: ['refWithFinalizer'],
@@ -2028,7 +2046,7 @@
     var T = typeArgumentTypes[0];
     if (!_isValidFfiNativeType(T, allowVoid: true, allowEmptyStruct: true)) {
       AstNode errorNode = node;
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         errorNode,
         FfiCode.NON_CONSTANT_TYPE_ARGUMENT,
         arguments: ['sizeOf'],
@@ -2049,7 +2067,7 @@
         annotations.where((annotation) => annotation.isArray).toList();
 
     if (ffiSizeAnnotations.isEmpty) {
-      _errorReporter.atEntity(
+      _diagnosticReporter.atEntity(
         errorEntity,
         FfiCode.MISSING_SIZE_ANNOTATION_CARRAY,
       );
@@ -2059,7 +2077,10 @@
     if (ffiSizeAnnotations.length > 1) {
       var extraAnnotations = ffiSizeAnnotations.skip(1);
       for (var annotation in extraAnnotations) {
-        _errorReporter.atNode(annotation, FfiCode.EXTRA_SIZE_ANNOTATION_CARRAY);
+        _diagnosticReporter.atNode(
+          annotation,
+          FfiCode.EXTRA_SIZE_ANNOTATION_CARRAY,
+        );
       }
     }
 
@@ -2069,12 +2090,15 @@
         annotation.elementAnnotation?.arraySizeDimensions ?? (<int>[], false);
     var annotationDimensions = dimensions.length;
     if (annotationDimensions != arrayDimensions) {
-      _errorReporter.atNode(annotation, FfiCode.SIZE_ANNOTATION_DIMENSIONS);
+      _diagnosticReporter.atNode(
+        annotation,
+        FfiCode.SIZE_ANNOTATION_DIMENSIONS,
+      );
     }
 
     if (variableLength) {
       if (!allowVariableLength) {
-        _errorReporter.atNode(
+        _diagnosticReporter.atNode(
           annotation,
           FfiCode.VARIABLE_LENGTH_ARRAY_NOT_LAST,
         );
@@ -2123,13 +2147,19 @@
       if (i == 0 && variableLength) {
         // Variable dimension can't be negative.
         if (dimensions[0] < 0) {
-          _errorReporter.atNode(errorNode, FfiCode.NEGATIVE_VARIABLE_DIMENSION);
+          _diagnosticReporter.atNode(
+            errorNode,
+            FfiCode.NEGATIVE_VARIABLE_DIMENSION,
+          );
         }
         continue;
       }
 
       if (dimensions[i] <= 0) {
-        _errorReporter.atNode(errorNode, FfiCode.NON_POSITIVE_ARRAY_DIMENSION);
+        _diagnosticReporter.atNode(
+          errorNode,
+          FfiCode.NON_POSITIVE_ARRAY_DIMENSION,
+        );
       }
     }
   }
@@ -2138,7 +2168,7 @@
   /// if a diagnostic was produced because it isn't constant.
   bool _validateTypeArgument(TypeAnnotation typeArgument, String functionName) {
     if (typeArgument.type is TypeParameterType) {
-      _errorReporter.atNode(
+      _diagnosticReporter.atNode(
         typeArgument,
         FfiCode.NON_CONSTANT_TYPE_ARGUMENT,
         arguments: [functionName],
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index 66c174c..1535934 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -36,7 +36,7 @@
     required LibraryLanguageVersion languageVersion,
     required LineInfo lineInfo,
   }) : astBuilder = AstBuilder(
-         ErrorReporter(diagnosticListener, source),
+         DiagnosticReporter(diagnosticListener, source),
          source.uri,
          true,
          featureSet,
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 3e69485..8984266 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -163,7 +163,7 @@
 
   @override
   late final SharedTypeAnalyzerErrors errors = SharedTypeAnalyzerErrors(
-    errorReporter,
+    diagnosticReporter,
   );
 
   /// The source representing the compilation unit being visited.
@@ -173,7 +173,7 @@
   final TypeProviderImpl typeProvider;
 
   @override
-  final ErrorReporter errorReporter;
+  final DiagnosticReporter diagnosticReporter;
 
   /// The analysis options used by this resolver.
   final AnalysisOptions analysisOptions;
@@ -205,7 +205,7 @@
   late final BoolExpressionVerifier boolExpressionVerifier =
       BoolExpressionVerifier(
         resolver: this,
-        errorReporter: errorReporter,
+        diagnosticReporter: diagnosticReporter,
         nullableDereferenceVerifier: nullableDereferenceVerifier,
       );
 
@@ -213,7 +213,7 @@
   late final NullableDereferenceVerifier nullableDereferenceVerifier =
       NullableDereferenceVerifier(
         typeSystem: typeSystem,
-        errorReporter: errorReporter,
+        diagnosticReporter: diagnosticReporter,
         resolver: this,
       );
 
@@ -349,7 +349,7 @@
          source,
          definingLibrary.typeSystem,
          typeProvider as TypeProviderImpl,
-         ErrorReporter(diagnosticListener, source),
+         DiagnosticReporter(diagnosticListener, source),
          featureSet,
          analysisOptions,
          flowAnalysisHelper,
@@ -364,7 +364,7 @@
     this.source,
     this.typeSystem,
     this.typeProvider,
-    this.errorReporter,
+    this.diagnosticReporter,
     FeatureSet featureSet,
     this.analysisOptions,
     this.flowAnalysis, {
@@ -379,11 +379,11 @@
        ),
        baseOrFinalTypeVerifier = BaseOrFinalTypeVerifier(
          definingLibrary: definingLibrary,
-         errorReporter: errorReporter,
+         diagnosticReporter: diagnosticReporter,
        ) {
     inferenceHelper = InvocationInferenceHelper(
       resolver: this,
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
       typeSystem: typeSystem,
       dataForTesting:
           flowAnalysis.dataForTesting != null
@@ -405,7 +405,7 @@
     _yieldStatementResolver = YieldStatementResolver(resolver: this);
     nullSafetyDeadCodeVerifier = NullSafetyDeadCodeVerifier(
       typeSystem,
-      errorReporter,
+      diagnosticReporter,
       flowAnalysis,
     );
     elementResolver = ElementResolver(this);
@@ -495,14 +495,14 @@
             variablePattern.fieldNameWithImplicitName = fieldName;
             nameToken = variablePattern.name;
           } else {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               field,
               CompileTimeErrorCode.MISSING_NAMED_PATTERN_FIELD_NAME,
             );
           }
         }
       } else if (mustBeNamed) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           field,
           CompileTimeErrorCode.POSITIONAL_FIELD_IN_OBJECT_PATTERN,
         );
@@ -597,19 +597,19 @@
         }
       }
       if (errorNode is ConstructorDeclaration) {
-        errorReporter.atConstructorDeclaration(
+        diagnosticReporter.atConstructorDeclaration(
           errorNode,
           diagnosticCode,
           arguments: [returnType],
         );
       } else if (errorNode is BlockFunctionBody) {
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           errorNode.block.leftBracket,
           diagnosticCode,
           arguments: [returnType],
         );
       } else if (errorNode is Token) {
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           errorNode,
           diagnosticCode,
           arguments: [returnType],
@@ -647,7 +647,7 @@
           errorNode = pattern.type;
         }
         errorNode ??= pattern;
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           errorNode,
           WarningCode.PATTERN_NEVER_MATCHES_VALUE_TYPE,
           arguments: [matchedValueType, requiredType],
@@ -674,7 +674,7 @@
 
       if (element.isLate) {
         if (unassigned) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             node,
             CompileTimeErrorCode.DEFINITELY_UNASSIGNED_LATE_LOCAL_VARIABLE,
             arguments: [node.name],
@@ -685,7 +685,7 @@
 
       if (!assigned) {
         if (element.isFinal) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             node,
             CompileTimeErrorCode.READ_POTENTIALLY_UNASSIGNED_FINAL,
             arguments: [node.name],
@@ -694,7 +694,7 @@
         }
 
         if (typeSystem.isPotentiallyNonNullable(element.type)) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             node,
             CompileTimeErrorCode
                 .NOT_ASSIGNED_POTENTIALLY_NON_NULLABLE_LOCAL_VARIABLE,
@@ -732,7 +732,7 @@
           continue;
         }
         messages = entry.value.accept(whyNotPromotedVisitor);
-        // `messages` will be passed to the ErrorReporter, which might add
+        // `messages` will be passed to the DiagnosticReporter, which might add
         // additional entries. So make sure that it's not a `const []`.
         assert(_isModifiableList(messages));
         if (messages.isNotEmpty) {
@@ -919,7 +919,7 @@
       for (var reference in variable.references) {
         if (variable.inconsistency ==
             shared.JoinedPatternVariableInconsistency.sharedCaseAbsent) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             reference,
             CompileTimeErrorCode
                 .PATTERN_VARIABLE_SHARED_CASE_SCOPE_NOT_ALL_CASES,
@@ -927,14 +927,14 @@
           );
         } else if (variable.inconsistency ==
             shared.JoinedPatternVariableInconsistency.sharedCaseHasLabel) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             reference,
             CompileTimeErrorCode.PATTERN_VARIABLE_SHARED_CASE_SCOPE_HAS_LABEL,
             arguments: [variable.name3!],
           );
         } else if (variable.inconsistency ==
             shared.JoinedPatternVariableInconsistency.differentFinalityOrType) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             reference,
             CompileTimeErrorCode
                 .PATTERN_VARIABLE_SHARED_CASE_SCOPE_DIFFERENT_FINALITY_OR_TYPE,
@@ -1215,7 +1215,7 @@
     var typeArgumentTypes = typeSystem.inferFunctionTypeInstantiation(
       context,
       staticType,
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
       errorNode: expression,
       // If the constructor-tearoffs feature is enabled, then so is
       // generic-metadata.
@@ -1423,14 +1423,14 @@
       var flow = this.flow;
       if (element.isLate) {
         if (flow.isAssigned(element)) {
-          errorReporter.atToken(
+          diagnosticReporter.atToken(
             node.name,
             CompileTimeErrorCode.LATE_FINAL_LOCAL_ALREADY_ASSIGNED,
           );
         }
       } else {
         if (!flow.isUnassigned(element)) {
-          errorReporter.atToken(
+          diagnosticReporter.atToken(
             node.name,
             CompileTimeErrorCode.ASSIGNMENT_TO_FINAL_LOCAL,
             arguments: [node.name.lexeme],
@@ -1541,7 +1541,7 @@
       );
 
       if (hasRead && result.readElementRequested2 == null) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           node,
           CompileTimeErrorCode.UNDEFINED_IDENTIFIER,
           arguments: [node.name],
@@ -1578,7 +1578,7 @@
           valueType: SharedTypeView(typeArgumentsList.arguments[1].typeOrThrow),
         );
       } else {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           typeArgumentsList,
           CompileTimeErrorCode.EXPECTED_TWO_MAP_PATTERN_TYPE_ARGUMENTS,
           arguments: [length],
@@ -1629,7 +1629,7 @@
     );
 
     if (result.needsGetterError) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         nameToken,
         CompileTimeErrorCode.UNDEFINED_GETTER,
         arguments: [nameToken.lexeme, receiverType],
@@ -1685,7 +1685,7 @@
     );
 
     if (result.needsGetterError) {
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         node.operator,
         CompileTimeErrorCode.UNDEFINED_OPERATOR,
         arguments: [methodName, matchedType],
@@ -1909,7 +1909,7 @@
           typeSystem.isNullable(element.type) &&
           typeSystem.isNonNullable(staticType) &&
           flowAnalysis.isDefinitelyUnassigned(simpleIdentifier, element)) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           simpleIdentifier,
           WarningCode.CAST_FROM_NULLABLE_ALWAYS_FAILS,
           arguments: [simpleIdentifier.name],
@@ -2591,7 +2591,7 @@
         if (constructorElement.isFactory) {
           var constructorName = node.arguments?.constructorSelector?.name;
           var errorTarget = constructorName ?? node.name;
-          errorReporter.atEntity(
+          diagnosticReporter.atEntity(
             errorTarget,
             CompileTimeErrorCode.ENUM_CONSTANT_INVOKES_FACTORY_CONSTRUCTOR,
           );
@@ -2600,13 +2600,13 @@
         if (constructorName.type.element2 is EnumElementImpl2) {
           var nameNode = node.arguments?.constructorSelector?.name;
           if (nameNode != null) {
-            errorReporter.atNode(
+            diagnosticReporter.atNode(
               nameNode,
               CompileTimeErrorCode.UNDEFINED_ENUM_CONSTRUCTOR_NAMED,
               arguments: [nameNode.name],
             );
           } else {
-            errorReporter.atToken(
+            diagnosticReporter.atToken(
               node.name,
               CompileTimeErrorCode.UNDEFINED_ENUM_CONSTRUCTOR_UNNAMED,
             );
@@ -2621,7 +2621,7 @@
               ResolverVisitor.resolveArgumentsToParameters(
                 argumentList: argumentList,
                 formalParameters: constructorElement.formalParameters,
-                errorReporter: errorReporter,
+                diagnosticReporter: diagnosticReporter,
               );
         } else if (definingLibrary.featureSet.isEnabled(
           Feature.enhanced_enums,
@@ -2636,7 +2636,7 @@
               requiredParameterCount: requiredParameterCount,
               actualArgumentCount: 0,
               nameNode: node,
-              errorReporter: errorReporter,
+              diagnosticReporter: diagnosticReporter,
             );
           }
         }
@@ -4271,7 +4271,7 @@
           return;
         }
 
-        errorReporter.atToken(
+        diagnosticReporter.atToken(
           errorNode.block.leftBracket,
           WarningCode.BODY_MIGHT_COMPLETE_NORMALLY_CATCH_ERROR,
           arguments: [returnTypeBase],
@@ -4296,7 +4296,7 @@
     }
     if (error.kind == TopLevelInferenceErrorKind.dependencyCycle) {
       var argumentsText = error.arguments.join(', ');
-      errorReporter.atToken(
+      diagnosticReporter.atToken(
         node.name,
         CompileTimeErrorCode.TOP_LEVEL_CYCLE,
         arguments: [node.name.lexeme, argumentsText],
@@ -4393,7 +4393,7 @@
       typeArgumentTypes = typeSystem.inferFunctionTypeInstantiation(
         context,
         callMethodType,
-        errorReporter: errorReporter,
+        diagnosticReporter: diagnosticReporter,
         errorNode: expression,
         // If the constructor-tearoffs feature is enabled, then so is
         // generic-metadata.
@@ -4610,7 +4610,7 @@
   static List<FormalParameterElementMixin?> resolveArgumentsToParameters({
     required ArgumentList argumentList,
     required List<FormalParameterElement> formalParameters,
-    ErrorReporter? errorReporter,
+    DiagnosticReporter? diagnosticReporter,
     ConstructorDeclaration? enclosingConstructor,
   }) {
     int requiredParameterCount = 0;
@@ -4664,7 +4664,7 @@
       var result = verifySuperFormalParameters(
         constructor: enclosingConstructor,
         hasExplicitPositionalArguments: positionalArgumentCount != 0,
-        errorReporter: errorReporter,
+        diagnosticReporter: diagnosticReporter,
       );
       positionalArgumentCount += result.positionalArgumentCount;
       if (result.namedArgumentNames.isNotEmpty) {
@@ -4679,7 +4679,7 @@
         String name = nameNode.name;
         var element = namedParameters != null ? namedParameters[name] : null;
         if (element == null) {
-          errorReporter?.atNode(
+          diagnosticReporter?.atNode(
             nameNode,
             CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER,
             arguments: [name],
@@ -4690,7 +4690,7 @@
         }
         usedNames ??= <String>{};
         if (!usedNames.add(name)) {
-          errorReporter?.atNode(
+          diagnosticReporter?.atNode(
             nameNode,
             CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT,
             arguments: [name],
@@ -4701,7 +4701,7 @@
 
     if (positionalArgumentCount < requiredParameterCount && noBlankArguments) {
       var parent = argumentList.parent;
-      if (errorReporter != null && parent != null) {
+      if (diagnosticReporter != null && parent != null) {
         var token =
             lastPositionalArgument?.endToken.next ??
             argumentList.leftParenthesis.next ??
@@ -4711,7 +4711,7 @@
           requiredParameterCount: requiredParameterCount,
           actualArgumentCount: positionalArgumentCount,
           nameNode: parent,
-          errorReporter: errorReporter,
+          diagnosticReporter: diagnosticReporter,
         );
       }
     } else if (positionalArgumentCount > unnamedParameterCount &&
@@ -4726,7 +4726,7 @@
         diagnosticCode = CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS;
       }
       if (firstUnresolvedArgument != null) {
-        errorReporter?.atNode(
+        diagnosticReporter?.atNode(
           firstUnresolvedArgument,
           diagnosticCode,
           arguments: [unnamedParameterCount, positionalArgumentCount],
@@ -4758,7 +4758,7 @@
     required int requiredParameterCount,
     required int actualArgumentCount,
     required AstNode nameNode,
-    required ErrorReporter errorReporter,
+    required DiagnosticReporter diagnosticReporter,
   }) {
     String? name;
     if (nameNode is InstanceCreationExpression) {
@@ -4832,7 +4832,7 @@
                   .NOT_ENOUGH_POSITIONAL_ARGUMENTS_NAME_SINGULAR;
       arguments.add(name);
     }
-    errorReporter.atToken(token, diagnosticCode, arguments: arguments);
+    diagnosticReporter.atToken(token, diagnosticCode, arguments: arguments);
   }
 }
 
@@ -4842,9 +4842,9 @@
 // TODO(paulberry): migrate the responsibility for all scope resolution into
 // this visitor.
 class ScopeResolverVisitor extends UnifyingAstVisitor<void> {
-  /// The error reporter that will be informed of any errors that are found
-  /// during resolution.
-  final ErrorReporter errorReporter;
+  /// The diagnostic reporter that will be informed of any diagnostics that are
+  /// found during resolution.
+  final DiagnosticReporter diagnosticReporter;
 
   /// The scope used to resolve identifiers.
   Scope nameScope;
@@ -4869,12 +4869,12 @@
 
   /// Initialize a newly created visitor to resolve the nodes in an AST node.
   ///
-  /// [errorReporter] is the error reporter that will be informed of any errors
+  /// [diagnosticReporter] is the error reporter that will be informed of any errors
   /// that are found during resolution.
   /// [nameScope] is the scope used to resolve identifiers in the node that will
   /// first be visited.
   ScopeResolverVisitor(
-    this.errorReporter, {
+    this.diagnosticReporter, {
     required this.nameScope,
     List<LibraryElement> docImportLibraries = const [],
   }) : _docImportScope = DocumentationCommentScope(
@@ -5530,7 +5530,7 @@
       if (node.inSetterContext()) {
         if (element is PatternVariableElementImpl2 &&
             element.isVisitingWhenClause) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             node,
             CompileTimeErrorCode.PATTERN_VARIABLE_ASSIGNMENT_INSIDE_GUARD,
           );
@@ -5671,7 +5671,7 @@
       if (labelScope == null) {
         // There are no labels in scope, so by definition the label is
         // undefined.
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           labelNode,
           CompileTimeErrorCode.LABEL_UNDEFINED,
           arguments: [labelNode.name],
@@ -5682,7 +5682,7 @@
       if (definingScope == null) {
         // No definition of the given label name could be found in any
         // enclosing scope.
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           labelNode,
           CompileTimeErrorCode.LABEL_UNDEFINED,
           arguments: [labelNode.name],
@@ -5695,7 +5695,7 @@
         var labelFragment = definingScope.element.firstFragment;
         var labelContainer = labelFragment.enclosingFragment;
         if (!identical(labelContainer, enclosingClosure.firstFragment)) {
-          errorReporter.atNode(
+          diagnosticReporter.atNode(
             labelNode,
             CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE,
             arguments: [labelNode.name],
@@ -5708,7 +5708,7 @@
           node is! ForStatement &&
           node is! SwitchMember &&
           node is! WhileStatement) {
-        errorReporter.atNode(
+        diagnosticReporter.atNode(
           parentNode,
           CompileTimeErrorCode.CONTINUE_LABEL_INVALID,
         );
diff --git a/pkg/analyzer/lib/src/generated/scope_helpers.dart b/pkg/analyzer/lib/src/generated/scope_helpers.dart
index d75d735..116fb0f 100644
--- a/pkg/analyzer/lib/src/generated/scope_helpers.dart
+++ b/pkg/analyzer/lib/src/generated/scope_helpers.dart
@@ -12,7 +12,7 @@
 /// mixin exists to allow code to be more easily shared between separate
 /// resolvers.
 mixin ScopeHelpers {
-  ErrorReporter get errorReporter;
+  DiagnosticReporter get diagnosticReporter;
 
   void reportDeprecatedExportUse({
     required ScopeLookupResult scopeLookupResult,
@@ -56,7 +56,7 @@
   }
 
   void _reportDeprecatedExportUse({required Token nameToken}) {
-    errorReporter.atToken(
+    diagnosticReporter.atToken(
       nameToken,
       WarningCode.DEPRECATED_EXPORT_USE,
       arguments: [nameToken.lexeme],
diff --git a/pkg/analyzer/lib/src/hint/sdk_constraint_verifier.dart b/pkg/analyzer/lib/src/hint/sdk_constraint_verifier.dart
index 2746a7f..d9bce31 100644
--- a/pkg/analyzer/lib/src/hint/sdk_constraint_verifier.dart
+++ b/pkg/analyzer/lib/src/hint/sdk_constraint_verifier.dart
@@ -17,7 +17,7 @@
 /// minimum version required by the SDK constraints in `pubspec.yaml`.
 class SdkConstraintVerifier extends RecursiveAstVisitor<void> {
   /// The error reporter to be used to report errors.
-  final ErrorReporter _errorReporter;
+  final DiagnosticReporter _errorReporter;
 
   /// The version constraint for the SDK.
   final VersionConstraint _versionConstraint;
diff --git a/pkg/analyzer/lib/src/lint/constants.dart b/pkg/analyzer/lib/src/lint/constants.dart
index 772f20d..12d0dde 100644
--- a/pkg/analyzer/lib/src/lint/constants.dart
+++ b/pkg/analyzer/lib/src/lint/constants.dart
@@ -92,7 +92,7 @@
     );
 
     var listener = _ConstantDiagnosticListener();
-    var errorReporter = ErrorReporter(listener, unitFragment.source);
+    var errorReporter = DiagnosticReporter(listener, unitFragment.source);
 
     accept(ConstantVerifier(errorReporter, libraryElement, declaredVariables));
     return listener.hasConstError;
diff --git a/pkg/analyzer/lib/src/lint/options_rule_validator.dart b/pkg/analyzer/lib/src/lint/options_rule_validator.dart
index 43ae40b..bd7b241 100644
--- a/pkg/analyzer/lib/src/lint/options_rule_validator.dart
+++ b/pkg/analyzer/lib/src/lint/options_rule_validator.dart
@@ -46,7 +46,7 @@
   }
 
   @override
-  List<Diagnostic> validate(ErrorReporter reporter, YamlMap options) {
+  List<Diagnostic> validate(DiagnosticReporter reporter, YamlMap options) {
     var node = options.valueAt(linter);
     if (node is YamlMap) {
       var rules = node.valueAt(rulesKey);
@@ -55,7 +55,7 @@
     return const [];
   }
 
-  void _validateRules(YamlNode? rules, ErrorReporter reporter) {
+  void _validateRules(YamlNode? rules, DiagnosticReporter reporter) {
     var seenRules = <String>{};
 
     String? findIncompatibleRule(AbstractAnalysisRule rule) {
diff --git a/pkg/analyzer/lib/src/manifest/manifest_validator.dart b/pkg/analyzer/lib/src/manifest/manifest_validator.dart
index 52be296..071a65d 100644
--- a/pkg/analyzer/lib/src/manifest/manifest_validator.dart
+++ b/pkg/analyzer/lib/src/manifest/manifest_validator.dart
@@ -415,7 +415,7 @@
     if (!checkManifest) return [];
 
     RecordingDiagnosticListener recorder = RecordingDiagnosticListener();
-    ErrorReporter reporter = ErrorReporter(recorder, source);
+    DiagnosticReporter reporter = DiagnosticReporter(recorder, source);
 
     var xmlParser = ManifestParser(content, source.uri);
 
@@ -423,7 +423,7 @@
     return recorder.diagnostics;
   }
 
-  void _checkManifestTag(ManifestParser parser, ErrorReporter reporter) {
+  void _checkManifestTag(ManifestParser parser, DiagnosticReporter reporter) {
     ParseTagResult parseTagResult;
     while ((parseTagResult = parser.parseXmlTag()).element?.name !=
         manifestTag) {
@@ -468,7 +468,7 @@
 
   /// Report an error for the given node.
   void _reportErrorForNode(
-    ErrorReporter reporter,
+    DiagnosticReporter reporter,
     XmlElement node,
     String? key,
     DiagnosticCode diagnosticCode, [
@@ -485,7 +485,7 @@
   }
 
   /// Validate the 'activity' tags.
-  void _validateActivity(XmlElement activity, ErrorReporter reporter) {
+  void _validateActivity(XmlElement activity, DiagnosticReporter reporter) {
     var attributes = activity.attributes;
     if (attributes.containsKey(attributeScreenOrientation)) {
       if (unsupportedOrientations.contains(
@@ -514,7 +514,7 @@
   /// Validate the `uses-feature` tags.
   void _validateFeatures(
     Iterable<XmlElement> features,
-    ErrorReporter reporter,
+    DiagnosticReporter reporter,
   ) {
     var unsupported = features.where(
       (element) => unsupportedHardwareFeatures.contains(
@@ -556,7 +556,7 @@
   void _validatePermissions(
     Iterable<XmlElement> permissions,
     Iterable<XmlElement> features,
-    ErrorReporter reporter,
+    DiagnosticReporter reporter,
   ) {
     for (var permission in permissions) {
       if (permission.attributes[androidName]?.value ==
@@ -591,7 +591,7 @@
   void _validateTouchScreenFeature(
     Iterable<XmlElement> features,
     XmlElement manifest,
-    ErrorReporter reporter,
+    DiagnosticReporter reporter,
   ) {
     var feature = features.firstWhereOrNull(
       (element) =>
diff --git a/pkg/analyzer/lib/src/plugin/options.dart b/pkg/analyzer/lib/src/plugin/options.dart
index bf0da21..1a8fae3 100644
--- a/pkg/analyzer/lib/src/plugin/options.dart
+++ b/pkg/analyzer/lib/src/plugin/options.dart
@@ -41,5 +41,5 @@
 ///
 abstract class OptionsValidator {
   /// Validate [options], reporting any errors to the given [reporter].
-  void validate(ErrorReporter reporter, YamlMap options);
+  void validate(DiagnosticReporter reporter, YamlMap options);
 }
diff --git a/pkg/analyzer/lib/src/pubspec/pubspec_validator.dart b/pkg/analyzer/lib/src/pubspec/pubspec_validator.dart
index 112203e..5b9b85a 100644
--- a/pkg/analyzer/lib/src/pubspec/pubspec_validator.dart
+++ b/pkg/analyzer/lib/src/pubspec/pubspec_validator.dart
@@ -46,7 +46,7 @@
   AnalysisOptions? analysisOptions,
 }) {
   var recorder = RecordingDiagnosticListener();
-  ErrorReporter reporter = ErrorReporter(recorder, source);
+  DiagnosticReporter reporter = DiagnosticReporter(recorder, source);
   var ctx = PubspecValidationContext._(
     contents: contents,
     source: source,
@@ -137,7 +137,7 @@
   final Source source;
 
   /// The reporter to which errors should be reported.
-  final ErrorReporter reporter;
+  final DiagnosticReporter reporter;
 
   /// The resource provider used to access the file system.
   final ResourceProvider provider;
diff --git a/pkg/analyzer/lib/src/pubspec/validators/missing_dependency_validator.dart b/pkg/analyzer/lib/src/pubspec/validators/missing_dependency_validator.dart
index feae43f..9f3ff29 100644
--- a/pkg/analyzer/lib/src/pubspec/validators/missing_dependency_validator.dart
+++ b/pkg/analyzer/lib/src/pubspec/validators/missing_dependency_validator.dart
@@ -30,7 +30,7 @@
   final Source source;
 
   /// The reporter to which errors should be reported.
-  late ErrorReporter reporter;
+  late DiagnosticReporter reporter;
 
   /// The resource provider used to access the file system.
   final ResourceProvider provider;
@@ -46,7 +46,7 @@
 
   MissingDependencyValidator(this.contents, this.source, this.provider)
     : recorder = RecordingDiagnosticListener() {
-    reporter = ErrorReporter(recorder, source);
+    reporter = DiagnosticReporter(recorder, source);
   }
 
   /// Given the set of dependencies and dev dependencies used in the sources,
diff --git a/pkg/analyzer/lib/src/summary2/ast_resolver.dart b/pkg/analyzer/lib/src/summary2/ast_resolver.dart
index f7cc1ac..34ec6e9 100644
--- a/pkg/analyzer/lib/src/summary2/ast_resolver.dart
+++ b/pkg/analyzer/lib/src/summary2/ast_resolver.dart
@@ -37,7 +37,7 @@
     dataForTesting: null,
   );
   late final _scopeResolverVisitor = ScopeResolverVisitor(
-    ErrorReporter(_diagnosticListener, _unitElement.source),
+    DiagnosticReporter(_diagnosticListener, _unitElement.source),
     nameScope: _nameScope,
   );
   late final _typeAnalyzerOptions = computeTypeAnalyzerOptions(_featureSet);
diff --git a/pkg/analyzer/lib/src/task/options.dart b/pkg/analyzer/lib/src/task/options.dart
index d38014e..8245451 100644
--- a/pkg/analyzer/lib/src/task/options.dart
+++ b/pkg/analyzer/lib/src/task/options.dart
@@ -253,7 +253,7 @@
   String? firstEnabledPluginName,
 }) {
   RecordingDiagnosticListener recorder = RecordingDiagnosticListener();
-  ErrorReporter reporter = ErrorReporter(recorder, source);
+  DiagnosticReporter reporter = DiagnosticReporter(recorder, source);
   _LegacyPluginsOptionValidator(
     firstEnabledPluginName,
   ).validate(reporter, options);
@@ -408,7 +408,7 @@
 
   List<Diagnostic> validate(YamlMap options) {
     RecordingDiagnosticListener recorder = RecordingDiagnosticListener();
-    ErrorReporter reporter = ErrorReporter(recorder, _source);
+    DiagnosticReporter reporter = DiagnosticReporter(recorder, _source);
     for (var validator in _validators) {
       validator.validate(reporter, options);
     }
@@ -443,7 +443,7 @@
           .toSet();
 
   @override
-  void validate(ErrorReporter reporter, YamlMap options) {
+  void validate(DiagnosticReporter reporter, YamlMap options) {
     var analyzer = options.valueAt(AnalysisOptionsFile.analyzer);
     if (analyzer is YamlMap) {
       var unignorableNames = analyzer.valueAt(AnalysisOptionsFile.cannotIgnore);
@@ -493,7 +493,7 @@
 /// Validates `code-style` options.
 class _CodeStyleOptionsValidator extends OptionsValidator {
   @override
-  void validate(ErrorReporter reporter, YamlMap options) {
+  void validate(DiagnosticReporter reporter, YamlMap options) {
     var codeStyle = options.valueAt(AnalysisOptionsFile.codeStyle);
     if (codeStyle is YamlMap) {
       codeStyle.nodeMap.forEach((keyNode, valueNode) {
@@ -523,7 +523,7 @@
     }
   }
 
-  void _validateFormat(ErrorReporter reporter, YamlNode format) {
+  void _validateFormat(DiagnosticReporter reporter, YamlNode format) {
     if (format is YamlMap) {
       reporter.atSourceSpan(
         format.span,
@@ -560,7 +560,7 @@
   _CompositeValidator(this.validators);
 
   @override
-  void validate(ErrorReporter reporter, YamlMap options) {
+  void validate(DiagnosticReporter reporter, YamlMap options) {
     for (var validator in validators) {
       validator.validate(reporter, options);
     }
@@ -570,7 +570,7 @@
 /// Validates `analyzer` enabled experiments configuration options.
 class _EnabledExperimentsValidator extends OptionsValidator {
   @override
-  void validate(ErrorReporter reporter, YamlMap options) {
+  void validate(DiagnosticReporter reporter, YamlMap options) {
     var analyzer = options.valueAt(AnalysisOptionsFile.analyzer);
     if (analyzer is YamlMap) {
       var experimentNames = analyzer.valueAt(
@@ -643,7 +643,11 @@
   _ErrorBuilder._({required this.proposal, required this.code});
 
   /// Report an unsupported [node] value, defined in the given [scopeName].
-  void reportError(ErrorReporter reporter, String scopeName, YamlNode node) {
+  void reportError(
+    DiagnosticReporter reporter,
+    String scopeName,
+    YamlNode node,
+  ) {
     if (proposal.isNotEmpty) {
       reporter.atSourceSpan(
         node.span,
@@ -689,7 +693,7 @@
           .toSet();
 
   @override
-  void validate(ErrorReporter reporter, YamlMap options) {
+  void validate(DiagnosticReporter reporter, YamlMap options) {
     var analyzer = options.valueAt(AnalysisOptionsFile.analyzer);
     if (analyzer is YamlMap) {
       var filters = analyzer.valueAt(AnalysisOptionsFile.errors);
@@ -743,7 +747,7 @@
 /// Validates `formatter` options.
 class _FormatterOptionsValidator extends OptionsValidator {
   @override
-  void validate(ErrorReporter reporter, YamlMap options) {
+  void validate(DiagnosticReporter reporter, YamlMap options) {
     var formatter = options.valueAt(AnalysisOptionsFile.formatter);
     if (formatter == null) {
       return;
@@ -776,7 +780,7 @@
   void _validatePageWidth(
     YamlNode keyNode,
     YamlNode valueNode,
-    ErrorReporter reporter,
+    DiagnosticReporter reporter,
   ) {
     var value = valueNode.value;
     if (value is! int || value <= 0) {
@@ -794,7 +798,7 @@
   void _validateTrailingCommas(
     YamlNode keyNode,
     YamlNode valueNode,
-    ErrorReporter reporter,
+    DiagnosticReporter reporter,
   ) {
     var value = valueNode.value;
 
@@ -818,7 +822,7 @@
   );
 
   @override
-  void validate(ErrorReporter reporter, YamlMap options) {
+  void validate(DiagnosticReporter reporter, YamlMap options) {
     var analyzer = options.valueAt(AnalysisOptionsFile.analyzer);
     if (analyzer is YamlMap) {
       var language = analyzer.valueAt(AnalysisOptionsFile.language);
@@ -879,7 +883,7 @@
   _LegacyPluginsOptionValidator(this._firstIncludedPluginName);
 
   @override
-  void validate(ErrorReporter reporter, YamlMap options) {
+  void validate(DiagnosticReporter reporter, YamlMap options) {
     var analyzer = options.valueAt(AnalysisOptionsFile.analyzer);
     if (analyzer is! YamlMap) {
       return;
@@ -979,7 +983,7 @@
   );
 
   @override
-  void validate(ErrorReporter reporter, YamlMap options) {
+  void validate(DiagnosticReporter reporter, YamlMap options) {
     var analyzer = options.valueAt(AnalysisOptionsFile.analyzer);
     if (analyzer is YamlMap) {
       var v = analyzer.valueAt(AnalysisOptionsFile.optionalChecks);
@@ -1037,7 +1041,7 @@
   );
 
   @override
-  void validate(ErrorReporter reporter, YamlMap options) {
+  void validate(DiagnosticReporter reporter, YamlMap options) {
     var plugins = options.valueAt(AnalysisOptionsFile.plugins);
     switch (plugins) {
       case YamlMap():
@@ -1078,7 +1082,7 @@
   }
 
   void _validatePluginMap(
-    ErrorReporter reporter,
+    DiagnosticReporter reporter,
     String pluginName,
     YamlMap pluginValue,
   ) {
@@ -1106,7 +1110,7 @@
   );
 
   @override
-  void validate(ErrorReporter reporter, YamlMap options) {
+  void validate(DiagnosticReporter reporter, YamlMap options) {
     var analyzer = options.valueAt(AnalysisOptionsFile.analyzer);
     if (analyzer is YamlMap) {
       var strongModeNode = analyzer.valueAt(AnalysisOptionsFile.strongMode);
@@ -1123,7 +1127,7 @@
   }
 
   void _validateStrongModeAsMap(
-    ErrorReporter reporter,
+    DiagnosticReporter reporter,
     YamlMap strongModeNode,
   ) {
     strongModeNode.nodes.forEach((k, v) {
@@ -1184,7 +1188,7 @@
               : AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUES;
 
   @override
-  void validate(ErrorReporter reporter, YamlMap options) {
+  void validate(DiagnosticReporter reporter, YamlMap options) {
     var node = options.valueAt(pluginName);
     if (node is YamlMap) {
       node.nodes.forEach((k, v) {
diff --git a/pkg/analyzer/test/error/error_reporter_test.dart b/pkg/analyzer/test/error/error_reporter_test.dart
index f6518fe..7e34f14 100644
--- a/pkg/analyzer/test/error/error_reporter_test.dart
+++ b/pkg/analyzer/test/error/error_reporter_test.dart
@@ -26,7 +26,7 @@
     await resolveTestCode('class A {}');
     var element = findElement2.class_('A');
     var firstFragment = element.firstFragment;
-    var reporter = ErrorReporter(
+    var reporter = DiagnosticReporter(
       listener,
       firstFragment.libraryFragment.source,
     );
@@ -47,7 +47,7 @@
     var element = findElement2.unnamedExtension();
 
     var firstFragment = element.firstFragment;
-    var reporter = ErrorReporter(
+    var reporter = DiagnosticReporter(
       listener,
       firstFragment.libraryFragment.source,
     );
@@ -88,7 +88,7 @@
           nullabilitySuffix: NullabilitySuffix.none,
         );
 
-    var reporter = ErrorReporter(
+    var reporter = DiagnosticReporter(
       listener,
       firstType.element3.firstFragment.libraryFragment.source,
     );
@@ -130,7 +130,7 @@
           nullabilitySuffix: NullabilitySuffix.none,
         );
 
-    var reporter = ErrorReporter(
+    var reporter = DiagnosticReporter(
       listener,
       firstType.element3.firstFragment.libraryFragment.source,
     );
@@ -162,7 +162,7 @@
     var fb = findNode.topLevelVariableDeclaration('fb');
 
     var source = result.unit.declaredFragment!.source;
-    var reporter = ErrorReporter(listener, source);
+    var reporter = DiagnosticReporter(listener, source);
     reporter.atNode(
       findNode.simple('x'),
       CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
@@ -193,7 +193,7 @@
     var bb = findNode.topLevelVariableDeclaration('bb');
 
     var source = result.unit.declaredFragment!.source;
-    var reporter = ErrorReporter(listener, source);
+    var reporter = DiagnosticReporter(listener, source);
     reporter.atNode(
       findNode.simple('x'),
       CompileTimeErrorCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
@@ -207,7 +207,7 @@
 
   test_atSourceSpan() async {
     var source = TestSource();
-    var reporter = ErrorReporter(listener, source);
+    var reporter = DiagnosticReporter(listener, source);
 
     var text = '''
 foo: bar
@@ -235,7 +235,7 @@
 
   test_creation() async {
     var source = TestSource();
-    var reporter = ErrorReporter(listener, source);
+    var reporter = DiagnosticReporter(listener, source);
     expect(reporter, isNotNull);
   }
 }
diff --git a/pkg/analyzer/test/generated/parser_test_base.dart b/pkg/analyzer/test/generated/parser_test_base.dart
index d78e1a7..8d3e234 100644
--- a/pkg/analyzer/test/generated/parser_test_base.dart
+++ b/pkg/analyzer/test/generated/parser_test_base.dart
@@ -456,9 +456,12 @@
     _fastaTokens = result.tokens;
 
     // Run parser
-    ErrorReporter errorReporter = ErrorReporter(listener, source);
+    DiagnosticReporter diagnosticReporter = DiagnosticReporter(
+      listener,
+      source,
+    );
     AstBuilder astBuilder = AstBuilder(
-      errorReporter,
+      diagnosticReporter,
       source.uri,
       true,
       featureSet!,
diff --git a/pkg/analyzer/test/src/dart/constant/evaluation_test.dart b/pkg/analyzer/test/src/dart/constant/evaluation_test.dart
index 8ea054b..cfd60a3 100644
--- a/pkg/analyzer/test/src/dart/constant/evaluation_test.dart
+++ b/pkg/analyzer/test/src/dart/constant/evaluation_test.dart
@@ -5382,14 +5382,14 @@
     var unit = this.result.unit;
     var source = unit.declaredFragment!.source;
     var errorListener = GatheringDiagnosticListener();
-    var errorReporter = ErrorReporter(errorListener, source);
+    var diagnosticReporter = DiagnosticReporter(errorListener, source);
     var constantVisitor = ConstantVisitor(
       ConstantEvaluationEngine(
         declaredVariables: DeclaredVariables.fromMap(declaredVariables),
         configuration: ConstantEvaluationConfiguration(),
       ),
       this.result.libraryElement2,
-      errorReporter,
+      diagnosticReporter,
       lexicalEnvironment: lexicalEnvironment,
     );
 
diff --git a/pkg/analyzer/test/src/dart/element/generic_inferrer_test.dart b/pkg/analyzer/test/src/dart/element/generic_inferrer_test.dart
index a63ae4f..85524f0 100644
--- a/pkg/analyzer/test/src/dart/element/generic_inferrer_test.dart
+++ b/pkg/analyzer/test/src/dart/element/generic_inferrer_test.dart
@@ -574,7 +574,7 @@
   }) {
     var listener = RecordingDiagnosticListener();
 
-    var reporter = ErrorReporter(
+    var reporter = DiagnosticReporter(
       listener,
       NonExistingSource('/test.dart', toUri('/test.dart')),
     );
@@ -583,7 +583,7 @@
       typeParameters: ft.typeParameters,
       declaredReturnType: ft.returnType,
       contextReturnType: returnType,
-      errorReporter: reporter,
+      diagnosticReporter: reporter,
       errorEntity: NullLiteralImpl(literal: KeywordToken(Keyword.NULL, 0)),
       genericMetadataIsEnabled: true,
       inferenceUsingBoundsIsEnabled: true,
diff --git a/pkg/analyzer/test/src/lint/lint_rule_test.dart b/pkg/analyzer/test/src/lint/lint_rule_test.dart
index 7dab5b9..39a9b64 100644
--- a/pkg/analyzer/test/src/lint/lint_rule_test.dart
+++ b/pkg/analyzer/test/src/lint/lint_rule_test.dart
@@ -78,7 +78,7 @@
   });
 }
 
-class CollectingReporter extends ErrorReporter {
+class CollectingReporter extends DiagnosticReporter {
   DiagnosticCode? code;
 
   CollectingReporter(super.listener, super.source);
diff --git a/pkg/analyzer/test/src/lint/linter/linter_context_impl_test.dart b/pkg/analyzer/test/src/lint/linter/linter_context_impl_test.dart
index 2dfd57f..220f90d 100644
--- a/pkg/analyzer/test/src/lint/linter/linter_context_impl_test.dart
+++ b/pkg/analyzer/test/src/lint/linter/linter_context_impl_test.dart
@@ -29,14 +29,14 @@
 
   Future<void> resolve(String content) async {
     await resolveTestCode(content);
-    var errorReporter = ErrorReporter(
+    var diagnosticReporter = DiagnosticReporter(
       RecordingDiagnosticListener(),
       StringSource(result.content, null),
     );
     var contextUnit = RuleContextUnit(
       file: result.file,
       content: result.content,
-      errorReporter: errorReporter,
+      diagnosticReporter: diagnosticReporter,
       unit: result.unit,
     );
 
diff --git a/pkg/analyzer/test/src/options/options_rule_validator_test.dart b/pkg/analyzer/test/src/options/options_rule_validator_test.dart
index eeba763..861a69c 100644
--- a/pkg/analyzer/test/src/options/options_rule_validator_test.dart
+++ b/pkg/analyzer/test/src/options/options_rule_validator_test.dart
@@ -272,7 +272,7 @@
     VersionConstraint? sdk,
   }) {
     GatheringDiagnosticListener listener = GatheringDiagnosticListener();
-    ErrorReporter reporter = ErrorReporter(
+    DiagnosticReporter reporter = DiagnosticReporter(
       listener,
       StringSource(content, 'analysis_options.yaml'),
     );
diff --git a/pkg/analyzer_testing/lib/analysis_rule/analysis_rule.dart b/pkg/analyzer_testing/lib/analysis_rule/analysis_rule.dart
index 5f111dd..ca278f4 100644
--- a/pkg/analyzer_testing/lib/analysis_rule/analysis_rule.dart
+++ b/pkg/analyzer_testing/lib/analysis_rule/analysis_rule.dart
@@ -105,7 +105,7 @@
     );
     var listener = RecordingDiagnosticListener();
     var file = resourceProvider.getFile(path);
-    var reporter = ErrorReporter(listener, FileSource(file, sourceUri));
+    var reporter = DiagnosticReporter(listener, FileSource(file, sourceUri));
     for (var entry in pubspecRules.entries) {
       entry.key.reporter = reporter;
       pubspecAst.accept(entry.value);
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index fe211a7..2b9dd46 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -5983,9 +5983,6 @@
       'JS_EMBEDDED_GLOBAL',
       'second ',
     )!;
-    js.Template expr = js.js.expressionTemplateYielding(
-      _emitter.generateEmbeddedGlobalAccess(globalName),
-    );
 
     NativeBehavior nativeBehavior = _elementMap
         .getNativeBehaviorForJsEmbeddedGlobalCall(invocation);
@@ -5995,12 +5992,8 @@
       closedWorld,
     );
     push(
-      HForeignCode(
-        expr,
-        ssaType,
-        const <HInstruction>[],
-        nativeBehavior: nativeBehavior,
-      )..sourceInformation = sourceInformation,
+      HEmbeddedGlobalGet(globalName, nativeBehavior, ssaType)
+        ..sourceInformation = sourceInformation,
     );
   }
 
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index 8a7efbe..519cacf 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -2781,6 +2781,11 @@
   }
 
   @override
+  void visitEmbeddedGlobalGet(HEmbeddedGlobalGet node) {
+    push(_emitter.generateEmbeddedGlobalAccess(node.name));
+  }
+
+  @override
   void visitCreate(HCreate node) {
     js.Expression jsClassReference = _emitter.constructorAccess(node.element);
     List<js.Expression> arguments = visitArguments(node.inputs, start: 0);
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index e4d4a10..6e998ef 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -53,6 +53,7 @@
   R visitCreate(HCreate node);
   R visitCreateBox(HCreateBox node);
   R visitDivide(HDivide node);
+  R visitEmbeddedGlobalGet(HEmbeddedGlobalGet node);
   R visitExit(HExit node);
   R visitExitTry(HExitTry node);
   R visitFieldGet(HFieldGet node);
@@ -504,6 +505,8 @@
   @override
   R visitDivide(HDivide node) => visitBinaryArithmetic(node);
   @override
+  R visitEmbeddedGlobalGet(HEmbeddedGlobalGet node) => visitInstruction(node);
+  @override
   R visitExit(HExit node) => visitControlFlow(node);
   @override
   R visitExitTry(HExitTry node) => visitControlFlow(node);
@@ -1137,6 +1140,7 @@
   charCodeAt,
   arrayFlagsGet,
   arrayFlagsCheck,
+  embeddedGlobal,
 }
 
 abstract class HInstruction implements SpannableWithEntity {
@@ -5114,3 +5118,41 @@
   @override
   String toString() => 'HIsLateSentinel()';
 }
+
+/// Reads an 'embedded global' to access some kind of metadata or value produced
+/// by the compiler.
+///
+/// This instruction corresponds to the `JS_EMBEDDED_GLOBAL` top level method in
+/// `foreign_helper.dart`.  The [name] should be a constant defined in the
+/// `_embedded_names` or `_js_shared_embedded_names` library.
+class HEmbeddedGlobalGet extends HInstruction {
+  final String name;
+
+  factory HEmbeddedGlobalGet(
+    String name,
+    NativeBehavior nativeBehavior,
+    AbstractValue type,
+  ) {
+    final node = HEmbeddedGlobalGet._(name, type);
+    node.sideEffects.add(nativeBehavior.sideEffects);
+    if (nativeBehavior.useGvn) node.setUseGvn();
+    return node;
+  }
+
+  HEmbeddedGlobalGet._(this.name, super.type) : super._noInput();
+
+  @override
+  R accept<R>(HVisitor<R> visitor) => visitor.visitEmbeddedGlobalGet(this);
+
+  @override
+  _GvnType get _gvnType => _GvnType.embeddedGlobal;
+
+  @override
+  bool typeEquals(HInstruction other) => other is HEmbeddedGlobalGet;
+
+  @override
+  bool dataEquals(HEmbeddedGlobalGet other) => name == other.name;
+
+  @override
+  String toString() => 'HEmbeddedGlobalGet($name)';
+}
diff --git a/pkg/compiler/lib/src/ssa/tracer.dart b/pkg/compiler/lib/src/ssa/tracer.dart
index f4df682..1a10da2 100644
--- a/pkg/compiler/lib/src/ssa/tracer.dart
+++ b/pkg/compiler/lib/src/ssa/tracer.dart
@@ -298,6 +298,11 @@
   String visitDivide(HDivide node) => handleInvokeBinary(node, 'Divide');
 
   @override
+  String visitEmbeddedGlobalGet(HEmbeddedGlobalGet node) {
+    return 'EmbeddedGlobalGet: "${node.name}"';
+  }
+
+  @override
   String visitExit(HExit node) => "Exit";
 
   @override
diff --git a/pkg/dart2bytecode/lib/bytecode_generator.dart b/pkg/dart2bytecode/lib/bytecode_generator.dart
index e6265e7..41fff25 100644
--- a/pkg/dart2bytecode/lib/bytecode_generator.dart
+++ b/pkg/dart2bytecode/lib/bytecode_generator.dart
@@ -649,7 +649,13 @@
     int endPosition = TreeNode.noOffset;
     if (options.emitSourcePositions && member.fileOffset != TreeNode.noOffset) {
       flags |= FunctionDeclaration.hasSourcePositionsFlag;
-      position = (member as dynamic).startFileOffset;
+      if (member is Constructor) {
+        position = member.startFileOffset;
+      } else if (member is Procedure) {
+        position = member.fileStartOffset;
+      } else {
+        throw 'Unexpected ${member.runtimeType} $member';
+      }
       endPosition = member.fileEndOffset;
     }
     final Annotations annotations = getFunctionAnnotations(member);
diff --git a/pkg/linter/lib/src/rules/use_late_for_private_fields_and_variables.dart b/pkg/linter/lib/src/rules/use_late_for_private_fields_and_variables.dart
index c0c37fd..f532c2e 100644
--- a/pkg/linter/lib/src/rules/use_late_for_private_fields_and_variables.dart
+++ b/pkg/linter/lib/src/rules/use_late_for_private_fields_and_variables.dart
@@ -71,7 +71,7 @@
             (u) => u.unit.declaredFragment == libraryFragment,
           );
           if (contextUnit == null) continue;
-          contextUnit.errorReporter.atNode(variable, rule.diagnosticCode);
+          contextUnit.diagnosticReporter.atNode(variable, rule.diagnosticCode);
         }
       }
     }
diff --git a/pkg/linter/lib/src/test_utilities/test_linter.dart b/pkg/linter/lib/src/test_utilities/test_linter.dart
index 7670dd3..061275f 100644
--- a/pkg/linter/lib/src/test_utilities/test_linter.dart
+++ b/pkg/linter/lib/src/test_utilities/test_linter.dart
@@ -65,7 +65,7 @@
         // processing gets pushed down, this hack can go away.)
         if (sourceUrl != null) {
           var source = _createSource(sourceUrl);
-          rule.reporter = ErrorReporter(this, source);
+          rule.reporter = DiagnosticReporter(this, source);
         }
         try {
           spec.accept(visitor);
diff --git a/pkg/test_runner/lib/src/compiler_configuration.dart b/pkg/test_runner/lib/src/compiler_configuration.dart
index 7931c5d..24e0bb3 100644
--- a/pkg/test_runner/lib/src/compiler_configuration.dart
+++ b/pkg/test_runner/lib/src/compiler_configuration.dart
@@ -1615,6 +1615,7 @@
           arguments.contains('--enable-asserts') ||
           arguments.contains('--enable_asserts'))
         '--enable-asserts',
+      if (!isProductMode) '--bytecode-options=source-positions',
     ];
 
     return CompilationCommand(
diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
index 00b22c1..02031f3 100644
--- a/runtime/platform/globals.h
+++ b/runtime/platform/globals.h
@@ -731,24 +731,6 @@
 // Undefine math.h definition which clashes with our condition names.
 #undef OVERFLOW
 
-// Include IL printer and disassembler functionality into non-PRODUCT builds,
-// in all AOT compiler builds or when forced.
-#if !defined(PRODUCT) || defined(DART_PRECOMPILER) ||                          \
-    defined(FORCE_INCLUDE_DISASSEMBLER)
-#if defined(DART_PRECOMPILED_RUNTIME) && defined(PRODUCT)
-#error Requested to include IL printer into PRODUCT AOT runtime
-#endif
-#define INCLUDE_IL_PRINTER 1
-#if !defined(FORCE_INCLUDE_DISASSEMBLER)
-#define FORCE_INCLUDE_DISASSEMBLER 1
-#endif
-#endif
-
-// Include HeapSnapshotWriter functionality if not in PRODUCT.
-#if !defined(DART_ENABLE_HEAP_SNAPSHOT_WRITER) && !defined(PRODUCT)
-#define DART_ENABLE_HEAP_SNAPSHOT_WRITER 1
-#endif
-
 #if defined(DART_HOST_OS_ANDROID)
 #define kHostOperatingSystemName "android"
 #elif defined(DART_HOST_OS_FUCHSIA)
diff --git a/runtime/vm/bytecode_reader.cc b/runtime/vm/bytecode_reader.cc
index 4512959..648b33d 100644
--- a/runtime/vm/bytecode_reader.cc
+++ b/runtime/vm/bytecode_reader.cc
@@ -1041,7 +1041,10 @@
     }
     case kScript: {
       const String& uri = String::CheckedHandle(Z, ReadObject());
-      RELEASE_ASSERT((flags & kFlagHasSourceFile) == 0);
+      if ((flags & kFlagHasSourceFile) != 0) {
+        return ReadSourceFile(uri, bytecode_component_->GetSourceFilesOffset() +
+                                       reader_.ReadUInt());
+      }
       return Script::New(uri, Object::null_string());
     }
     case kType: {
@@ -1466,6 +1469,72 @@
   }
 }
 
+TypedDataPtr BytecodeReaderHelper::ReadLineStartsData(
+    intptr_t line_starts_offset) {
+  AlternativeReadingScope alt(&reader_, line_starts_offset);
+
+  const intptr_t num_line_starts = reader_.ReadUInt();
+
+  // Choose representation between Uint16 and Uint32 typed data.
+  intptr_t max_start = 0;
+  {
+    AlternativeReadingScope alt2(&reader_, reader_.offset());
+    for (intptr_t i = 0; i < num_line_starts; ++i) {
+      const intptr_t delta = reader_.ReadUInt();
+      max_start += delta;
+    }
+  }
+
+  const intptr_t cid = (max_start <= kMaxUint16) ? kTypedDataUint16ArrayCid
+                                                 : kTypedDataUint32ArrayCid;
+  const TypedData& line_starts_data =
+      TypedData::Handle(Z, TypedData::New(cid, num_line_starts, Heap::kOld));
+
+  intptr_t current_start = 0;
+  for (intptr_t i = 0; i < num_line_starts; ++i) {
+    const intptr_t delta = reader_.ReadUInt();
+    current_start += delta;
+    if (cid == kTypedDataUint16ArrayCid) {
+      line_starts_data.SetUint16(i << 1, static_cast<uint16_t>(current_start));
+    } else {
+      line_starts_data.SetUint32(i << 2, current_start);
+    }
+  }
+
+  return line_starts_data.ptr();
+}
+
+ScriptPtr BytecodeReaderHelper::ReadSourceFile(const String& uri,
+                                               intptr_t offset) {
+  // SourceFile flags, must be in sync with SourceFile constants in
+  // pkg/dart2bytecode/lib/declarations.dart.
+  const int kHasLineStartsFlag = 1 << 0;
+  const int kHasSourceFlag = 1 << 1;
+
+  AlternativeReadingScope alt(&reader_, offset);
+
+  const intptr_t flags = reader_.ReadUInt();
+  const String& import_uri = String::CheckedHandle(Z, ReadObject());
+
+  TypedData& line_starts = TypedData::Handle(Z);
+  if ((flags & kHasLineStartsFlag) != 0) {
+    const intptr_t line_starts_offset =
+        bytecode_component_->GetLineStartsOffset() + reader_.ReadUInt();
+    line_starts = ReadLineStartsData(line_starts_offset);
+  }
+
+  String& source = String::Handle(Z);
+  if ((flags & kHasSourceFlag) != 0) {
+    source = ReadString(/* is_canonical = */ false);
+  }
+
+  const Script& script =
+      Script::Handle(Z, Script::New(import_uri, uri, source));
+  script.set_line_starts(line_starts);
+
+  return script.ptr();
+}
+
 TypeArgumentsPtr BytecodeReaderHelper::ReadTypeArguments() {
   const intptr_t length = reader_.ReadUInt();
   TypeArguments& type_arguments =
diff --git a/runtime/vm/bytecode_reader.h b/runtime/vm/bytecode_reader.h
index 55ddd40..4b11be3 100644
--- a/runtime/vm/bytecode_reader.h
+++ b/runtime/vm/bytecode_reader.h
@@ -346,6 +346,8 @@
   ObjectPtr ReadConstObject(intptr_t tag);
   ObjectPtr ReadType(intptr_t tag, Nullability nullability);
   StringPtr ReadString(bool is_canonical = true);
+  TypedDataPtr ReadLineStartsData(intptr_t line_starts_offset);
+  ScriptPtr ReadSourceFile(const String& uri, intptr_t offset);
   TypeArgumentsPtr ReadTypeArguments();
   void SetupFieldAccessorFunction(const Class& klass,
                                   const Function& function,
diff --git a/runtime/vm/compiler/api/print_filter.cc b/runtime/vm/compiler/api/print_filter.cc
index a028479..010cae6 100644
--- a/runtime/vm/compiler/api/print_filter.cc
+++ b/runtime/vm/compiler/api/print_filter.cc
@@ -1,7 +1,7 @@
 // Copyright (c) 2020, 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.
-#include "platform/globals.h"  // For INCLUDE_IL_PRINTER
+#include "vm/globals.h"  // For INCLUDE_IL_PRINTER
 #if defined(INCLUDE_IL_PRINTER)
 
 #include "vm/compiler/api/print_filter.h"
diff --git a/runtime/vm/compiler/api/print_filter.h b/runtime/vm/compiler/api/print_filter.h
index 95d7a39..9dac1fc 100644
--- a/runtime/vm/compiler/api/print_filter.h
+++ b/runtime/vm/compiler/api/print_filter.h
@@ -5,7 +5,7 @@
 #ifndef RUNTIME_VM_COMPILER_API_PRINT_FILTER_H_
 #define RUNTIME_VM_COMPILER_API_PRINT_FILTER_H_
 
-#include "platform/globals.h"  // For INCLUDE_IL_PRINTER
+#include "vm/globals.h"  // For INCLUDE_IL_PRINTER
 
 #if defined(INCLUDE_IL_PRINTER)
 
diff --git a/runtime/vm/compiler/backend/il_printer.cc b/runtime/vm/compiler/backend/il_printer.cc
index 5ab60a6..00d271a 100644
--- a/runtime/vm/compiler/backend/il_printer.cc
+++ b/runtime/vm/compiler/backend/il_printer.cc
@@ -12,6 +12,7 @@
 #include "vm/compiler/backend/linearscan.h"
 #include "vm/compiler/backend/range_analysis.h"
 #include "vm/compiler/ffi/native_calling_convention.h"
+#include "vm/globals.h"
 #include "vm/os.h"
 #include "vm/parser.h"
 
diff --git a/runtime/vm/flag_list.h b/runtime/vm/flag_list.h
index bec6e7c..d560266 100644
--- a/runtime/vm/flag_list.h
+++ b/runtime/vm/flag_list.h
@@ -6,6 +6,7 @@
 #define RUNTIME_VM_FLAG_LIST_H_
 
 #include "platform/thread_sanitizer.h"
+#include "vm/globals.h"
 
 // Don't use USING_PRODUCT outside of this file.
 #if defined(PRODUCT)
diff --git a/runtime/vm/globals.h b/runtime/vm/globals.h
index e396f9e..4e392d5 100644
--- a/runtime/vm/globals.h
+++ b/runtime/vm/globals.h
@@ -112,6 +112,24 @@
 #define SUPPORT_TIMELINE 1
 #endif
 
+// Include IL printer and disassembler functionality into non-PRODUCT builds,
+// in all AOT compiler builds or when forced.
+#if !defined(PRODUCT) || defined(DART_PRECOMPILER) ||                          \
+    defined(FORCE_INCLUDE_DISASSEMBLER)
+#if defined(DART_PRECOMPILED_RUNTIME) && defined(PRODUCT)
+#error Requested to include IL printer into PRODUCT AOT runtime
+#endif
+#define INCLUDE_IL_PRINTER 1
+#if !defined(FORCE_INCLUDE_DISASSEMBLER)
+#define FORCE_INCLUDE_DISASSEMBLER 1
+#endif
+#endif
+
+// Include HeapSnapshotWriter functionality if not in PRODUCT.
+#if !defined(DART_ENABLE_HEAP_SNAPSHOT_WRITER) && !defined(PRODUCT)
+#define DART_ENABLE_HEAP_SNAPSHOT_WRITER 1
+#endif
+
 #if defined(ARCH_IS_64_BIT) && !defined(IS_SIMARM_HOST64)
 #define HASH_IN_OBJECT_HEADER 1
 #endif
diff --git a/runtime/vm/kernel.cc b/runtime/vm/kernel.cc
index 2e53b0e..1fccedf 100644
--- a/runtime/vm/kernel.cc
+++ b/runtime/vm/kernel.cc
@@ -18,87 +18,6 @@
 namespace dart {
 namespace kernel {
 
-KernelLineStartsReader::KernelLineStartsReader(
-    const dart::TypedData& line_starts_data,
-    dart::Zone* zone)
-    : line_starts_data_(line_starts_data) {
-  TypedDataElementType type = line_starts_data_.ElementType();
-  if (type == kUint16ArrayElement) {
-    helper_ = new KernelUint16LineStartsHelper();
-  } else if (type == kUint32ArrayElement) {
-    helper_ = new KernelUint32LineStartsHelper();
-  } else {
-    UNREACHABLE();
-  }
-}
-
-uint32_t KernelLineStartsReader::MaxPosition() const {
-  const intptr_t line_count = line_starts_data_.Length();
-  if (line_count == 0) {
-    return 0;
-  }
-  return helper_->At(line_starts_data_, line_count - 1);
-}
-
-bool KernelLineStartsReader::LocationForPosition(intptr_t position,
-                                                 intptr_t* line,
-                                                 intptr_t* col) const {
-  const intptr_t line_count = line_starts_data_.Length();
-  if (position < 0 || static_cast<uint32_t>(position) > MaxPosition() ||
-      line_count == 0) {
-    return false;
-  }
-
-  intptr_t lo = 0;
-  intptr_t hi = line_count;
-  while (hi > lo + 1) {
-    const intptr_t mid = lo + (hi - lo) / 2;
-    const intptr_t mid_position = helper_->At(line_starts_data_, mid);
-    if (mid_position > position) {
-      hi = mid;
-    } else {
-      lo = mid;
-    }
-  }
-  *line = lo + 1;
-  if (col != nullptr) {
-    *col = position - helper_->At(line_starts_data_, lo) + 1;
-  }
-
-  return true;
-}
-
-bool KernelLineStartsReader::TokenRangeAtLine(
-    intptr_t line_number,
-    TokenPosition* first_token_index,
-    TokenPosition* last_token_index) const {
-  const intptr_t line_count = line_starts_data_.Length();
-  if (line_number <= 0 || line_number > line_count) {
-    return false;
-  }
-  *first_token_index = dart::TokenPosition::Deserialize(
-      helper_->At(line_starts_data_, line_number - 1));
-  if (line_number == line_count) {
-    *last_token_index = *first_token_index;
-  } else {
-    *last_token_index = dart::TokenPosition::Deserialize(
-        helper_->At(line_starts_data_, line_number) - 1);
-  }
-  return true;
-}
-
-uint32_t KernelLineStartsReader::KernelUint16LineStartsHelper::At(
-    const dart::TypedData& data,
-    intptr_t index) const {
-  return data.GetUint16(index << 1);
-}
-
-uint32_t KernelLineStartsReader::KernelUint32LineStartsHelper::At(
-    const dart::TypedData& data,
-    intptr_t index) const {
-  return data.GetUint32(index << 2);
-}
-
 class KernelTokenPositionCollector : public KernelReaderHelper {
  public:
   KernelTokenPositionCollector(
diff --git a/runtime/vm/kernel.h b/runtime/vm/kernel.h
index 0cd02e1..774e2fc 100644
--- a/runtime/vm/kernel.h
+++ b/runtime/vm/kernel.h
@@ -127,70 +127,6 @@
   DISALLOW_COPY_AND_ASSIGN(Program);
 };
 
-class KernelLineStartsReader {
- public:
-  KernelLineStartsReader(const dart::TypedData& line_starts_data,
-                         dart::Zone* zone);
-
-  ~KernelLineStartsReader() { delete helper_; }
-
-  uint32_t At(intptr_t index) const {
-    return helper_->At(line_starts_data_, index);
-  }
-
-  uint32_t MaxPosition() const;
-
-  // Returns whether the given offset corresponds to a valid source offset
-  // If it does, then *line and *column (if column is not nullptr) are set
-  // to the line and column the token starts at.
-  DART_WARN_UNUSED_RESULT bool LocationForPosition(
-      intptr_t position,
-      intptr_t* line,
-      intptr_t* col = nullptr) const;
-
-  // Returns whether any tokens were found for the given line. When found,
-  // *first_token_index and *last_token_index are set to the first and
-  // last token on the line, respectively.
-  DART_WARN_UNUSED_RESULT bool TokenRangeAtLine(
-      intptr_t line_number,
-      dart::TokenPosition* first_token_index,
-      dart::TokenPosition* last_token_index) const;
-
- private:
-  class KernelLineStartsHelper {
-   public:
-    KernelLineStartsHelper() {}
-    virtual ~KernelLineStartsHelper() {}
-    virtual uint32_t At(const dart::TypedData& data, intptr_t index) const = 0;
-
-   private:
-    DISALLOW_COPY_AND_ASSIGN(KernelLineStartsHelper);
-  };
-
-  class KernelUint16LineStartsHelper : public KernelLineStartsHelper {
-   public:
-    KernelUint16LineStartsHelper() {}
-    virtual uint32_t At(const dart::TypedData& data, intptr_t index) const;
-
-   private:
-    DISALLOW_COPY_AND_ASSIGN(KernelUint16LineStartsHelper);
-  };
-
-  class KernelUint32LineStartsHelper : public KernelLineStartsHelper {
-   public:
-    KernelUint32LineStartsHelper() {}
-    virtual uint32_t At(const dart::TypedData& data, intptr_t index) const;
-
-   private:
-    DISALLOW_COPY_AND_ASSIGN(KernelUint32LineStartsHelper);
-  };
-
-  const dart::TypedData& line_starts_data_;
-  KernelLineStartsHelper* helper_;
-
-  DISALLOW_COPY_AND_ASSIGN(KernelLineStartsReader);
-};
-
 ObjectPtr EvaluateStaticConstFieldInitializer(const Field& field);
 ObjectPtr EvaluateMetadata(const Library& library,
                            intptr_t kernel_offset,
diff --git a/runtime/vm/line_starts_reader.cc b/runtime/vm/line_starts_reader.cc
new file mode 100644
index 0000000..3606322
--- /dev/null
+++ b/runtime/vm/line_starts_reader.cc
@@ -0,0 +1,74 @@
+// Copyright (c) 2025, 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.
+
+#if !defined(DART_PRECOMPILED_RUNTIME) || defined(DART_DYNAMIC_MODULES)
+
+#include "vm/line_starts_reader.h"
+#include "vm/object.h"
+#include "vm/token_position.h"
+
+namespace dart {
+
+LineStartsReader::LineStartsReader(const dart::TypedData& line_starts_data)
+    : line_starts_data_(line_starts_data),
+      element_type_(line_starts_data.ElementType()) {
+  RELEASE_ASSERT((element_type_ == kUint16ArrayElement) ||
+                 (element_type_ == kUint32ArrayElement));
+}
+
+uint32_t LineStartsReader::MaxPosition() const {
+  const intptr_t line_count = line_starts_data_.Length();
+  if (line_count == 0) {
+    return 0;
+  }
+  return At(line_count - 1);
+}
+
+bool LineStartsReader::LocationForPosition(intptr_t position,
+                                           intptr_t* line,
+                                           intptr_t* col) const {
+  const intptr_t line_count = line_starts_data_.Length();
+  if (position < 0 || static_cast<uint32_t>(position) > MaxPosition() ||
+      line_count == 0) {
+    return false;
+  }
+
+  intptr_t lo = 0;
+  intptr_t hi = line_count;
+  while (hi > lo + 1) {
+    const intptr_t mid = lo + (hi - lo) / 2;
+    const intptr_t mid_position = At(mid);
+    if (mid_position > position) {
+      hi = mid;
+    } else {
+      lo = mid;
+    }
+  }
+  *line = lo + 1;
+  if (col != nullptr) {
+    *col = position - At(lo) + 1;
+  }
+
+  return true;
+}
+
+bool LineStartsReader::TokenRangeAtLine(intptr_t line_number,
+                                        TokenPosition* first_token_index,
+                                        TokenPosition* last_token_index) const {
+  const intptr_t line_count = line_starts_data_.Length();
+  if (line_number <= 0 || line_number > line_count) {
+    return false;
+  }
+  *first_token_index = TokenPosition::Deserialize(At(line_number - 1));
+  if (line_number == line_count) {
+    *last_token_index = *first_token_index;
+  } else {
+    *last_token_index = TokenPosition::Deserialize(At(line_number) - 1);
+  }
+  return true;
+}
+
+}  // namespace dart
+
+#endif  // !defined(DART_PRECOMPILED_RUNTIME) || defined(DART_DYNAMIC_MODULES)
diff --git a/runtime/vm/line_starts_reader.h b/runtime/vm/line_starts_reader.h
new file mode 100644
index 0000000..ef7828d
--- /dev/null
+++ b/runtime/vm/line_starts_reader.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2025, 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.
+
+#ifndef RUNTIME_VM_LINE_STARTS_READER_H_
+#define RUNTIME_VM_LINE_STARTS_READER_H_
+
+#if !defined(DART_PRECOMPILED_RUNTIME) || defined(DART_DYNAMIC_MODULES)
+
+#include <memory>
+
+#include "platform/assert.h"
+#include "vm/allocation.h"
+#include "vm/globals.h"
+#include "vm/growable_array.h"
+#include "vm/object.h"
+#include "vm/token_position.h"
+
+namespace dart {
+
+class LineStartsReader : public ValueObject {
+ public:
+  explicit LineStartsReader(const TypedData& line_starts_data);
+
+  uint32_t At(intptr_t index) const {
+    if (element_type_ == kUint16ArrayElement) {
+      return line_starts_data_.GetUint16(index << 1);
+    } else {
+      ASSERT(element_type_ == kUint32ArrayElement);
+      return line_starts_data_.GetUint32(index << 2);
+    }
+  }
+
+  uint32_t MaxPosition() const;
+
+  // Returns whether the given offset corresponds to a valid source offset
+  // If it does, then *line and *column (if column is not nullptr) are set
+  // to the line and column the token starts at.
+  DART_WARN_UNUSED_RESULT bool LocationForPosition(
+      intptr_t position,
+      intptr_t* line,
+      intptr_t* col = nullptr) const;
+
+  // Returns whether any tokens were found for the given line. When found,
+  // *first_token_index and *last_token_index are set to the first and
+  // last token on the line, respectively.
+  DART_WARN_UNUSED_RESULT bool TokenRangeAtLine(
+      intptr_t line_number,
+      TokenPosition* first_token_index,
+      TokenPosition* last_token_index) const;
+
+ private:
+  const TypedData& line_starts_data_;
+  const TypedDataElementType element_type_;
+};
+
+}  // namespace dart
+
+#endif  // !defined(DART_PRECOMPILED_RUNTIME) || defined(DART_DYNAMIC_MODULES)
+#endif  // RUNTIME_VM_LINE_STARTS_READER_H_
diff --git a/runtime/vm/kernel_test.cc b/runtime/vm/line_starts_reader_test.cc
similarity index 81%
rename from runtime/vm/kernel_test.cc
rename to runtime/vm/line_starts_reader_test.cc
index a86651b..8510f0a 100644
--- a/runtime/vm/kernel_test.cc
+++ b/runtime/vm/line_starts_reader_test.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2022, the Dart project authors.  Please see the AUTHORS file
+// Copyright (c) 2025, 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.
 
@@ -6,7 +6,7 @@
 
 #include "platform/globals.h"
 
-#include "vm/kernel.h"
+#include "vm/line_starts_reader.h"
 #include "vm/object.h"
 #include "vm/unit_test.h"
 
@@ -27,12 +27,12 @@
   return line_starts_data;
 }
 
-ISOLATE_UNIT_TEST_CASE(KernelLineStartsReader_MaxPosition) {
-  kernel::KernelLineStartsReader reader(CreateLineStartsData(), thread->zone());
+ISOLATE_UNIT_TEST_CASE(LineStartsReader_MaxPosition) {
+  LineStartsReader reader(CreateLineStartsData());
   EXPECT_EQ(33u, reader.MaxPosition());
 }
 
-void ExpectLocationForPosition(const kernel::KernelLineStartsReader& reader,
+void ExpectLocationForPosition(const LineStartsReader& reader,
                                intptr_t position,
                                intptr_t expected_line,
                                intptr_t expected_col) {
@@ -43,8 +43,8 @@
   EXPECT_EQ(expected_col, col);
 }
 
-ISOLATE_UNIT_TEST_CASE(KernelLineStartsReader_LocationForPosition) {
-  kernel::KernelLineStartsReader reader(CreateLineStartsData(), thread->zone());
+ISOLATE_UNIT_TEST_CASE(LineStartsReader_LocationForPosition) {
+  LineStartsReader reader(CreateLineStartsData());
   ExpectLocationForPosition(reader, 0, 1, 1);
   ExpectLocationForPosition(reader, 4, 1, 5);
   ExpectLocationForPosition(reader, 8, 2, 1);
@@ -63,7 +63,7 @@
   EXPECT_EQ(false, reader.LocationForPosition(34, &line, &col));
 }
 
-void ExpectTokenRangeAtLine(const kernel::KernelLineStartsReader& reader,
+void ExpectTokenRangeAtLine(const LineStartsReader& reader,
                             intptr_t line,
                             intptr_t expected_first_token,
                             intptr_t expected_last_token) {
@@ -74,8 +74,8 @@
   EXPECT_EQ(expected_last_token, last_token.Serialize());
 }
 
-ISOLATE_UNIT_TEST_CASE(KernelLineStartsReader_TokenRangeAtLine) {
-  kernel::KernelLineStartsReader reader(CreateLineStartsData(), thread->zone());
+ISOLATE_UNIT_TEST_CASE(LineStartsReader_TokenRangeAtLine) {
+  LineStartsReader reader(CreateLineStartsData());
   ExpectTokenRangeAtLine(reader, 1, 0, 7);
   ExpectTokenRangeAtLine(reader, 2, 8, 11);
   ExpectTokenRangeAtLine(reader, 3, 12, 16);
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 9ba1ade..dfe0799 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -51,6 +51,7 @@
 #include "vm/kernel_binary.h"
 #include "vm/kernel_isolate.h"
 #include "vm/kernel_loader.h"
+#include "vm/line_starts_reader.h"
 #include "vm/log.h"
 #include "vm/native_symbol.h"
 #include "vm/object_graph.h"
@@ -13805,7 +13806,7 @@
   intptr_t token_count = debug_positions_array.Length();
   int token_index = 0;
 
-  kernel::KernelLineStartsReader line_starts_reader(line_starts_data, zone);
+  LineStartsReader line_starts_reader(line_starts_data);
   for (int line_index = 0; line_index < line_count; ++line_index) {
     intptr_t start = line_starts_reader.At(line_index);
     // Output the rest of the tokens if we have no next line.
@@ -13844,10 +13845,10 @@
         UntaggedScript::CachedMaxPositionBitField::decode(
             untag()->flags_and_max_position_));
   }
-  auto const zone = Thread::Current()->zone();
   if (!HasCachedMaxPosition() && line_starts() != TypedData::null()) {
+    auto const zone = Thread::Current()->zone();
     const auto& starts = TypedData::Handle(zone, line_starts());
-    kernel::KernelLineStartsReader reader(starts, zone);
+    LineStartsReader reader(starts);
     const intptr_t max_position = reader.MaxPosition();
     SetCachedMaxPosition(max_position);
     SetHasCachedMaxPosition(true);
@@ -13875,14 +13876,14 @@
 }
 #endif  // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
 
-void Script::set_debug_positions(const Array& value) const {
-  untag()->set_debug_positions(value.ptr());
-}
-
 TypedDataPtr Script::line_starts() const {
   return untag()->line_starts();
 }
 
+void Script::set_line_starts(const TypedData& value) const {
+  untag()->set_line_starts(value.ptr());
+}
+
 ArrayPtr Script::debug_positions() const {
 #if !defined(DART_PRECOMPILED_RUNTIME)
   Array& debug_positions_array = Array::Handle(untag()->debug_positions());
@@ -13894,6 +13895,10 @@
   return untag()->debug_positions();
 }
 
+void Script::set_debug_positions(const Array& value) const {
+  untag()->set_debug_positions(value.ptr());
+}
+
 #if !defined(DART_PRECOMPILED_RUNTIME)
 bool Script::HasCachedMaxPosition() const {
   return UntaggedScript::HasCachedMaxPositionBit::decode(
@@ -13948,7 +13953,7 @@
                               intptr_t* line,
                               intptr_t* column) const {
   ASSERT(line != nullptr);
-#if defined(DART_PRECOMPILED_RUNTIME)
+#if defined(DART_PRECOMPILED_RUNTIME) && !defined(DART_DYNAMIC_MODULES)
   // Scripts in the AOT snapshot do not have a line starts array.
   return false;
 #else
@@ -13957,7 +13962,7 @@
   auto const zone = Thread::Current()->zone();
   const TypedData& line_starts_data = TypedData::Handle(zone, line_starts());
   if (line_starts_data.IsNull()) return false;
-  kernel::KernelLineStartsReader line_starts_reader(line_starts_data, zone);
+  LineStartsReader line_starts_reader(line_starts_data);
   return line_starts_reader.LocationForPosition(token_pos.Pos(), line, column);
 #endif  // defined(DART_PRECOMPILED_RUNTIME)
 }
@@ -13995,7 +14000,7 @@
   if (line_number <= 0) return false;
   Zone* zone = Thread::Current()->zone();
   const TypedData& line_starts_data = TypedData::Handle(zone, line_starts());
-  kernel::KernelLineStartsReader line_starts_reader(line_starts_data, zone);
+  LineStartsReader line_starts_reader(line_starts_data);
   if (!line_starts_reader.TokenRangeAtLine(line_number, first_token_index,
                                            last_token_index)) {
     return false;
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 553e13d..d058cfa 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -5021,6 +5021,7 @@
   }
 
   TypedDataPtr line_starts() const;
+  void set_line_starts(const TypedData& value) const;
 
 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
   TypedDataViewPtr constant_coverage() const;
diff --git a/runtime/vm/vm_sources.gni b/runtime/vm/vm_sources.gni
index 3591de0..3e50c6a 100644
--- a/runtime/vm/vm_sources.gni
+++ b/runtime/vm/vm_sources.gni
@@ -160,6 +160,8 @@
   "kernel_isolate.h",
   "kernel_loader.cc",
   "kernel_loader.h",
+  "line_starts_reader.cc",
+  "line_starts_reader.h",
   "lockers.cc",
   "lockers.h",
   "log.cc",
@@ -413,7 +415,7 @@
   "isolate_reload_test.cc",
   "isolate_test.cc",
   "json_test.cc",
-  "kernel_test.cc",
+  "line_starts_reader_test.cc",
   "log_test.cc",
   "longjump_test.cc",
   "memory_region_test.cc",
diff --git a/tools/VERSION b/tools/VERSION
index 35a56a7..0cd3356 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 3
 MINOR 9
 PATCH 0
-PRERELEASE 217
+PRERELEASE 218
 PRERELEASE_PATCH 0
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 42357b9..e6cb26a 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -1659,6 +1659,7 @@
     },
     {
       "builders": [
+        "vm-linux-debug-arm64",
         "vm-linux-release-arm64"
       ],
       "meta": {
@@ -1684,6 +1685,7 @@
     },
     {
       "builders": [
+        "vm-aot-linux-debug-arm64",
         "vm-aot-linux-release-arm64"
       ],
       "meta": {