Unify four diagnostic codes for the purpose of documentation

I would have prefered to have renamed them all to undefined_super_member,
but that would have broken existing links. Some day we should add the
support necessary to allow for forwarding so that we can rename codes.

Change-Id: I81e416407e3464b5b60a4dbbfe60a375eb47bb84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157921
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 0efc994..abe9434 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -9633,19 +9633,19 @@
       hasPublishedDocs: true);
 
   /**
-   * 12.17 Getter Invocation: Let <i>T</i> be the static type of <i>e</i>. It is
-   * a static type warning if <i>T</i> does not have a getter named <i>m</i>.
-   *
    * Parameters:
    * 0: the name of the getter
    * 1: the name of the enclosing type where the getter is being looked for
    */
   static const CompileTimeErrorCode UNDEFINED_SUPER_GETTER =
-      CompileTimeErrorCode('UNDEFINED_SUPER_GETTER',
+      CompileTimeErrorCodeWithUniqueName(
+          'UNDEFINED_SUPER_MEMBER',
+          'UNDEFINED_SUPER_GETTER',
           "The getter '{0}' isn't defined in a superclass of '{1}'.",
           correction:
               "Try correcting the name to the name of an existing getter, or "
-              "defining a getter or field named '{0}' in a superclass.");
+              "defining a getter or field named '{0}' in a superclass.",
+          hasPublishedDocs: true);
 
   /**
    * Parameters:
@@ -9654,14 +9654,14 @@
    */
   // #### Description
   //
-  // The analyzer produces this diagnostic when an inherited method is
-  // referenced using `super`, but there’s no method with that name in the
+  // The analyzer produces this diagnostic when an inherited member is
+  // referenced using `super`, but there’s no member with that name in the
   // superclass chain.
   //
   // #### Examples
   //
   // The following code produces this diagnostic because `Object` doesn't define
-  // a member named `n`:
+  // a method named `n`:
   //
   // ```dart
   // class C {
@@ -9671,18 +9671,31 @@
   // }
   // ```
   //
+  // The following code produces this diagnostic because `Object` doesn't define
+  // a getter named `g`:
+  //
+  // ```dart
+  // class C {
+  //   void m() {
+  //     super.[!g!];
+  //   }
+  // }
+  // ```
+  //
   // #### Common fixes
   //
-  // If the inherited method you intend to invoke has a different name, then
-  // make the name of the invoked method  match the inherited method.
+  // If the inherited member you intend to invoke has a different name, then
+  // make the name of the invoked member match the inherited member.
   //
-  // If the method you intend to invoke is defined in the same class, then
+  // If the member you intend to invoke is defined in the same class, then
   // remove the `super.`.
   //
-  // If not, then either add the method to one of the superclasses or remove the
+  // If not, then either add the member to one of the superclasses or remove the
   // invocation.
   static const CompileTimeErrorCode UNDEFINED_SUPER_METHOD =
-      CompileTimeErrorCode('UNDEFINED_SUPER_METHOD',
+      CompileTimeErrorCodeWithUniqueName(
+          'UNDEFINED_SUPER_MEMBER',
+          'UNDEFINED_SUPER_METHOD',
           "The method '{0}' isn't defined in a superclass of '{1}'.",
           correction:
               "Try correcting the name to the name of an existing method, or "
@@ -9690,45 +9703,32 @@
           hasPublishedDocs: true);
 
   /**
-   * 12.18 Assignment: Evaluation of an assignment of the form
-   * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] = <i>e<sub>3</sub></i> is
-   * equivalent to the evaluation of the expression (a, i, e){a.[]=(i, e);
-   * return e;} (<i>e<sub>1</sub></i>, <i>e<sub>2</sub></i>,
-   * <i>e<sub>2</sub></i>).
-   *
-   * 12.29 Assignable Expressions: An assignable expression of the form
-   * <i>e<sub>1</sub></i>[<i>e<sub>2</sub></i>] is evaluated as a method
-   * invocation of the operator method [] on <i>e<sub>1</sub></i> with argument
-   * <i>e<sub>2</sub></i>.
-   *
-   * 12.15.1 Ordinary Invocation: Let <i>T</i> be the static type of <i>o</i>.
-   * It is a static type warning if <i>T</i> does not have an accessible
-   * instance member named <i>m</i>.
-   *
    * Parameters:
    * 0: the name of the operator
    * 1: the name of the enclosing type where the operator is being looked for
    */
   static const CompileTimeErrorCode UNDEFINED_SUPER_OPERATOR =
-      CompileTimeErrorCode('UNDEFINED_SUPER_OPERATOR',
+      CompileTimeErrorCodeWithUniqueName(
+          'UNDEFINED_SUPER_MEMBER',
+          'UNDEFINED_SUPER_OPERATOR',
           "The operator '{0}' isn't defined in a superclass of '{1}'.",
-          correction: "Try defining the operator '{0}' in a superclass.");
+          correction: "Try defining the operator '{0}' in a superclass.",
+          hasPublishedDocs: true);
 
   /**
-   * 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>.
-   * It is a static type warning if <i>T</i> does not have an accessible
-   * instance setter named <i>v=</i>.
-   *
    * Parameters:
    * 0: the name of the setter
    * 1: the name of the enclosing type where the setter is being looked for
    */
   static const CompileTimeErrorCode UNDEFINED_SUPER_SETTER =
-      CompileTimeErrorCode('UNDEFINED_SUPER_SETTER',
+      CompileTimeErrorCodeWithUniqueName(
+          'UNDEFINED_SUPER_MEMBER',
+          'UNDEFINED_SUPER_SETTER',
           "The setter '{0}' isn't defined in a superclass of '{1}'.",
           correction:
               "Try correcting the name to the name of an existing setter, or "
-              "defining a setter or field named '{0}' in a superclass.");
+              "defining a setter or field named '{0}' in a superclass.",
+          hasPublishedDocs: true);
 
   /**
    * 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does
diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md
index 25b95ee..8d007fc 100644
--- a/pkg/analyzer/tool/diagnostics/diagnostics.md
+++ b/pkg/analyzer/tool/diagnostics/diagnostics.md
@@ -7808,20 +7808,26 @@
 var x = min(0, 1);
 {% endprettify %}
 
-### undefined_super_method
+### undefined_super_member
+
+_The getter '{0}' isn't defined in a superclass of '{1}'._
 
 _The method '{0}' isn't defined in a superclass of '{1}'._
 
+_The operator '{0}' isn't defined in a superclass of '{1}'._
+
+_The setter '{0}' isn't defined in a superclass of '{1}'._
+
 #### Description
 
-The analyzer produces this diagnostic when an inherited method is
-referenced using `super`, but there’s no method with that name in the
+The analyzer produces this diagnostic when an inherited member is
+referenced using `super`, but there’s no member with that name in the
 superclass chain.
 
 #### Examples
 
 The following code produces this diagnostic because `Object` doesn't define
-a member named `n`:
+a method named `n`:
 
 {% prettify dart tag=pre+code %}
 class C {
@@ -7831,15 +7837,26 @@
 }
 {% endprettify %}
 
+The following code produces this diagnostic because `Object` doesn't define
+a getter named `g`:
+
+{% prettify dart tag=pre+code %}
+class C {
+  void m() {
+    super.[!g!];
+  }
+}
+{% endprettify %}
+
 #### Common fixes
 
-If the inherited method you intend to invoke has a different name, then
-make the name of the invoked method  match the inherited method.
+If the inherited member you intend to invoke has a different name, then
+make the name of the invoked member match the inherited member.
 
-If the method you intend to invoke is defined in the same class, then
+If the member you intend to invoke is defined in the same class, then
 remove the `super.`.
 
-If not, then either add the method to one of the superclasses or remove the
+If not, then either add the member to one of the superclasses or remove the
 invocation.
 
 ### unnecessary_cast
@@ -8525,3 +8542,7 @@
 
 void f(C<int> x) {}
 {% endprettify %}
+
+### undefined_super_method
+
+See [undefined_super_member](#undefined-super-member).
diff --git a/pkg/analyzer/tool/diagnostics/generate.dart b/pkg/analyzer/tool/diagnostics/generate.dart
index bc4fb24..59b6c0e 100644
--- a/pkg/analyzer/tool/diagnostics/generate.dart
+++ b/pkg/analyzer/tool/diagnostics/generate.dart
@@ -161,6 +161,7 @@
     _writeHeader(sink);
     _writeGlossary(sink);
     _writeDiagnostics(sink);
+    _writeForwards(sink);
   }
 
   /// Extract documentation from all of the files containing the definitions of
@@ -382,6 +383,17 @@
     }
   }
 
+  /// Write the forwarding documentation for all of the diagnostics that have
+  /// been renamed.
+  void _writeForwards(StringSink sink) {
+    sink.write('''
+
+### undefined_super_method
+
+See [undefined_super_member](#undefined-super-member).
+''');
+  }
+
   /// Write the glossary.
   void _writeGlossary(StringSink sink) {
     sink.write('''
diff --git a/tests/language/deferred/super_dependency_test.dart b/tests/language/deferred/super_dependency_test.dart
index 5879e56..cf5e811 100644
--- a/tests/language/deferred/super_dependency_test.dart
+++ b/tests/language/deferred/super_dependency_test.dart
@@ -8,7 +8,7 @@
 
 import "package:expect/expect.dart";
 //        ^^^
-// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_SETTER
+// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
 // [cfe] Superclass has no setter named 'foo'.
 import "super_dependency_lib.dart" deferred as lib;
 
diff --git a/tests/language/mixin/illegal_super_use_test.dart b/tests/language/mixin/illegal_super_use_test.dart
index ca47645..17e4fad 100644
--- a/tests/language/mixin/illegal_super_use_test.dart
+++ b/tests/language/mixin/illegal_super_use_test.dart
@@ -11,22 +11,22 @@
     super.toString();
     super.foo();
     //    ^^^
-    // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_METHOD
+    // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
     // [cfe] Superclass has no method named 'foo'.
     super.bar = 100;
     //    ^^^
-    // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_SETTER
+    // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
     // [cfe] Superclass has no setter named 'bar'.
 
     void inner() {
       super.toString();
       super.foo();
       //    ^^^
-      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_METHOD
+      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
       // [cfe] Superclass has no method named 'foo'.
       super.bar = 100;
       //    ^^^
-      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_SETTER
+      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
       // [cfe] Superclass has no setter named 'bar'.
     }
     inner();
@@ -35,11 +35,11 @@
       super.toString();
       super.foo();
       //    ^^^
-      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_METHOD
+      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
       // [cfe] Superclass has no method named 'foo'.
       super.bar = 100;
       //    ^^^
-      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_SETTER
+      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
       // [cfe] Superclass has no setter named 'bar'.
     })();
 
diff --git a/tests/language_2/deferred/super_dependency_test.dart b/tests/language_2/deferred/super_dependency_test.dart
index 5879e56..cf5e811 100644
--- a/tests/language_2/deferred/super_dependency_test.dart
+++ b/tests/language_2/deferred/super_dependency_test.dart
@@ -8,7 +8,7 @@
 
 import "package:expect/expect.dart";
 //        ^^^
-// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_SETTER
+// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
 // [cfe] Superclass has no setter named 'foo'.
 import "super_dependency_lib.dart" deferred as lib;
 
diff --git a/tests/language_2/mixin/illegal_super_use_test.dart b/tests/language_2/mixin/illegal_super_use_test.dart
index ca47645..17e4fad 100644
--- a/tests/language_2/mixin/illegal_super_use_test.dart
+++ b/tests/language_2/mixin/illegal_super_use_test.dart
@@ -11,22 +11,22 @@
     super.toString();
     super.foo();
     //    ^^^
-    // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_METHOD
+    // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
     // [cfe] Superclass has no method named 'foo'.
     super.bar = 100;
     //    ^^^
-    // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_SETTER
+    // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
     // [cfe] Superclass has no setter named 'bar'.
 
     void inner() {
       super.toString();
       super.foo();
       //    ^^^
-      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_METHOD
+      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
       // [cfe] Superclass has no method named 'foo'.
       super.bar = 100;
       //    ^^^
-      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_SETTER
+      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
       // [cfe] Superclass has no setter named 'bar'.
     }
     inner();
@@ -35,11 +35,11 @@
       super.toString();
       super.foo();
       //    ^^^
-      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_METHOD
+      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
       // [cfe] Superclass has no method named 'foo'.
       super.bar = 100;
       //    ^^^
-      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_SETTER
+      // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
       // [cfe] Superclass has no setter named 'bar'.
     })();