File tree Expand file tree Collapse file tree 2 files changed +26
-8
lines changed
test/refactoring/ConvertAsync Expand file tree Collapse file tree 2 files changed +26
-8
lines changed Original file line number Diff line number Diff line change @@ -1563,13 +1563,6 @@ Stmt *Traversal::visitForEachStmt(ForEachStmt *S) {
1563
1563
return nullptr ;
1564
1564
}
1565
1565
1566
- if (Expr *Where = S->getWhere ()) {
1567
- if ((Where = doIt (Where)))
1568
- S->setWhere (Where);
1569
- else
1570
- return nullptr ;
1571
- }
1572
-
1573
1566
// The iterator decl is built directly on top of the sequence
1574
1567
// expression, so don't visit both.
1575
1568
if (Expr *Sequence = S->getSequence ()) {
@@ -1579,6 +1572,13 @@ Stmt *Traversal::visitForEachStmt(ForEachStmt *S) {
1579
1572
return nullptr ;
1580
1573
}
1581
1574
1575
+ if (Expr *Where = S->getWhere ()) {
1576
+ if ((Where = doIt (Where)))
1577
+ S->setWhere (Where);
1578
+ else
1579
+ return nullptr ;
1580
+ }
1581
+
1582
1582
if (auto IteratorNext = S->getConvertElementExpr ()) {
1583
1583
if ((IteratorNext = doIt (IteratorNext)))
1584
1584
S->setConvertElementExpr (IteratorNext);
Original file line number Diff line number Diff line change @@ -855,4 +855,22 @@ class TestConvertFunctionWithCallToFunctionsWithSpecialName {
855
855
_ = x [ 1 ]
856
856
return x
857
857
}
858
- }
858
+ }
859
+
860
+ // rdar://78781061
861
+ // RUN: %refactor -convert-to-async -dump-text -source-filename %s -pos=%(line+1):1 | %FileCheck -check-prefix=FOR-IN-WHERE %s
862
+ func testForInWhereRefactoring( ) {
863
+ let arr : [ String ] = [ ]
864
+ for str in arr where str. count != 0 {
865
+ simple { res in
866
+ print ( res)
867
+ }
868
+ }
869
+ }
870
+ // FOR-IN-WHERE: func testForInWhereRefactoring() async {
871
+ // FOR-IN-WHERE-NEXT: let arr: [String] = []
872
+ // FOR-IN-WHERE-NEXT: for str in arr where str.count != 0 {
873
+ // FOR-IN-WHERE-NEXT: let res = await simple()
874
+ // FOR-IN-WHERE-NEXT: print(res)
875
+ // FOR-IN-WHERE-NEXT: }
876
+ // FOR-IN-WHERE-NEXT: }
You can’t perform that action at this time.
0 commit comments