Check for '!' operator when report HintCode.NULL_CHECK_ALWAYS_FAILS

Follow up for:
https://dart-review.googlesource.com/c/sdk/+/170122

Change-Id: If9b3cb1a18ecd7cf21149dbd0fda4ec209506b90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/error/best_practices_verifier.dart b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
index 0e76c61..5ee814d 100644
--- a/pkg/analyzer/lib/src/error/best_practices_verifier.dart
+++ b/pkg/analyzer/lib/src/error/best_practices_verifier.dart
@@ -613,7 +613,8 @@
   @override
   void visitPostfixExpression(PostfixExpression node) {
     _deprecatedVerifier.postfixExpression(node);
-    if (node.operand.staticType?.isDartCoreNull ?? false) {
+    if (node.operator.type == TokenType.BANG &&
+        node.operand.staticType.isDartCoreNull) {
       _errorReporter.reportErrorForNode(HintCode.NULL_CHECK_ALWAYS_FAILS, node);
     }
     super.visitPostfixExpression(node);
diff --git a/pkg/analyzer/test/src/diagnostics/null_check_always_fails_test.dart b/pkg/analyzer/test/src/diagnostics/null_check_always_fails_test.dart
index e21d37c..ce1298b 100644
--- a/pkg/analyzer/test/src/diagnostics/null_check_always_fails_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/null_check_always_fails_test.dart
@@ -37,10 +37,10 @@
   test_nullLiteral_parenthesized() async {
     await assertErrorsInCode(r'''
 void f() {
-  null!;
+  (null)!;
 }
 ''', [
-      error(HintCode.NULL_CHECK_ALWAYS_FAILS, 13, 5),
+      error(HintCode.NULL_CHECK_ALWAYS_FAILS, 13, 7),
     ]);
   }