[analyzer] Move two more Hints to be Warnings, UNDEFINED_*

Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: Ifa01985beba01298addacf58b576b049ce0918f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279322
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
index d59e50c..bda50d8 100644
--- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
+++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
@@ -1589,14 +1589,10 @@
   status: hasFix
 HintCode.TYPE_CHECK_IS_NULL:
   status: hasFix
-HintCode.UNDEFINED_HIDDEN_NAME:
-  status: hasFix
 HintCode.UNDEFINED_REFERENCED_PARAMETER:
   status: needsFix
   notes: |-
     Can try to find the correct parameter name.
-HintCode.UNDEFINED_SHOWN_NAME:
-  status: hasFix
 HintCode.UNIGNORABLE_IGNORE:
   status: needsFix
   notes: |-
@@ -2788,3 +2784,7 @@
 WarningCode.SDK_VERSION_UI_AS_CODE_IN_CONST_CONTEXT:
   status: noFix
   notes: Deprecated
+WarningCode.UNDEFINED_HIDDEN_NAME:
+  status: hasFix
+WarningCode.UNDEFINED_SHOWN_NAME:
+  status: hasFix
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index cfd72ad..d911c3a 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -1436,12 +1436,6 @@
     HintCode.TYPE_CHECK_IS_NULL: [
       UseEqEqNull.new,
     ],
-    HintCode.UNDEFINED_HIDDEN_NAME: [
-      RemoveNameFromCombinator.new,
-    ],
-    HintCode.UNDEFINED_SHOWN_NAME: [
-      RemoveNameFromCombinator.new,
-    ],
     HintCode.UNNECESSARY_CAST: [
       RemoveUnnecessaryCast.new,
     ],
@@ -1591,6 +1585,12 @@
     WarningCode.SDK_VERSION_UI_AS_CODE: [
       UpdateSdkConstraints.version_2_2_2,
     ],
+    WarningCode.UNDEFINED_HIDDEN_NAME: [
+      RemoveNameFromCombinator.new,
+    ],
+    WarningCode.UNDEFINED_SHOWN_NAME: [
+      RemoveNameFromCombinator.new,
+    ],
   };
 
   final DartFixContext fixContext;
diff --git a/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart b/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
index cb928d1..b05a95b 100644
--- a/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
+++ b/pkg/analyzer/lib/src/dart/error/hint_codes.g.dart
@@ -1025,16 +1025,6 @@
   );
 
   ///  Parameters:
-  ///  0: the name of the library being imported
-  ///  1: the name in the hide clause that isn't defined in the library
-  static const HintCode UNDEFINED_HIDDEN_NAME = HintCode(
-    'UNDEFINED_HIDDEN_NAME',
-    "The library '{0}' doesn't export a member with the hidden name '{1}'.",
-    correctionMessage: "Try removing the name from the list of hidden members.",
-    hasPublishedDocs: true,
-  );
-
-  ///  Parameters:
   ///  0: the name of the undefined parameter
   ///  1: the name of the targeted member
   static const HintCode UNDEFINED_REFERENCED_PARAMETER = HintCode(
@@ -1044,16 +1034,6 @@
   );
 
   ///  Parameters:
-  ///  0: the name of the library being imported
-  ///  1: the name in the show clause that isn't defined in the library
-  static const HintCode UNDEFINED_SHOWN_NAME = HintCode(
-    'UNDEFINED_SHOWN_NAME',
-    "The library '{0}' doesn't export a member with the shown name '{1}'.",
-    correctionMessage: "Try removing the name from the list of shown members.",
-    hasPublishedDocs: true,
-  );
-
-  ///  Parameters:
   ///  0: the name of the non-diagnostic being ignored
   static const HintCode UNIGNORABLE_IGNORE = HintCode(
     'UNIGNORABLE_IGNORE',
diff --git a/pkg/analyzer/lib/src/error/codes.g.dart b/pkg/analyzer/lib/src/error/codes.g.dart
index fff53af..cedf870 100644
--- a/pkg/analyzer/lib/src/error/codes.g.dart
+++ b/pkg/analyzer/lib/src/error/codes.g.dart
@@ -5837,6 +5837,26 @@
     hasPublishedDocs: true,
   );
 
+  ///  Parameters:
+  ///  0: the name of the library being imported
+  ///  1: the name in the hide clause that isn't defined in the library
+  static const WarningCode UNDEFINED_HIDDEN_NAME = WarningCode(
+    'UNDEFINED_HIDDEN_NAME',
+    "The library '{0}' doesn't export a member with the hidden name '{1}'.",
+    correctionMessage: "Try removing the name from the list of hidden members.",
+    hasPublishedDocs: true,
+  );
+
+  ///  Parameters:
+  ///  0: the name of the library being imported
+  ///  1: the name in the show clause that isn't defined in the library
+  static const WarningCode UNDEFINED_SHOWN_NAME = WarningCode(
+    'UNDEFINED_SHOWN_NAME',
+    "The library '{0}' doesn't export a member with the shown name '{1}'.",
+    correctionMessage: "Try removing the name from the list of shown members.",
+    hasPublishedDocs: true,
+  );
+
   /// Initialize a newly created error code to have the given [name].
   const WarningCode(
     String name,
diff --git a/pkg/analyzer/lib/src/error/dead_code_verifier.dart b/pkg/analyzer/lib/src/error/dead_code_verifier.dart
index 19c161b..9e86d95 100644
--- a/pkg/analyzer/lib/src/error/dead_code_verifier.dart
+++ b/pkg/analyzer/lib/src/error/dead_code_verifier.dart
@@ -105,10 +105,10 @@
     ErrorCode hintCode;
     if (combinator is HideCombinator) {
       names = combinator.hiddenNames;
-      hintCode = HintCode.UNDEFINED_HIDDEN_NAME;
+      hintCode = WarningCode.UNDEFINED_HIDDEN_NAME;
     } else {
       names = (combinator as ShowCombinator).shownNames;
-      hintCode = HintCode.UNDEFINED_SHOWN_NAME;
+      hintCode = WarningCode.UNDEFINED_SHOWN_NAME;
     }
     for (SimpleIdentifier name in names) {
       String nameStr = name.name;
diff --git a/pkg/analyzer/lib/src/error/error_code_values.g.dart b/pkg/analyzer/lib/src/error/error_code_values.g.dart
index 1368609..c045044 100644
--- a/pkg/analyzer/lib/src/error/error_code_values.g.dart
+++ b/pkg/analyzer/lib/src/error/error_code_values.g.dart
@@ -655,9 +655,7 @@
   HintCode.TEXT_DIRECTION_CODE_POINT_IN_LITERAL,
   HintCode.TYPE_CHECK_IS_NOT_NULL,
   HintCode.TYPE_CHECK_IS_NULL,
-  HintCode.UNDEFINED_HIDDEN_NAME,
   HintCode.UNDEFINED_REFERENCED_PARAMETER,
-  HintCode.UNDEFINED_SHOWN_NAME,
   HintCode.UNIGNORABLE_IGNORE,
   HintCode.UNNECESSARY_CAST,
   HintCode.UNNECESSARY_FINAL,
@@ -984,4 +982,6 @@
   WarningCode.SDK_VERSION_SET_LITERAL,
   WarningCode.SDK_VERSION_UI_AS_CODE,
   WarningCode.SDK_VERSION_UI_AS_CODE_IN_CONST_CONTEXT,
+  WarningCode.UNDEFINED_HIDDEN_NAME,
+  WarningCode.UNDEFINED_SHOWN_NAME,
 ];
diff --git a/pkg/analyzer/messages.yaml b/pkg/analyzer/messages.yaml
index 1c14b186..9b26fb4 100644
--- a/pkg/analyzer/messages.yaml
+++ b/pkg/analyzer/messages.yaml
@@ -20226,41 +20226,6 @@
     correctionMessage: "Try replacing the 'is Null' check with '== null'."
     hasPublishedDocs: true
     comment: No parameters.
-  UNDEFINED_HIDDEN_NAME:
-    problemMessage: "The library '{0}' doesn't export a member with the hidden name '{1}'."
-    correctionMessage: Try removing the name from the list of hidden members.
-    hasPublishedDocs: true
-    comment: |-
-      Parameters:
-      0: the name of the library being imported
-      1: the name in the hide clause that isn't defined in the library
-    documentation: |-
-      #### Description
-
-      The analyzer produces this diagnostic when a hide combinator includes a
-      name that isn't defined by the library being imported.
-
-      #### Example
-
-      The following code produces this diagnostic because `dart:math` doesn't
-      define the name `String`:
-
-      ```dart
-      import 'dart:math' hide [!String!], max;
-
-      var x = min(0, 1);
-      ```
-
-      #### Common fixes
-
-      If a different name should be hidden, then correct the name. Otherwise,
-      remove the name from the list:
-
-      ```dart
-      import 'dart:math' hide max;
-
-      var x = min(0, 1);
-      ```
   UNDEFINED_REFERENCED_PARAMETER:
     problemMessage: "The parameter '{0}' isn't defined by '{1}'."
     hasPublishedDocs: true
@@ -20298,41 +20263,6 @@
       @UseResult.unless(parameterDefined: 'a')
       int f([int? a]) => a ?? 0;
       ```
-  UNDEFINED_SHOWN_NAME:
-    problemMessage: "The library '{0}' doesn't export a member with the shown name '{1}'."
-    correctionMessage: Try removing the name from the list of shown members.
-    hasPublishedDocs: true
-    comment: |-
-      Parameters:
-      0: the name of the library being imported
-      1: the name in the show clause that isn't defined in the library
-    documentation: |-
-      #### Description
-
-      The analyzer produces this diagnostic when a show combinator includes a
-      name that isn't defined by the library being imported.
-
-      #### Example
-
-      The following code produces this diagnostic because `dart:math` doesn't
-      define the name `String`:
-
-      ```dart
-      import 'dart:math' show min, [!String!];
-
-      var x = min(0, 1);
-      ```
-
-      #### Common fixes
-
-      If a different name should be shown, then correct the name. Otherwise,
-      remove the name from the list:
-
-      ```dart
-      import 'dart:math' show min;
-
-      var x = min(0, 1);
-      ```
   UNIGNORABLE_IGNORE:
     problemMessage: "The diagnostic '{0}' can't be ignored."
     correctionMessage: Try removing the name from the list, or removing the whole comment if this is the only name in the list.
@@ -23512,3 +23442,73 @@
       const a = [1, 2];
       var b = [...a];
       ```
+  UNDEFINED_HIDDEN_NAME:
+    problemMessage: "The library '{0}' doesn't export a member with the hidden name '{1}'."
+    correctionMessage: Try removing the name from the list of hidden members.
+    hasPublishedDocs: true
+    comment: |-
+      Parameters:
+      0: the name of the library being imported
+      1: the name in the hide clause that isn't defined in the library
+    documentation: |-
+      #### Description
+
+      The analyzer produces this diagnostic when a hide combinator includes a
+      name that isn't defined by the library being imported.
+
+      #### Example
+
+      The following code produces this diagnostic because `dart:math` doesn't
+      define the name `String`:
+
+      ```dart
+      import 'dart:math' hide [!String!], max;
+
+      var x = min(0, 1);
+      ```
+
+      #### Common fixes
+
+      If a different name should be hidden, then correct the name. Otherwise,
+      remove the name from the list:
+
+      ```dart
+      import 'dart:math' hide max;
+
+      var x = min(0, 1);
+      ```
+  UNDEFINED_SHOWN_NAME:
+    problemMessage: "The library '{0}' doesn't export a member with the shown name '{1}'."
+    correctionMessage: Try removing the name from the list of shown members.
+    hasPublishedDocs: true
+    comment: |-
+      Parameters:
+      0: the name of the library being imported
+      1: the name in the show clause that isn't defined in the library
+    documentation: |-
+      #### Description
+
+      The analyzer produces this diagnostic when a show combinator includes a
+      name that isn't defined by the library being imported.
+
+      #### Example
+
+      The following code produces this diagnostic because `dart:math` doesn't
+      define the name `String`:
+
+      ```dart
+      import 'dart:math' show min, [!String!];
+
+      var x = min(0, 1);
+      ```
+
+      #### Common fixes
+
+      If a different name should be shown, then correct the name. Otherwise,
+      remove the name from the list:
+
+      ```dart
+      import 'dart:math' show min;
+
+      var x = min(0, 1);
+      ```
\ No newline at end of file
diff --git a/pkg/analyzer/test/src/diagnostics/undefined_hidden_name_test.dart b/pkg/analyzer/test/src/diagnostics/undefined_hidden_name_test.dart
index e784169..066159a 100644
--- a/pkg/analyzer/test/src/diagnostics/undefined_hidden_name_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/undefined_hidden_name_test.dart
@@ -24,7 +24,7 @@
     await assertErrorsInCode(r'''
 export 'lib1.dart' hide a;
 ''', [
-      error(HintCode.UNDEFINED_HIDDEN_NAME, 24, 1),
+      error(WarningCode.UNDEFINED_HIDDEN_NAME, 24, 1),
     ]);
   }
 
@@ -34,7 +34,7 @@
 import 'lib1.dart' hide a;
 ''', [
       error(HintCode.UNUSED_IMPORT, 7, 11),
-      error(HintCode.UNDEFINED_HIDDEN_NAME, 24, 1),
+      error(WarningCode.UNDEFINED_HIDDEN_NAME, 24, 1),
     ]);
   }
 }
diff --git a/pkg/analyzer/test/src/diagnostics/undefined_shown_name_test.dart b/pkg/analyzer/test/src/diagnostics/undefined_shown_name_test.dart
index 8dd50a6..187b603 100644
--- a/pkg/analyzer/test/src/diagnostics/undefined_shown_name_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/undefined_shown_name_test.dart
@@ -24,7 +24,7 @@
     await assertErrorsInCode(r'''
 export 'lib1.dart' show a;
 ''', [
-      error(HintCode.UNDEFINED_SHOWN_NAME, 24, 1),
+      error(WarningCode.UNDEFINED_SHOWN_NAME, 24, 1),
     ]);
   }
 
@@ -34,7 +34,7 @@
 import 'lib1.dart' show a;
 ''', [
       error(HintCode.UNUSED_IMPORT, 7, 11),
-      error(HintCode.UNDEFINED_SHOWN_NAME, 24, 1),
+      error(WarningCode.UNDEFINED_SHOWN_NAME, 24, 1),
     ]);
   }
 }
diff --git a/pkg/analyzer/test/src/diagnostics/unused_shown_name_test.dart b/pkg/analyzer/test/src/diagnostics/unused_shown_name_test.dart
index e26c77c..3dfbaaa 100644
--- a/pkg/analyzer/test/src/diagnostics/unused_shown_name_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/unused_shown_name_test.dart
@@ -152,7 +152,7 @@
   print(max(1, 2));
 }
 ''', [
-      error(HintCode.UNDEFINED_SHOWN_NAME, 29, 6),
+      error(WarningCode.UNDEFINED_SHOWN_NAME, 29, 6),
     ]);
   }