Augment. Report CONFLICTING_STATIC_AND_INSTANCE even if static before instance.

Ordering is funny with augmentations.
We visit a library augmentation after the library, but should provide
an illusion of a single class declaration.

Change-Id: Ic77d9e2213806714134e54d86d74a13289c1076b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/dart/element/element.dart b/pkg/analyzer/lib/dart/element/element.dart
index 07b71ed..7de2345 100644
--- a/pkg/analyzer/lib/dart/element/element.dart
+++ b/pkg/analyzer/lib/dart/element/element.dart
@@ -106,6 +106,9 @@
 /// Clients may not extend, implement or mix-in this class.
 abstract class AugmentedExtensionTypeElement
     implements AugmentedInterfaceElement {
+  @override
+  ExtensionTypeElement get declaration;
+
   /// The primary constructor of this extension.
   ConstructorElement get primaryConstructor;
 
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index c2715bf..e54d8a9 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -29,6 +29,7 @@
 import 'package:analyzer/src/error/codes.dart';
 import 'package:analyzer/src/error/constructor_fields_verifier.dart';
 import 'package:analyzer/src/error/dead_code_verifier.dart';
+import 'package:analyzer/src/error/duplicate_definition_verifier.dart';
 import 'package:analyzer/src/error/ignore_validator.dart';
 import 'package:analyzer/src/error/imports_verifier.dart';
 import 'package:analyzer/src/error/inheritance_override.dart';
@@ -292,6 +293,13 @@
       _computeVerifyErrors(unitAnalysis);
     }
 
+    MemberDuplicateDefinitionVerifier.checkLibrary(
+      inheritance: _inheritance,
+      libraryVerificationContext: _libraryVerificationContext,
+      libraryElement: _libraryElement,
+      units: _libraryUnits,
+    );
+
     _libraryVerificationContext.constructorFieldsVerifier.report();
 
     if (_analysisOptions.warning) {
diff --git a/pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart b/pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart
index da22f4c..fd89402 100644
--- a/pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart
+++ b/pkg/analyzer/lib/src/error/duplicate_definition_verifier.dart
@@ -8,26 +8,25 @@
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/dart/analysis/file_state.dart';
+import 'package:analyzer/src/dart/analysis/unit_analysis.dart';
 import 'package:analyzer/src/dart/ast/ast.dart';
 import 'package:analyzer/src/dart/element/element.dart';
 import 'package:analyzer/src/dart/element/extensions.dart';
 import 'package:analyzer/src/dart/element/inheritance_manager3.dart';
 import 'package:analyzer/src/diagnostic/diagnostic_factory.dart';
 import 'package:analyzer/src/error/codes.dart';
+import 'package:analyzer/src/generated/error_verifier.dart';
 
 class DuplicateDefinitionVerifier {
-  final InheritanceManager3 _inheritanceManager;
   final LibraryElement _currentLibrary;
-  final CompilationUnitElementImpl _currentUnit;
   final ErrorReporter _errorReporter;
   final DuplicationDefinitionContext context;
 
   final DiagnosticFactory _diagnosticFactory = DiagnosticFactory();
 
   DuplicateDefinitionVerifier(
-    this._inheritanceManager,
     this._currentLibrary,
-    this._currentUnit,
     this._errorReporter,
     this.context,
   );
@@ -52,157 +51,6 @@
     }
   }
 
-  void checkClass(ClassDeclaration node) {
-    _checkClassMembers(node.declaredElement!, node.members);
-  }
-
-  /// Check that there are no members with the same name.
-  void checkEnum(EnumDeclaration node) {
-    var fragment = node.declaredElement!;
-    var declarationElement = fragment.augmented.declaration;
-    var declarationName = declarationElement.name;
-
-    var elementContext = _getElementContext(declarationElement);
-    var staticGetters = elementContext.staticGetters;
-
-    for (EnumConstantDeclaration constant in node.constants) {
-      if (constant.name.lexeme == declarationName) {
-        _errorReporter.atToken(
-          constant.name,
-          CompileTimeErrorCode.ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING,
-        );
-      }
-      _checkDuplicateIdentifier(staticGetters, constant.name,
-          element: constant.declaredElement!);
-      _checkValuesDeclarationInEnum(constant.name);
-    }
-
-    _checkClassMembers(fragment, node.members);
-
-    if (declarationName == 'values') {
-      _errorReporter.atToken(
-        node.name,
-        CompileTimeErrorCode.ENUM_WITH_NAME_VALUES,
-      );
-    }
-
-    for (var accessor in fragment.accessors) {
-      var baseName = accessor.displayName;
-      if (accessor.isStatic) {
-        var instance = _getInterfaceMember(declarationElement, baseName);
-        if (instance != null && baseName != 'values') {
-          _errorReporter.atElement(
-            accessor,
-            CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE,
-            arguments: [declarationName, baseName, declarationName],
-          );
-        }
-      } else {
-        var inherited = _getInheritedMember(declarationElement, baseName);
-        if (inherited is MethodElement) {
-          _errorReporter.atElement(
-            accessor,
-            CompileTimeErrorCode.CONFLICTING_FIELD_AND_METHOD,
-            arguments: [
-              declarationElement.displayName,
-              baseName,
-              inherited.enclosingElement.displayName,
-            ],
-          );
-        }
-      }
-    }
-
-    for (var method in fragment.methods) {
-      if (method.source != _currentUnit.source) {
-        continue;
-      }
-      var baseName = method.displayName;
-      if (method.isStatic) {
-        var instance = _getInterfaceMember(declarationElement, baseName);
-        if (instance != null) {
-          _errorReporter.atElement(
-            method,
-            CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE,
-            arguments: [declarationName, baseName, declarationName],
-          );
-        }
-      } else {
-        var inherited = _getInheritedMember(declarationElement, baseName);
-        if (inherited is PropertyAccessorElement) {
-          _errorReporter.atElement(
-            method,
-            CompileTimeErrorCode.CONFLICTING_METHOD_AND_FIELD,
-            arguments: [
-              declarationElement.displayName,
-              baseName,
-              inherited.enclosingElement.displayName,
-            ],
-          );
-        }
-      }
-    }
-  }
-
-  /// Check that there are no members with the same name.
-  void checkExtension(ExtensionDeclaration node) {
-    var fragment = node.declaredElement!;
-    var declarationElement = fragment.augmented.declaration;
-
-    var elementContext = _getElementContext(declarationElement);
-    var instanceGetters = elementContext.instanceGetters;
-    var instanceSetters = elementContext.instanceSetters;
-
-    _checkClassMembers(fragment, node.members);
-
-    // Check for local static members conflicting with local instance members.
-    for (var member in node.members) {
-      if (member is FieldDeclaration) {
-        if (member.isStatic) {
-          for (var field in member.fields.variables) {
-            var identifier = field.name;
-            var name = identifier.lexeme;
-            if (instanceGetters.containsKey(name) ||
-                instanceSetters.containsKey(name)) {
-              _errorReporter.atToken(
-                identifier,
-                CompileTimeErrorCode.EXTENSION_CONFLICTING_STATIC_AND_INSTANCE,
-                arguments: [name],
-              );
-            }
-          }
-        }
-      } else if (member is MethodDeclaration) {
-        if (member.isStatic) {
-          var identifier = member.name;
-          var name = identifier.lexeme;
-          if (instanceGetters.containsKey(name) ||
-              instanceSetters.containsKey(name)) {
-            _errorReporter.atToken(
-              identifier,
-              CompileTimeErrorCode.EXTENSION_CONFLICTING_STATIC_AND_INSTANCE,
-              arguments: [name],
-            );
-          }
-        }
-      }
-    }
-  }
-
-  void checkExtensionType(
-    ExtensionTypeDeclaration node,
-    ExtensionTypeElement element,
-  ) {
-    var declarationElement = element.augmented.declaration;
-    var primaryConstructorName = element.constructors.first.name;
-    var representationGetter = element.representation.getter!;
-    _getElementContext(declarationElement)
-      ..constructorNames.add(primaryConstructorName)
-      ..instanceGetters[representationGetter.name] = representationGetter;
-
-    _checkClassMembers(element, node.members);
-  }
-
   /// Check that the given list of variable declarations does not define
   /// multiple variables of the same name.
   void checkForVariables(VariableDeclarationList node) {
@@ -213,10 +61,6 @@
     }
   }
 
-  void checkMixin(MixinDeclaration node) {
-    _checkClassMembers(node.declaredElement!, node.members);
-  }
-
   /// Check that all of the parameters have unique names.
   void checkParameters(FormalParameterList node) {
     Map<String, Element> definedNames = HashMap<String, Element>();
@@ -332,6 +176,120 @@
     }
   }
 
+  /// Check whether the given [element] defined by the [identifier] is already
+  /// in one of the scopes - [getterScope] or [setterScope], and produce an
+  /// error if it is.
+  void _checkDuplicateIdentifier(
+      Map<String, Element> getterScope, Token identifier,
+      {required Element element, Map<String, Element>? setterScope}) {
+    if (identifier.isSynthetic || element.isWildcardVariable) {
+      return;
+    }
+
+    switch (element) {
+      case ExecutableElement _:
+        if (element.isAugmentation) return;
+      case FieldElement _:
+        if (element.isAugmentation) return;
+      case InstanceElement _:
+        if (element.isAugmentation) return;
+      case TypeAliasElement _:
+        if (element.isAugmentation) return;
+      case TopLevelVariableElement _:
+        if (element.isAugmentation) return;
+    }
+
+    // Fields define getters and setters, so check them separately.
+    if (element is PropertyInducingElement) {
+      _checkDuplicateIdentifier(getterScope, identifier,
+          element: element.getter!, setterScope: setterScope);
+      if (!element.isConst && !element.isFinal) {
+        _checkDuplicateIdentifier(getterScope, identifier,
+            element: element.setter!, setterScope: setterScope);
+      }
+      return;
+    }
+
+    ErrorCode getError(Element previous, Element current) {
+      if (previous is FieldFormalParameterElement &&
+          current is FieldFormalParameterElement) {
+        return CompileTimeErrorCode.DUPLICATE_FIELD_FORMAL_PARAMETER;
+      } else if (previous is PrefixElement) {
+        return CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER;
+      }
+      return CompileTimeErrorCode.DUPLICATE_DEFINITION;
+    }
+
+    var name = identifier.lexeme;
+    if (element is MethodElement) {
+      name = element.name;
+    }
+
+    var previous = getterScope[name];
+    if (previous != null) {
+      if (!_isGetterSetterPair(element, previous)) {
+        _errorReporter.reportError(_diagnosticFactory.duplicateDefinition(
+          getError(previous, element),
+          element,
+          previous,
+          [name],
+        ));
+      }
+    } else {
+      getterScope[name] = element;
+    }
+
+    if (setterScope != null) {
+      if (element is PropertyAccessorElement && element.isSetter) {
+        previous = setterScope[name];
+        if (previous != null) {
+          _errorReporter.reportError(_diagnosticFactory.duplicateDefinition(
+            getError(previous, element),
+            element,
+            previous,
+            [name],
+          ));
+        } else {
+          setterScope[name] = element;
+        }
+      }
+    }
+  }
+
+  static bool _isGetterSetterPair(Element a, Element b) {
+    if (a is PropertyAccessorElement && b is PropertyAccessorElement) {
+      return a.isGetter && b.isSetter || a.isSetter && b.isGetter;
+    }
+    return false;
+  }
+}
+
+/// Information to pass from declarations to augmentations.
+class DuplicationDefinitionContext {
+  final Map<InstanceElement, _InstanceElementContext> _instanceElementContexts =
+      {};
+}
+
+class MemberDuplicateDefinitionVerifier {
+  final InheritanceManager3 _inheritanceManager;
+  final LibraryElement _currentLibrary;
+  final CompilationUnitElementImpl _currentUnit;
+  final ErrorReporter _errorReporter;
+  final DuplicationDefinitionContext context;
+  final DiagnosticFactory _diagnosticFactory = DiagnosticFactory();
+
+  MemberDuplicateDefinitionVerifier._(
+    this._inheritanceManager,
+    this._currentLibrary,
+    this._currentUnit,
+    this._errorReporter,
+    this.context,
+  );
+
+  void _checkClass(ClassDeclaration node) {
+    _checkClassMembers(node.declaredElement!, node.members);
+  }
+
   /// Check that there are no members with the same name.
   void _checkClassMembers(
     InstanceElement fragment,
@@ -405,6 +363,17 @@
         staticSetters: staticSetters,
       );
     }
+  }
+
+  void _checkClassStatic(
+    InstanceElement fragment,
+    List<ClassMember> members,
+  ) {
+    var declarationElement = fragment.augmented.declaration;
+
+    var elementContext = _getElementContext(declarationElement);
+    var instanceGetters = elementContext.instanceGetters;
+    var instanceSetters = elementContext.instanceSetters;
 
     // Check for local static members conflicting with local instance members.
     // TODO(scheglov): This code is duplicated for enums. But for classes it is
@@ -563,6 +532,233 @@
     }
   }
 
+  /// Check that there are no members with the same name.
+  void _checkEnum(EnumDeclaration node) {
+    var fragment = node.declaredElement!;
+    var declarationElement = fragment.augmented.declaration;
+    var declarationName = declarationElement.name;
+
+    var elementContext = _getElementContext(declarationElement);
+    var staticGetters = elementContext.staticGetters;
+
+    for (EnumConstantDeclaration constant in node.constants) {
+      if (constant.name.lexeme == declarationName) {
+        _errorReporter.atToken(
+          constant.name,
+          CompileTimeErrorCode.ENUM_CONSTANT_SAME_NAME_AS_ENCLOSING,
+        );
+      }
+      _checkDuplicateIdentifier(staticGetters, constant.name,
+          element: constant.declaredElement!);
+      _checkValuesDeclarationInEnum(constant.name);
+    }
+
+    _checkClassMembers(fragment, node.members);
+
+    if (declarationName == 'values') {
+      _errorReporter.atToken(
+        node.name,
+        CompileTimeErrorCode.ENUM_WITH_NAME_VALUES,
+      );
+    }
+
+    for (var accessor in fragment.accessors) {
+      if (accessor.isStatic) {
+        continue;
+      }
+      if (accessor.source != _currentUnit.source) {
+        continue;
+      }
+      var baseName = accessor.displayName;
+      var inherited = _getInheritedMember(declarationElement, baseName);
+      if (inherited is MethodElement) {
+        _errorReporter.atElement(
+          accessor,
+          CompileTimeErrorCode.CONFLICTING_FIELD_AND_METHOD,
+          arguments: [
+            declarationElement.displayName,
+            baseName,
+            inherited.enclosingElement.displayName,
+          ],
+        );
+      }
+    }
+
+    for (var method in fragment.methods) {
+      if (method.isStatic) {
+        continue;
+      }
+      if (method.source != _currentUnit.source) {
+        continue;
+      }
+      var baseName = method.displayName;
+      var inherited = _getInheritedMember(declarationElement, baseName);
+      if (inherited is PropertyAccessorElement) {
+        _errorReporter.atElement(
+          method,
+          CompileTimeErrorCode.CONFLICTING_METHOD_AND_FIELD,
+          arguments: [
+            declarationElement.displayName,
+            baseName,
+            inherited.enclosingElement.displayName,
+          ],
+        );
+      }
+    }
+  }
+
+  void _checkEnumStatic(EnumDeclarationImpl node) {
+    var fragment = node.declaredElement!;
+    var declarationElement = fragment.augmented.declaration;
+    var declarationName = declarationElement.name;
+
+    for (var accessor in fragment.accessors) {
+      if (accessor.source != _currentUnit.source) {
+        continue;
+      }
+      var baseName = accessor.displayName;
+      if (accessor.isStatic) {
+        var instance = _getInterfaceMember(declarationElement, baseName);
+        if (instance != null && baseName != 'values') {
+          _errorReporter.atElement(
+            accessor,
+            CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE,
+            arguments: [declarationName, baseName, declarationName],
+          );
+        }
+      }
+    }
+
+    for (var method in fragment.methods) {
+      if (method.source != _currentUnit.source) {
+        continue;
+      }
+      var baseName = method.displayName;
+      if (method.isStatic) {
+        var instance = _getInterfaceMember(declarationElement, baseName);
+        if (instance != null) {
+          _errorReporter.atElement(
+            method,
+            CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE,
+            arguments: [declarationName, baseName, declarationName],
+          );
+        }
+      }
+    }
+  }
+
+  /// Check that there are no members with the same name.
+  void _checkExtension(ExtensionDeclaration node) {
+    var fragment = node.declaredElement!;
+    _checkClassMembers(fragment, node.members);
+  }
+
+  void _checkExtensionStatic(ExtensionDeclaration node) {
+    var fragment = node.declaredElement!;
+    var declarationElement = fragment.augmented.declaration;
+
+    var elementContext = _getElementContext(declarationElement);
+    var instanceGetters = elementContext.instanceGetters;
+    var instanceSetters = elementContext.instanceSetters;
+
+    for (var member in node.members) {
+      if (member is FieldDeclaration) {
+        if (member.isStatic) {
+          for (var field in member.fields.variables) {
+            var identifier = field.name;
+            var name = identifier.lexeme;
+            if (instanceGetters.containsKey(name) ||
+                instanceSetters.containsKey(name)) {
+              _errorReporter.atToken(
+                identifier,
+                CompileTimeErrorCode.EXTENSION_CONFLICTING_STATIC_AND_INSTANCE,
+                arguments: [name],
+              );
+            }
+          }
+        }
+      } else if (member is MethodDeclaration) {
+        if (member.isStatic) {
+          var identifier = member.name;
+          var name = identifier.lexeme;
+          if (instanceGetters.containsKey(name) ||
+              instanceSetters.containsKey(name)) {
+            _errorReporter.atToken(
+              identifier,
+              CompileTimeErrorCode.EXTENSION_CONFLICTING_STATIC_AND_INSTANCE,
+              arguments: [name],
+            );
+          }
+        }
+      }
+    }
+  }
+
+  void _checkExtensionType(ExtensionTypeDeclarationImpl node) {
+    var fragment = node.declaredElement!;
+    var element = fragment.augmented.declaration;
+    var primaryConstructorName = element.constructors.first.name;
+    var representationGetter = element.representation.getter!;
+    _getElementContext(element)
+      ..constructorNames.add(primaryConstructorName)
+      ..instanceGetters[representationGetter.name] = representationGetter;
+
+    _checkClassMembers(element, node.members);
+  }
+
+  void _checkMixin(MixinDeclaration node) {
+    _checkClassMembers(node.declaredElement!, node.members);
+  }
+
+  void _checkUnit(CompilationUnitImpl node) {
+    for (var node in node.declarations) {
+      switch (node) {
+        case ClassDeclarationImpl():
+          _checkClass(node);
+        case ExtensionDeclarationImpl():
+          _checkExtension(node);
+        case EnumDeclarationImpl():
+          _checkEnum(node);
+        case ExtensionTypeDeclarationImpl():
+          _checkExtensionType(node);
+        case MixinDeclarationImpl():
+          _checkMixin(node);
+        case ClassTypeAliasImpl():
+        case FunctionDeclarationImpl():
+        case FunctionTypeAliasImpl():
+        case GenericTypeAliasImpl():
+        case TopLevelVariableDeclarationImpl():
+        // Do nothing.
+      }
+    }
+  }
+
+  void _checkUnitStatic(CompilationUnitImpl node) {
+    for (var declaration in node.declarations) {
+      switch (declaration) {
+        case ClassDeclarationImpl():
+          var fragment = declaration.declaredElement!;
+          _checkClassStatic(fragment, declaration.members);
+        case EnumDeclarationImpl():
+          _checkEnumStatic(declaration);
+        case ExtensionDeclarationImpl():
+          _checkExtensionStatic(declaration);
+        case ExtensionTypeDeclarationImpl():
+          var fragment = declaration.declaredElement!;
+          _checkClassStatic(fragment, declaration.members);
+        case MixinDeclarationImpl():
+          var fragment = declaration.declaredElement!;
+          _checkClassStatic(fragment, declaration.members);
+        case ClassTypeAliasImpl():
+        case FunctionDeclarationImpl():
+        case FunctionTypeAliasImpl():
+        case GenericTypeAliasImpl():
+        case TopLevelVariableDeclarationImpl():
+        // Do nothing.
+      }
+    }
+  }
+
   void _checkValuesDeclarationInEnum(Token name) {
     if (name.lexeme == 'values') {
       _errorReporter.atToken(
@@ -605,6 +801,33 @@
     return _inheritanceManager.getMember2(element, setterName);
   }
 
+  static void checkLibrary({
+    required InheritanceManager3 inheritance,
+    required LibraryVerificationContext libraryVerificationContext,
+    required LibraryElement libraryElement,
+    required Map<FileState, UnitAnalysis> units,
+  }) {
+    MemberDuplicateDefinitionVerifier forUnit(UnitAnalysis unitAnalysis) {
+      return MemberDuplicateDefinitionVerifier._(
+        inheritance,
+        libraryElement,
+        unitAnalysis.element,
+        unitAnalysis.errorReporter,
+        libraryVerificationContext.duplicationDefinitionContext,
+      );
+    }
+
+    // Check all instance members.
+    for (var unitAnalysis in units.values) {
+      forUnit(unitAnalysis)._checkUnit(unitAnalysis.unit);
+    }
+
+    // Check all static members.
+    for (var unitAnalysis in units.values) {
+      forUnit(unitAnalysis)._checkUnitStatic(unitAnalysis.unit);
+    }
+  }
+
   static bool _isGetterSetterPair(Element a, Element b) {
     if (a is PropertyAccessorElement && b is PropertyAccessorElement) {
       return a.isGetter && b.isSetter || a.isSetter && b.isGetter;
@@ -613,12 +836,6 @@
   }
 }
 
-/// Information to pass from declarations to augmentations.
-class DuplicationDefinitionContext {
-  final Map<InstanceElement, _InstanceElementContext> _instanceElementContexts =
-      {};
-}
-
 /// Information accumulated for a single declaration and its augmentations.
 class _InstanceElementContext {
   final Set<String> constructorNames = {};
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 31a4307..0ae05cb 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -270,9 +270,7 @@
         _requiredParametersVerifier = RequiredParametersVerifier(errorReporter),
         _constArgumentsVerifier = ConstArgumentsVerifier(errorReporter),
         _duplicateDefinitionVerifier = DuplicateDefinitionVerifier(
-          _inheritanceManager,
           _currentLibrary,
-          _currentUnit,
           errorReporter,
           libraryContext.duplicationDefinitionContext,
         ) {
@@ -484,7 +482,6 @@
       _enclosingClass = declarationElement;
 
       List<ClassMember> members = node.members;
-      _duplicateDefinitionVerifier.checkClass(node);
       if (!declarationElement.isDartCoreFunctionImpl) {
         _checkForBuiltInIdentifierAsName(
             node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
@@ -691,8 +688,6 @@
       var declarationElement = augmented.declaration;
       _enclosingClass = declarationElement;
 
-      _duplicateDefinitionVerifier.checkEnum(node);
-
       _checkForBuiltInIdentifierAsName(
           node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
       _checkForConflictingEnumTypeVariableErrorCodes(element);
@@ -775,7 +770,6 @@
     }
 
     _enclosingExtension = element;
-    _duplicateDefinitionVerifier.checkExtension(node);
     _checkForConflictingExtensionTypeVariableErrorCodes();
     _checkForFinalNotInitializedInClass(element, node.members);
 
@@ -822,7 +816,6 @@
       _checkForConflictingExtensionTypeTypeVariableErrorCodes(element);
 
       var members = node.members;
-      _duplicateDefinitionVerifier.checkExtensionType(node, declarationElement);
       _checkForRepeatedType(
         libraryContext.setOfImplements(declarationElement),
         node.implementsClause?.interfaces,
@@ -1245,7 +1238,6 @@
       _enclosingClass = declarationElement;
 
       List<ClassMember> members = node.members;
-      _duplicateDefinitionVerifier.checkMixin(node);
       _checkForBuiltInIdentifierAsName(
           node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
       _checkForConflictingClassTypeVariableErrorCodes();
diff --git a/pkg/analyzer/test/src/diagnostics/conflicting_static_and_instance_test.dart b/pkg/analyzer/test/src/diagnostics/conflicting_static_and_instance_test.dart
index dc24c80..f378494 100644
--- a/pkg/analyzer/test/src/diagnostics/conflicting_static_and_instance_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/conflicting_static_and_instance_test.dart
@@ -18,7 +18,32 @@
 
 @reflectiveTest
 class ConflictingStaticAndInstanceClassTest extends PubPackageResolutionTest {
-  test_inClass_getter_getter() async {
+  test_inClass_instanceMethod_staticMethod() async {
+    await assertErrorsInCode(r'''
+class C {
+  void foo() {}
+  static void foo() {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 40, 3),
+    ]);
+  }
+
+  test_inClass_instanceMethod_staticMethodInAugmentation() async {
+    await assertErrorsInCode(r'''
+class A {
+  void foo() {}
+}
+
+augment class A {
+  static void foo() {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 61, 3),
+    ]);
+  }
+
+  test_inClass_staticGetter_instanceGetter() async {
     await assertErrorsInCode(r'''
 class C {
   static int get foo => 0;
@@ -29,7 +54,7 @@
     ]);
   }
 
-  test_inClass_getter_method() async {
+  test_inClass_staticGetter_instanceMethod() async {
     await assertErrorsInCode(r'''
 class C {
   static int get foo => 0;
@@ -40,7 +65,7 @@
     ]);
   }
 
-  test_inClass_getter_setter() async {
+  test_inClass_staticGetter_instanceSetter() async {
     await assertErrorsInCode(r'''
 class C {
   static int get foo => 0;
@@ -51,7 +76,7 @@
     ]);
   }
 
-  test_inClass_method_getter() async {
+  test_inClass_staticMethod_instanceGetter() async {
     await assertErrorsInCode(r'''
 class C {
   static void foo() {}
@@ -62,7 +87,7 @@
     ]);
   }
 
-  test_inClass_method_method() async {
+  test_inClass_staticMethod_instanceMethod() async {
     await assertErrorsInCode(r'''
 class C {
   static void foo() {}
@@ -73,7 +98,21 @@
     ]);
   }
 
-  test_inClass_method_setter() async {
+  test_inClass_staticMethod_instanceMethodInAugmentation() async {
+    await assertErrorsInCode(r'''
+class A {
+  static void foo() {}
+}
+
+augment class A {
+  void foo() {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 24, 3),
+    ]);
+  }
+
+  test_inClass_staticMethod_instanceSetter() async {
     await assertErrorsInCode(r'''
 class C {
   static void foo() {}
@@ -84,7 +123,7 @@
     ]);
   }
 
-  test_inClass_setter_getter() async {
+  test_inClass_staticSetter_instanceGetter() async {
     await assertErrorsInCode(r'''
 class C {
   static set foo(_) {}
@@ -95,7 +134,7 @@
     ]);
   }
 
-  test_inClass_setter_method() async {
+  test_inClass_staticSetter_instanceMethod() async {
     await assertErrorsInCode(r'''
 class C {
   static set foo(_) {}
@@ -106,7 +145,7 @@
     ]);
   }
 
-  test_inClass_setter_setter() async {
+  test_inClass_staticSetter_instanceSetter() async {
     await assertErrorsInCode(r'''
 class C {
   static set foo(_) {}
@@ -117,7 +156,7 @@
     ]);
   }
 
-  test_inInterface_getter_getter() async {
+  test_inInterface_instanceGetter_staticGetter() async {
     await assertErrorsInCode(r'''
 class A {
   int get foo => 0;
@@ -130,7 +169,7 @@
     ]);
   }
 
-  test_inInterface_getter_method() async {
+  test_inInterface_instanceGetter_staticMethod() async {
     await assertErrorsInCode(r'''
 class A {
   int get foo => 0;
@@ -143,7 +182,33 @@
     ]);
   }
 
-  test_inInterface_getter_setter() async {
+  test_inInterface_instanceMethod_staticMethod() async {
+    await assertErrorsInCode(r'''
+class A {
+  void foo() {}
+}
+abstract class B implements A {
+  static void foo() {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 74, 3),
+    ]);
+  }
+
+  test_inInterface_instanceMethod_staticSetter() async {
+    await assertErrorsInCode(r'''
+class A {
+  void foo() {}
+}
+abstract class B implements A {
+  static set foo(_) {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 73, 3),
+    ]);
+  }
+
+  test_inInterface_instanceSetter_staticGetter() async {
     await assertErrorsInCode(r'''
 class A {
   set foo(_) {}
@@ -156,33 +221,7 @@
     ]);
   }
 
-  test_inInterface_method_getter() async {
-    await assertErrorsInCode(r'''
-class A {
-  int get foo => 0;
-}
-abstract class B implements A {
-  static void foo() {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 78, 3),
-    ]);
-  }
-
-  test_inInterface_method_method() async {
-    await assertErrorsInCode(r'''
-class A {
-  void foo() {}
-}
-abstract class B implements A {
-  static void foo() {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 74, 3),
-    ]);
-  }
-
-  test_inInterface_method_setter() async {
+  test_inInterface_instanceSetter_staticMethod() async {
     await assertErrorsInCode(r'''
 class A {
   set foo(_) {}
@@ -195,20 +234,7 @@
     ]);
   }
 
-  test_inInterface_setter_method() async {
-    await assertErrorsInCode(r'''
-class A {
-  void foo() {}
-}
-abstract class B implements A {
-  static set foo(_) {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 73, 3),
-    ]);
-  }
-
-  test_inInterface_setter_setter() async {
+  test_inInterface_instanceSetter_staticSetter() async {
     await assertErrorsInCode(r'''
 class A {
   set foo(_) {}
@@ -221,7 +247,7 @@
     ]);
   }
 
-  test_inMixin_getter_getter() async {
+  test_inMixin_instanceGetter_staticGetter() async {
     await assertErrorsInCode(r'''
 mixin A {
   int get foo => 0;
@@ -234,7 +260,7 @@
     ]);
   }
 
-  test_inMixin_getter_method() async {
+  test_inMixin_instanceGetter_staticMethod() async {
     await assertErrorsInCode(r'''
 mixin A {
   int get foo => 0;
@@ -247,7 +273,47 @@
     ]);
   }
 
-  test_inMixin_getter_setter() async {
+  test_inMixin_instanceMethod_staticMethod() async {
+    await assertErrorsInCode(r'''
+mixin A {
+  void foo() {}
+}
+class B extends Object with A {
+  static void foo() {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 74, 3),
+    ]);
+  }
+
+  test_inMixin_instanceMethod_staticMethodInAugmentation() async {
+    await assertErrorsInCode(r'''
+mixin A {
+  void foo() {}
+}
+
+augment mixin A {
+  static void foo() {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 61, 3),
+    ]);
+  }
+
+  test_inMixin_instanceMethod_staticSetter() async {
+    await assertErrorsInCode(r'''
+mixin A {
+  void foo() {}
+}
+class B extends Object with A {
+  static set foo(_) {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 73, 3),
+    ]);
+  }
+
+  test_inMixin_instanceSetter_staticGetter() async {
     await assertErrorsInCode(r'''
 mixin A {
   set foo(_) {}
@@ -260,33 +326,7 @@
     ]);
   }
 
-  test_inMixin_method_getter() async {
-    await assertErrorsInCode(r'''
-mixin A {
-  int get foo => 0;
-}
-class B extends Object with A {
-  static void foo() {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 78, 3),
-    ]);
-  }
-
-  test_inMixin_method_method() async {
-    await assertErrorsInCode(r'''
-mixin A {
-  void foo() {}
-}
-class B extends Object with A {
-  static void foo() {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 74, 3),
-    ]);
-  }
-
-  test_inMixin_method_setter() async {
+  test_inMixin_instanceSetter_staticMethod() async {
     await assertErrorsInCode(r'''
 mixin A {
   set foo(_) {}
@@ -299,20 +339,7 @@
     ]);
   }
 
-  test_inMixin_setter_method() async {
-    await assertErrorsInCode(r'''
-mixin A {
-  void foo() {}
-}
-class B extends Object with A {
-  static set foo(_) {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 73, 3),
-    ]);
-  }
-
-  test_inMixin_setter_setter() async {
+  test_inMixin_instanceSetter_staticSetter() async {
     await assertErrorsInCode(r'''
 mixin A {
   set foo(_) {}
@@ -325,7 +352,41 @@
     ]);
   }
 
-  test_inSuper_getter_getter() async {
+  test_inMixin_staticMethod_instanceMethodInAugmentation() async {
+    await assertErrorsInCode(r'''
+mixin A {
+  static void foo() {}
+}
+
+augment mixin A {
+  void foo() {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 24, 3),
+    ]);
+  }
+
+  test_inSuper_implicitObject_staticMethod_instanceGetter() async {
+    await assertErrorsInCode(r'''
+class A {
+  static String runtimeType() => 'x';
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 26, 11),
+    ]);
+  }
+
+  test_inSuper_implicitObject_staticMethod_instanceMethod() async {
+    await assertErrorsInCode(r'''
+class A {
+  static String toString() => 'x';
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 26, 8),
+    ]);
+  }
+
+  test_inSuper_instanceGetter_staticGetter() async {
     await assertErrorsInCode(r'''
 class A {
   int get foo => 0;
@@ -338,7 +399,7 @@
     ]);
   }
 
-  test_inSuper_getter_method() async {
+  test_inSuper_instanceGetter_staticMethod() async {
     await assertErrorsInCode(r'''
 class A {
   int get foo => 0;
@@ -351,40 +412,7 @@
     ]);
   }
 
-  test_inSuper_getter_setter() async {
-    await assertErrorsInCode(r'''
-class A {
-  set foo(_) {}
-}
-class B extends A {
-  static int get foo => 0;
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 65, 3),
-    ]);
-  }
-
-  test_inSuper_implicitObject_method_getter() async {
-    await assertErrorsInCode(r'''
-class A {
-  static String runtimeType() => 'x';
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 26, 11),
-    ]);
-  }
-
-  test_inSuper_implicitObject_method_method() async {
-    await assertErrorsInCode(r'''
-class A {
-  static String toString() => 'x';
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 26, 8),
-    ]);
-  }
-
-  test_inSuper_method_getter() async {
+  test_inSuper_instanceMethod_staticGetter() async {
     await assertErrorsInCode(r'''
 class A {
   int get foo => 0;
@@ -397,7 +425,7 @@
     ]);
   }
 
-  test_inSuper_method_method() async {
+  test_inSuper_instanceMethod_staticMethod() async {
     await assertErrorsInCode(r'''
 class A {
   void foo() {}
@@ -410,20 +438,7 @@
     ]);
   }
 
-  test_inSuper_method_setter() async {
-    await assertErrorsInCode(r'''
-class A {
-  set foo(_) {}
-}
-class B extends A {
-  static void foo() {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 62, 3),
-    ]);
-  }
-
-  test_inSuper_setter_method() async {
+  test_inSuper_instanceMethod_staticSetter() async {
     await assertErrorsInCode(r'''
 class A {
   void foo() {}
@@ -436,7 +451,33 @@
     ]);
   }
 
-  test_inSuper_setter_setter() async {
+  test_inSuper_instanceSetter_staticGetter() async {
+    await assertErrorsInCode(r'''
+class A {
+  set foo(_) {}
+}
+class B extends A {
+  static int get foo => 0;
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 65, 3),
+    ]);
+  }
+
+  test_inSuper_instanceSetter_staticMethod() async {
+    await assertErrorsInCode(r'''
+class A {
+  set foo(_) {}
+}
+class B extends A {
+  static void foo() {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 62, 3),
+    ]);
+  }
+
+  test_inSuper_instanceSetter_staticSetter() async {
     await assertErrorsInCode(r'''
 class A {
   set foo(_) {}
@@ -472,6 +513,17 @@
     ]);
   }
 
+  test_constant_instanceSetter() async {
+    await assertErrorsInCode(r'''
+enum E {
+  foo;
+  set foo(_) {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 11, 3),
+    ]);
+  }
+
   test_constant_noSuchMethod() async {
     await assertErrorsInCode(r'''
 enum E {
@@ -492,11 +544,11 @@
     ]);
   }
 
-  test_constant_this_setter() async {
+  test_constant_staticMethod() async {
     await assertErrorsInCode(r'''
 enum E {
   foo;
-  set foo(_) {}
+  void foo() {}
 }
 ''', [
       error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 11, 3),
@@ -616,18 +668,6 @@
     ]);
   }
 
-  test_getter_this_setter() async {
-    await assertErrorsInCode(r'''
-enum E {
-  v;
-  static int get foo => 0;
-  set foo(_) {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 31, 3),
-    ]);
-  }
-
   test_method_dartCoreEnum() async {
     await assertErrorsInCode(r'''
 enum E {
@@ -684,18 +724,19 @@
     ]);
   }
 
-  test_method_this_constant() async {
+  test_staticGetter_instanceSetter() async {
     await assertErrorsInCode(r'''
 enum E {
-  foo;
-  void foo() {}
+  v;
+  static int get foo => 0;
+  set foo(_) {}
 }
 ''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 11, 3),
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 31, 3),
     ]);
   }
 
-  test_method_this_getter() async {
+  test_staticMethod_instanceGetter() async {
     await assertErrorsInCode(r'''
 enum E {
   v;
@@ -707,7 +748,7 @@
     ]);
   }
 
-  test_method_this_method() async {
+  test_staticMethod_instanceMethod() async {
     await assertErrorsInCode(r'''
 enum E {
   v;
@@ -719,7 +760,7 @@
     ]);
   }
 
-  test_method_this_setter() async {
+  test_staticMethod_instanceSetter() async {
     await assertErrorsInCode(r'''
 enum E {
   v;
@@ -731,7 +772,7 @@
     ]);
   }
 
-  test_setter_this_getter() async {
+  test_staticSetter_instanceGetter() async {
     await assertErrorsInCode(r'''
 enum E {
   v;
@@ -747,7 +788,7 @@
 @reflectiveTest
 class ConflictingStaticAndInstanceExtensionTypeTest
     extends PubPackageResolutionTest {
-  test_inExtensionType_getter_getter() async {
+  test_inExtensionType_staticGetter_instanceGetter() async {
     await assertErrorsInCode(r'''
 extension type A(int it) {
   static int get foo => 0;
@@ -758,7 +799,7 @@
     ]);
   }
 
-  test_inExtensionType_getter_method() async {
+  test_inExtensionType_staticGetter_instanceMethod() async {
     await assertErrorsInCode(r'''
 extension type A(int t) {
   static int get foo => 0;
@@ -769,7 +810,7 @@
     ]);
   }
 
-  test_inExtensionType_getter_setter() async {
+  test_inExtensionType_staticGetter_instanceSetter() async {
     await assertErrorsInCode(r'''
 extension type A(int it) {
   static int get foo => 0;
@@ -780,7 +821,7 @@
     ]);
   }
 
-  test_inExtensionType_method_getter() async {
+  test_inExtensionType_staticMethod_instanceGetter() async {
     await assertErrorsInCode(r'''
 extension type A(int it) {
   static void foo() {}
@@ -791,7 +832,7 @@
     ]);
   }
 
-  test_inExtensionType_method_method() async {
+  test_inExtensionType_staticMethod_instanceMethod() async {
     await assertErrorsInCode(r'''
 extension type A(int it) {
   static void foo() {}
@@ -802,7 +843,7 @@
     ]);
   }
 
-  test_inExtensionType_method_setter() async {
+  test_inExtensionType_staticMethod_instanceSetter() async {
     await assertErrorsInCode(r'''
 extension type A(int it) {
   static void foo() {}
@@ -813,7 +854,7 @@
     ]);
   }
 
-  test_inExtensionType_setter_getter() async {
+  test_inExtensionType_staticSetter_instanceGetter() async {
     await assertErrorsInCode(r'''
 extension type A(int it) {
   static set foo(_) {}
@@ -824,7 +865,7 @@
     ]);
   }
 
-  test_inExtensionType_setter_method() async {
+  test_inExtensionType_staticSetter_instanceMethod() async {
     await assertErrorsInCode(r'''
 extension type A(int it) {
   static set foo(_) {}
@@ -835,7 +876,7 @@
     ]);
   }
 
-  test_inExtensionType_setter_setter() async {
+  test_inExtensionType_staticSetter_instanceSetter() async {
     await assertErrorsInCode(r'''
 extension type A(int it) {
   static set foo(_) {}
@@ -846,7 +887,7 @@
     ]);
   }
 
-  test_inInterface_getter_getter() async {
+  test_inInterface_instanceGetter_staticGetter() async {
     await assertErrorsInCode(r'''
 extension type A(int it) {
   int get foo => 0;
@@ -860,7 +901,7 @@
     ]);
   }
 
-  test_inInterface_getter_method() async {
+  test_inInterface_instanceGetter_staticMethod() async {
     await assertErrorsInCode(r'''
 extension type A(int it) {
   int get foo => 0;
@@ -874,21 +915,7 @@
     ]);
   }
 
-  test_inInterface_getter_setter() async {
-    await assertErrorsInCode(r'''
-extension type A(int it) {
-  set foo(_) {}
-}
-
-extension type B(int it) implements A {
-  static int get foo => 0;
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 103, 3),
-    ]);
-  }
-
-  test_inInterface_method_getter() async {
+  test_inInterface_instanceMethod_staticGetter() async {
     await assertErrorsInCode(r'''
 extension type A(int it) {
   int get foo => 0;
@@ -902,7 +929,7 @@
     ]);
   }
 
-  test_inInterface_method_method() async {
+  test_inInterface_instanceMethod_staticMethod() async {
     await assertErrorsInCode(r'''
 extension type A(int it) {
   void foo() {}
@@ -916,21 +943,7 @@
     ]);
   }
 
-  test_inInterface_method_setter() async {
-    await assertErrorsInCode(r'''
-extension type A(int it) {
-  set foo(_) {}
-}
-
-extension type B(int it) implements A {
-  static void foo() {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 100, 3),
-    ]);
-  }
-
-  test_inInterface_setter_method() async {
+  test_inInterface_instanceMethod_staticSetter() async {
     await assertErrorsInCode(r'''
 extension type A(int it) {
   void foo() {}
@@ -944,7 +957,35 @@
     ]);
   }
 
-  test_inInterface_setter_setter() async {
+  test_inInterface_instanceSetter_staticGetter() async {
+    await assertErrorsInCode(r'''
+extension type A(int it) {
+  set foo(_) {}
+}
+
+extension type B(int it) implements A {
+  static int get foo => 0;
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 103, 3),
+    ]);
+  }
+
+  test_inInterface_instanceSetter_staticMethod() async {
+    await assertErrorsInCode(r'''
+extension type A(int it) {
+  set foo(_) {}
+}
+
+extension type B(int it) implements A {
+  static void foo() {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 100, 3),
+    ]);
+  }
+
+  test_inInterface_instanceSetter_staticSetter() async {
     await assertErrorsInCode(r'''
 extension type A(int it) {
   set foo(_) {}
@@ -1001,7 +1042,27 @@
     ]);
   }
 
-  test_inConstraint_getter_getter() async {
+  test_inConstraint_implicitObject_staticMethod_instanceGetter() async {
+    await assertErrorsInCode(r'''
+mixin M {
+  static String runtimeType() => 'x';
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 26, 11),
+    ]);
+  }
+
+  test_inConstraint_implicitObject_staticMethod_instanceMethod() async {
+    await assertErrorsInCode(r'''
+mixin M {
+  static String toString() => 'x';
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 26, 8),
+    ]);
+  }
+
+  test_inConstraint_instanceGetter_staticGetter() async {
     await assertErrorsInCode(r'''
 class A {
   int get foo => 0;
@@ -1014,7 +1075,7 @@
     ]);
   }
 
-  test_inConstraint_getter_method() async {
+  test_inConstraint_instanceGetter_staticMethod() async {
     await assertErrorsInCode(r'''
 class A {
   int get foo => 0;
@@ -1027,7 +1088,33 @@
     ]);
   }
 
-  test_inConstraint_getter_setter() async {
+  test_inConstraint_instanceMethod_staticMethod() async {
+    await assertErrorsInCode(r'''
+class A {
+  void foo() {}
+}
+mixin M on A {
+  static void foo() {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 57, 3),
+    ]);
+  }
+
+  test_inConstraint_instanceMethod_staticSetter() async {
+    await assertErrorsInCode(r'''
+class A {
+  void foo() {}
+}
+mixin M on A {
+  static set foo(_) {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 56, 3),
+    ]);
+  }
+
+  test_inConstraint_instanceSetter_staticGetter() async {
     await assertErrorsInCode(r'''
 class A {
   set foo(_) {}
@@ -1040,53 +1127,7 @@
     ]);
   }
 
-  test_inConstraint_implicitObject_method_getter() async {
-    await assertErrorsInCode(r'''
-mixin M {
-  static String runtimeType() => 'x';
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 26, 11),
-    ]);
-  }
-
-  test_inConstraint_implicitObject_method_method() async {
-    await assertErrorsInCode(r'''
-mixin M {
-  static String toString() => 'x';
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 26, 8),
-    ]);
-  }
-
-  test_inConstraint_method_getter() async {
-    await assertErrorsInCode(r'''
-class A {
-  int get foo => 0;
-}
-mixin M on A {
-  static void foo() {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 61, 3),
-    ]);
-  }
-
-  test_inConstraint_method_method() async {
-    await assertErrorsInCode(r'''
-class A {
-  void foo() {}
-}
-mixin M on A {
-  static void foo() {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 57, 3),
-    ]);
-  }
-
-  test_inConstraint_method_setter() async {
+  test_inConstraint_instanceSetter_staticMethod() async {
     await assertErrorsInCode(r'''
 class A {
   set foo(_) {}
@@ -1099,20 +1140,7 @@
     ]);
   }
 
-  test_inConstraint_setter_method() async {
-    await assertErrorsInCode(r'''
-class A {
-  void foo() {}
-}
-mixin M on A {
-  static set foo(_) {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 56, 3),
-    ]);
-  }
-
-  test_inConstraint_setter_setter() async {
+  test_inConstraint_instanceSetter_staticSetter() async {
     await assertErrorsInCode(r'''
 class A {
   set foo(_) {}
@@ -1125,7 +1153,7 @@
     ]);
   }
 
-  test_inInterface_getter_getter() async {
+  test_inInterface_instanceGetter_staticGetter() async {
     await assertErrorsInCode(r'''
 class A {
   int get foo => 0;
@@ -1138,7 +1166,7 @@
     ]);
   }
 
-  test_inInterface_getter_method() async {
+  test_inInterface_instanceGetter_staticMethod() async {
     await assertErrorsInCode(r'''
 class A {
   int get foo => 0;
@@ -1151,7 +1179,46 @@
     ]);
   }
 
-  test_inInterface_getter_setter() async {
+  test_inInterface_instanceMethod_staticGetter() async {
+    await assertErrorsInCode(r'''
+class A {
+  int get foo => 0;
+}
+mixin M implements A {
+  static void foo() {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 69, 3),
+    ]);
+  }
+
+  test_inInterface_instanceMethod_staticMethod() async {
+    await assertErrorsInCode(r'''
+class A {
+  void foo() {}
+}
+mixin M implements A {
+  static void foo() {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 65, 3),
+    ]);
+  }
+
+  test_inInterface_instanceMethod_staticSetter() async {
+    await assertErrorsInCode(r'''
+class A {
+  void foo() {}
+}
+mixin M implements A {
+  static set foo(_) {}
+}
+''', [
+      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 64, 3),
+    ]);
+  }
+
+  test_inInterface_instanceSetter_staticGetter() async {
     await assertErrorsInCode(r'''
 class A {
   set foo(_) {}
@@ -1164,33 +1231,7 @@
     ]);
   }
 
-  test_inInterface_method_getter() async {
-    await assertErrorsInCode(r'''
-class A {
-  int get foo => 0;
-}
-mixin M implements A {
-  static void foo() {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 69, 3),
-    ]);
-  }
-
-  test_inInterface_method_method() async {
-    await assertErrorsInCode(r'''
-class A {
-  void foo() {}
-}
-mixin M implements A {
-  static void foo() {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 65, 3),
-    ]);
-  }
-
-  test_inInterface_method_setter() async {
+  test_inInterface_instanceSetter_staticMethod() async {
     await assertErrorsInCode(r'''
 class A {
   set foo(_) {}
@@ -1203,20 +1244,7 @@
     ]);
   }
 
-  test_inInterface_setter_method() async {
-    await assertErrorsInCode(r'''
-class A {
-  void foo() {}
-}
-mixin M implements A {
-  static set foo(_) {}
-}
-''', [
-      error(CompileTimeErrorCode.CONFLICTING_STATIC_AND_INSTANCE, 64, 3),
-    ]);
-  }
-
-  test_inInterface_setter_setter() async {
+  test_inInterface_instanceSetter_staticSetter() async {
     await assertErrorsInCode(r'''
 class A {
   set foo(_) {}
@@ -1229,7 +1257,7 @@
     ]);
   }
 
-  test_inMixin_getter_getter() async {
+  test_inMixin_staticGetter_instanceGetter() async {
     await assertErrorsInCode(r'''
 mixin M {
   static int get foo => 0;
@@ -1240,7 +1268,7 @@
     ]);
   }
 
-  test_inMixin_getter_method() async {
+  test_inMixin_staticGetter_instanceMethod() async {
     await assertErrorsInCode(r'''
 mixin M {
   static int get foo => 0;
@@ -1251,7 +1279,7 @@
     ]);
   }
 
-  test_inMixin_getter_setter() async {
+  test_inMixin_staticGetter_instanceSetter() async {
     await assertErrorsInCode(r'''
 mixin M {
   static int get foo => 0;
@@ -1262,7 +1290,7 @@
     ]);
   }
 
-  test_inMixin_method_getter() async {
+  test_inMixin_staticMethod_instanceGetter() async {
     await assertErrorsInCode(r'''
 mixin M {
   static void foo() {}
@@ -1273,7 +1301,7 @@
     ]);
   }
 
-  test_inMixin_method_method() async {
+  test_inMixin_staticMethod_instanceMethod() async {
     await assertErrorsInCode(r'''
 mixin M {
   static void foo() {}
@@ -1284,7 +1312,7 @@
     ]);
   }
 
-  test_inMixin_method_setter() async {
+  test_inMixin_staticMethod_instanceSetter() async {
     await assertErrorsInCode(r'''
 mixin M {
   static void foo() {}
@@ -1295,7 +1323,7 @@
     ]);
   }
 
-  test_inMixin_setter_getter() async {
+  test_inMixin_staticSetter_instanceGetter() async {
     await assertErrorsInCode(r'''
 mixin M {
   static set foo(_) {}
@@ -1306,7 +1334,7 @@
     ]);
   }
 
-  test_inMixin_setter_method() async {
+  test_inMixin_staticSetter_instanceMethod() async {
     await assertErrorsInCode(r'''
 mixin M {
   static set foo(_) {}
@@ -1317,7 +1345,7 @@
     ]);
   }
 
-  test_inMixin_setter_setter() async {
+  test_inMixin_staticSetter_instanceSetter() async {
     await assertErrorsInCode(r'''
 mixin M {
   static set foo(_) {}
diff --git a/pkg/analyzer/test/src/diagnostics/extension_conflicting_static_and_instance_test.dart b/pkg/analyzer/test/src/diagnostics/extension_conflicting_static_and_instance_test.dart
index d590109..a61fa69 100644
--- a/pkg/analyzer/test/src/diagnostics/extension_conflicting_static_and_instance_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/extension_conflicting_static_and_instance_test.dart
@@ -19,7 +19,7 @@
   CompileTimeErrorCode get _errorCode =>
       CompileTimeErrorCode.EXTENSION_CONFLICTING_STATIC_AND_INSTANCE;
 
-  test_extendedType_field() async {
+  test_extendedType_staticField() async {
     await assertNoErrorsInCode('''
 class A {
   static int foo = 0;
@@ -33,7 +33,7 @@
 ''');
   }
 
-  test_extendedType_getter() async {
+  test_extendedType_staticGetter() async {
     await assertNoErrorsInCode('''
 class A {
   static int get foo => 0;
@@ -47,7 +47,7 @@
 ''');
   }
 
-  test_extendedType_method() async {
+  test_extendedType_staticMethod() async {
     await assertNoErrorsInCode('''
 class A {
   static void foo() {}
@@ -61,7 +61,7 @@
 ''');
   }
 
-  test_extendedType_setter() async {
+  test_extendedType_staticSetter() async {
     await assertNoErrorsInCode('''
 class A {
   static set foo(_) {}
@@ -75,7 +75,21 @@
 ''');
   }
 
-  test_field_getter() async {
+  test_instanceMethod_staticMethodInAugmentation() async {
+    await assertErrorsInCode('''
+extension A on int {
+  void foo() {}
+}
+
+augment extension A {
+  static void foo() {}
+}
+''', [
+      error(_errorCode, 76, 3),
+    ]);
+  }
+
+  test_staticField_instanceGetter() async {
     await assertErrorsInCode('''
 extension E on String {
   static int foo = 0;
@@ -86,7 +100,7 @@
     ]);
   }
 
-  test_field_getter_unnamed() async {
+  test_staticField_instanceGetter_unnamed() async {
     await assertErrorsInCode('''
 extension E on String {
   static int foo = 0;
@@ -97,7 +111,7 @@
     ]);
   }
 
-  test_field_method() async {
+  test_staticField_instanceMethod() async {
     await assertErrorsInCode('''
 extension E on String {
   static int foo = 0;
@@ -108,7 +122,7 @@
     ]);
   }
 
-  test_field_setter() async {
+  test_staticField_instanceSetter() async {
     await assertErrorsInCode('''
 extension E on String {
   static int foo = 0;
@@ -119,7 +133,7 @@
     ]);
   }
 
-  test_getter_getter() async {
+  test_staticGetter_instanceGetter() async {
     await assertErrorsInCode('''
 extension E on String {
   static int get foo => 0;
@@ -130,7 +144,7 @@
     ]);
   }
 
-  test_getter_getter_unnamed() async {
+  test_staticGetter_instanceGetter_unnamed() async {
     await assertErrorsInCode('''
 extension E on String {
   static int get foo => 0;
@@ -141,7 +155,7 @@
     ]);
   }
 
-  test_getter_method() async {
+  test_staticGetter_instanceMethod() async {
     await assertErrorsInCode('''
 extension E on String {
   static int get foo => 0;
@@ -152,7 +166,7 @@
     ]);
   }
 
-  test_getter_setter() async {
+  test_staticGetter_instanceSetter() async {
     await assertErrorsInCode('''
 extension E on String {
   static int get foo => 0;
@@ -163,7 +177,7 @@
     ]);
   }
 
-  test_method_getter() async {
+  test_staticMethod_instanceGetter() async {
     await assertErrorsInCode('''
 extension E on String {
   static void foo() {}
@@ -174,7 +188,7 @@
     ]);
   }
 
-  test_method_method() async {
+  test_staticMethod_instanceMethod() async {
     await assertErrorsInCode('''
 extension E on String {
   static void foo() {}
@@ -185,7 +199,21 @@
     ]);
   }
 
-  test_method_setter() async {
+  test_staticMethod_instanceMethodInAugmentation() async {
+    await assertErrorsInCode('''
+extension A on int {
+  static void foo() {}
+}
+
+augment extension A {
+  void foo() {}
+}
+''', [
+      error(_errorCode, 35, 3),
+    ]);
+  }
+
+  test_staticMethod_instanceSetter() async {
     await assertErrorsInCode('''
 extension E on String {
   static void foo() {}
@@ -196,7 +224,7 @@
     ]);
   }
 
-  test_setter_getter() async {
+  test_staticSetter_instanceGetter() async {
     await assertErrorsInCode('''
 extension E on String {
   static set foo(_) {}
@@ -207,7 +235,7 @@
     ]);
   }
 
-  test_setter_method() async {
+  test_staticSetter_instanceMethod() async {
     await assertErrorsInCode('''
 extension E on String {
   static set foo(_) {}
@@ -218,7 +246,7 @@
     ]);
   }
 
-  test_setter_setter() async {
+  test_staticSetter_instanceSetter() async {
     await assertErrorsInCode('''
 extension E on String {
   static set foo(_) {}