Stop using logicalOrPattern(), use or() instead.

Change-Id: I63db2c1a24c41b6c0a639a69802d23ad07d44621
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270600
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/_fe_analyzer_shared/test/mini_ast.dart b/pkg/_fe_analyzer_shared/test/mini_ast.dart
index 9d12bcc..af93edd 100644
--- a/pkg/_fe_analyzer_shared/test/mini_ast.dart
+++ b/pkg/_fe_analyzer_shared/test/mini_ast.dart
@@ -256,15 +256,6 @@
   return _LocalFunction(_Block(body, location: location), location: location);
 }
 
-Pattern logicalOrPattern(Pattern left, Pattern right, {String? errorId}) {
-  var location = computeLocation();
-  var result = _LogicalPattern(left, right, isAnd: false, location: location);
-  if (errorId != null) {
-    result.errorId = errorId;
-  }
-  return result;
-}
-
 Statement match(Pattern pattern, Expression initializer,
         {bool isLate = false, bool isFinal = false}) =>
     new _Declare(pattern, initializer,
diff --git a/pkg/_fe_analyzer_shared/test/type_inference/type_inference_test.dart b/pkg/_fe_analyzer_shared/test/type_inference/type_inference_test.dart
index 82c5327..4e00b63 100644
--- a/pkg/_fe_analyzer_shared/test/type_inference/type_inference_test.dart
+++ b/pkg/_fe_analyzer_shared/test/type_inference/type_inference_test.dart
@@ -699,10 +699,7 @@
                   expr('int'),
                   [
                     switchStatementMember([
-                      logicalOrPattern(
-                        x1.pattern(),
-                        x2.pattern(),
-                      ).switchCase,
+                      x1.pattern().or(x2.pattern()).switchCase,
                       x3.pattern().switchCase,
                     ], [
                       break_(),
@@ -1716,10 +1713,7 @@
               h.run([
                 ifCase(
                   expr('Object'),
-                  logicalOrPattern(
-                    x1.pattern(type: 'int'),
-                    x2.pattern(type: 'int'),
-                  ),
+                  x1.pattern(type: 'int').or(x2.pattern(type: 'int')),
                 ).checkIr('ifCase(expr(Object), logicalOrPattern(varPattern(x, '
                     'matchedType: Object, staticType: int), varPattern(x, '
                     'matchedType: Object, staticType: int), '
@@ -1733,10 +1727,9 @@
               h.run([
                 ifCase(
                   expr('Object'),
-                  logicalOrPattern(
-                    x1.pattern(type: 'Object'),
-                    x2.pattern(type: 'FutureOr<Object>'),
-                  ),
+                  x1
+                      .pattern(type: 'Object')
+                      .or(x2.pattern(type: 'FutureOr<Object>')),
                 ).checkIr('ifCase(expr(Object), logicalOrPattern(varPattern(x, '
                     'matchedType: Object, staticType: Object), varPattern(x, '
                     'matchedType: Object, staticType: FutureOr<Object>), '
@@ -1750,10 +1743,7 @@
               h.run([
                 ifCase(
                   expr('int'),
-                  logicalOrPattern(
-                    x1.pattern(type: 'int'),
-                    x2.pattern(),
-                  ),
+                  x1.pattern(type: 'int').or(x2.pattern()),
                 ).checkIr('ifCase(expr(int), logicalOrPattern(varPattern(x, '
                     'matchedType: int, staticType: int), varPattern(x, '
                     'matchedType: int, staticType: int), matchedType: int), '
@@ -1766,10 +1756,7 @@
               h.run([
                 ifCase(
                   expr('int'),
-                  logicalOrPattern(
-                    x1.pattern(),
-                    x2.pattern(type: 'int'),
-                  ),
+                  x1.pattern().or(x2.pattern(type: 'int')),
                 ).checkIr('ifCase(expr(int), logicalOrPattern(varPattern(x, '
                     'matchedType: int, staticType: int), varPattern(x, '
                     'matchedType: int, staticType: int), matchedType: int), '
@@ -1782,10 +1769,7 @@
               h.run([
                 ifCase(
                   expr('int'),
-                  logicalOrPattern(
-                    x1.pattern(),
-                    x2.pattern(),
-                  ),
+                  x1.pattern().or(x2.pattern()),
                 ).checkIr('ifCase(expr(int), logicalOrPattern(varPattern(x, '
                     'matchedType: int, staticType: int), varPattern(x, '
                     'matchedType: int, staticType: int), matchedType: int), '
@@ -1800,10 +1784,7 @@
               h.run([
                 ifCase(
                   expr('Object'),
-                  logicalOrPattern(
-                    x1.pattern(type: 'int'),
-                    x2.pattern(type: 'num'),
-                  ),
+                  x1.pattern(type: 'int').or(x2.pattern(type: 'num')),
                 ).checkIr('ifCase(expr(Object), logicalOrPattern(varPattern(x, '
                     'matchedType: Object, staticType: int), varPattern(x, '
                     'matchedType: Object, staticType: num), matchedType: '
@@ -1820,10 +1801,7 @@
               h.run([
                 ifCase(
                   expr('num'),
-                  logicalOrPattern(
-                    x1.pattern(type: 'int'),
-                    x2.pattern(),
-                  ),
+                  x1.pattern(type: 'int').or(x2.pattern()),
                 ).checkIr('ifCase(expr(num), logicalOrPattern(varPattern(x, '
                     'matchedType: num, staticType: int), varPattern(x, '
                     'matchedType: num, staticType: num), matchedType: num), '
@@ -1842,10 +1820,7 @@
           h.run([
             ifCase(
               expr('int'),
-              logicalOrPattern(
-                x1.pattern(),
-                x2.pattern(),
-              ),
+              x1.pattern().or(x2.pattern()),
             ).checkIr('ifCase(expr(int), logicalOrPattern(varPattern(x, '
                 'matchedType: int, staticType: int), varPattern(x, '
                 'matchedType: int, staticType: int), matchedType: int), '
@@ -1863,10 +1838,7 @@
             h.run([
               ifCase(
                 expr('int'),
-                logicalOrPattern(
-                  x1.pattern(),
-                  x2.pattern(),
-                ),
+                x1.pattern().or(x2.pattern()),
               ).checkIr('ifCase(expr(int), logicalOrPattern(varPattern(x, '
                   'matchedType: int, staticType: int), varPattern(x, '
                   'matchedType: int, staticType: int), matchedType: int), '
@@ -1878,11 +1850,7 @@
             h.run([
               ifCase(
                 expr('int'),
-                logicalOrPattern(
-                  x1.pattern(),
-                  wildcard(),
-                  errorId: 'PATTERN',
-                ),
+                (x1.pattern().or(wildcard()))..errorId = 'PATTERN',
               ).checkIr('ifCase(expr(int), logicalOrPattern(varPattern(x, '
                   'matchedType: int, staticType: int), varPattern(_, '
                   'matchedType: int, staticType: int), matchedType: int), '
@@ -1898,11 +1866,7 @@
             h.run([
               ifCase(
                 expr('int'),
-                logicalOrPattern(
-                  wildcard(),
-                  x1.pattern(),
-                  errorId: 'PATTERN',
-                ),
+                (wildcard().or(x1.pattern()))..errorId = 'PATTERN',
               ).checkIr('ifCase(expr(int), logicalOrPattern(varPattern(_, '
                   'matchedType: int, staticType: int), varPattern(x, '
                   'matchedType: int, staticType: int), matchedType: int), '