Issue 48728. Check ParenthesizedExpression(s) in _SwitchExhaustiveness.

Bug: https://github.com/dart-lang/sdk/issues/48728
Change-Id: Ie73f384c619bf90a502933d544e10b598b5c11cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239841
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 78180a7..29a2a01 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -3820,7 +3820,9 @@
   }
 
   static Element? _referencedElement(Expression expression) {
-    if (expression is PrefixedIdentifier) {
+    if (expression is ParenthesizedExpression) {
+      return _referencedElement(expression.expression);
+    } else if (expression is PrefixedIdentifier) {
       return expression.staticElement;
     } else if (expression is PropertyAccess) {
       return expression.propertyName.staticElement;
diff --git a/pkg/analyzer/test/src/diagnostics/body_might_complete_normally_test.dart b/pkg/analyzer/test/src/diagnostics/body_might_complete_normally_test.dart
index 973910e..aa935ec 100644
--- a/pkg/analyzer/test/src/diagnostics/body_might_complete_normally_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/body_might_complete_normally_test.dart
@@ -92,6 +92,21 @@
 ''');
   }
 
+  test_function_nonNullable_blockBody_switchStatement_notNullable_exhaustive_parenthesis() async {
+    await assertNoErrorsInCode(r'''
+enum Foo { a, b }
+
+int f(Foo foo) {
+  switch (foo) {
+    case (Foo.a):
+      return 0;
+    case (Foo.b):
+      return 1;
+  }
+}
+''');
+  }
+
   test_function_nonNullable_blockBody_switchStatement_notNullable_notExhaustive() async {
     await assertErrorsInCode(r'''
 enum Foo { a, b }