Rename another diagnostic code

The diagnostic applies to both the if-null expression ('??') and the
compound assignment expression ('??='), so it seems like the name should
be more general.

Change-Id: I004cc2924ef97fcbd2168f070380ff17152cbb0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136903
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index d049932..a3cd1ef 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -721,7 +721,7 @@
   StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER,
   // ignore: deprecated_member_use_from_same_package
   StaticWarningCode.CONST_WITH_ABSTRACT_CLASS,
-  StaticWarningCode.DEAD_NULL_COALESCE,
+  StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION,
   StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAMED,
   // ignore: deprecated_member_use_from_same_package
   StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS,
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 5f8e409..b338046 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -7745,9 +7745,11 @@
   /**
    * It is a warning to use null aware operators '??' or '??=' on an
    * expression of type `T` if `T` is strictly non-nullable.
+   *
+   * No parameters.
    */
-  static const StaticWarningCode DEAD_NULL_COALESCE = StaticWarningCode(
-      'DEAD_NULL_COALESCE',
+  static const StaticWarningCode DEAD_NULL_AWARE_EXPRESSION = StaticWarningCode(
+      'DEAD_NULL_AWARE_EXPRESSION',
       "The left operand can't be null, so the right operand is never executed.",
       correction: "Try removing the right operand.",
       errorSeverity: ErrorSeverity.WARNING);
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index d9298cb..255ce42 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -2308,7 +2308,7 @@
 
     if (_typeSystem.isStrictlyNonNullable(lhsType)) {
       _errorReporter.reportErrorForNode(
-        StaticWarningCode.DEAD_NULL_COALESCE,
+        StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION,
         rhs,
       );
     }
diff --git a/pkg/analyzer/test/src/diagnostics/dead_null_coalesce_test.dart b/pkg/analyzer/test/src/diagnostics/dead_null_aware_expression_test.dart
similarity index 88%
rename from pkg/analyzer/test/src/diagnostics/dead_null_coalesce_test.dart
rename to pkg/analyzer/test/src/diagnostics/dead_null_aware_expression_test.dart
index af9445e..939300f 100644
--- a/pkg/analyzer/test/src/diagnostics/dead_null_coalesce_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/dead_null_aware_expression_test.dart
@@ -12,12 +12,12 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(DeadNullCoalesceTest);
+    defineReflectiveTests(DeadNullAwareExpressionTest);
   });
 }
 
 @reflectiveTest
-class DeadNullCoalesceTest extends DriverResolutionTest {
+class DeadNullAwareExpressionTest extends DriverResolutionTest {
   @override
   AnalysisOptionsImpl get analysisOptions => AnalysisOptionsImpl()
     ..contextFeatures = FeatureSet.fromEnableFlags(
@@ -58,7 +58,7 @@
   x ??= 0;
 }
 ''', [
-      error(StaticWarningCode.DEAD_NULL_COALESCE, 19, 1),
+      error(StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION, 19, 1),
     ]);
   }
 
@@ -91,7 +91,7 @@
   x ?? 0;
 }
 ''', [
-      error(StaticWarningCode.DEAD_NULL_COALESCE, 18, 1),
+      error(StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION, 18, 1),
     ]);
   }
 
diff --git a/pkg/analyzer/test/src/diagnostics/not_assigned_potentially_non_nullable_local_variable_test.dart b/pkg/analyzer/test/src/diagnostics/not_assigned_potentially_non_nullable_local_variable_test.dart
index 5aadc08..9a758ed 100644
--- a/pkg/analyzer/test/src/diagnostics/not_assigned_potentially_non_nullable_local_variable_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/not_assigned_potentially_non_nullable_local_variable_test.dart
@@ -93,7 +93,7 @@
 }
 ''', [
       _notAssignedError(22, 1),
-      error(StaticWarningCode.DEAD_NULL_COALESCE, 28, 1),
+      error(StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION, 28, 1),
     ]);
   }
 
@@ -105,7 +105,7 @@
 }
 ''', [
       _notAssignedError(22, 1),
-      error(StaticWarningCode.DEAD_NULL_COALESCE, 28, 1),
+      error(StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION, 28, 1),
       _notAssignedError(28, 1),
     ]);
   }
@@ -127,7 +127,7 @@
   (v = 0) ?? 0;
   v;
 }
-''', [error(StaticWarningCode.DEAD_NULL_COALESCE, 33, 1)]);
+''', [error(StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION, 33, 1)]);
   }
 
   test_binaryExpression_ifNull_right() async {
@@ -138,7 +138,7 @@
   v;
 }
 ''', [
-      error(StaticWarningCode.DEAD_NULL_COALESCE, 32, 7),
+      error(StaticWarningCode.DEAD_NULL_AWARE_EXPRESSION, 32, 7),
       _notAssignedError(43, 1),
     ]);
   }
diff --git a/pkg/analyzer/test/src/diagnostics/test_all.dart b/pkg/analyzer/test/src/diagnostics/test_all.dart
index a7e52f3..302a5aa 100644
--- a/pkg/analyzer/test/src/diagnostics/test_all.dart
+++ b/pkg/analyzer/test/src/diagnostics/test_all.dart
@@ -57,7 +57,7 @@
     as const_spread_expected_list_or_set;
 import 'const_spread_expected_map_test.dart' as const_spread_expected_map;
 import 'dead_code_test.dart' as dead_code;
-import 'dead_null_coalesce_test.dart' as dead_null_coalesce;
+import 'dead_null_aware_expression_test.dart' as dead_null_aware_expression;
 import 'default_list_constructor_mismatch_test.dart'
     as default_list_constructor_mismatch;
 import 'default_value_in_function_type_test.dart'
@@ -539,7 +539,7 @@
     const_spread_expected_list_or_set.main();
     const_spread_expected_map.main();
     dead_code.main();
-    dead_null_coalesce.main();
+    dead_null_aware_expression.main();
     default_list_constructor_mismatch.main();
     default_value_in_function_type.main();
     default_value_in_function_typed_parameter.main();
diff --git a/pkg/dev_compiler/tool/dart2js_nnbd_sdk_error_golden.txt b/pkg/dev_compiler/tool/dart2js_nnbd_sdk_error_golden.txt
index 40c7901..f1efc3d 100644
--- a/pkg/dev_compiler/tool/dart2js_nnbd_sdk_error_golden.txt
+++ b/pkg/dev_compiler/tool/dart2js_nnbd_sdk_error_golden.txt
@@ -11,8 +11,8 @@
 ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1659|17|1|The operator '&' isn't defined for the type 'JSInt'.
 ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1664|18|1|The operator '&' isn't defined for the type 'JSInt'.
 ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1664|44|1|The operator '&' isn't defined for the type 'JSInt'.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|1476|39|5|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|8384|60|5|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|9311|54|5|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/developer/developer.dart|315|25|23|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/io/io.dart|9167|16|1|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|1476|39|5|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|8384|60|5|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|9311|54|5|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/developer/developer.dart|332|25|23|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/io/io.dart|9167|16|1|The left operand can't be null, so the right operand is never executed.
diff --git a/pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt b/pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt
index f318a44..0dee66c 100644
--- a/pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt
+++ b/pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt
@@ -15,9 +15,9 @@
 ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|221|8|37|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
 ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|224|8|11|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
 ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|228|6|11|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|1476|39|5|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|8384|60|5|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/_http/http.dart|9311|54|5|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/collection/collection.dart|1076|46|13|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/developer/developer.dart|332|25|23|The left operand can't be null, so the right operand is never executed.
-WARNING|STATIC_WARNING|DEAD_NULL_COALESCE|lib/io/io.dart|9167|16|1|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|1476|39|5|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|8384|60|5|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/_http/http.dart|9311|54|5|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/collection/collection.dart|1076|46|13|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/developer/developer.dart|332|25|23|The left operand can't be null, so the right operand is never executed.
+WARNING|STATIC_WARNING|DEAD_NULL_AWARE_EXPRESSION|lib/io/io.dart|9167|16|1|The left operand can't be null, so the right operand is never executed.