You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/expr/unary/if_expr.swift
+15-3Lines changed: 15 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -557,14 +557,26 @@ func stmts() {
557
557
return
558
558
}
559
559
560
-
switchif.random(){true}else{false}{ // expected-error {{'if' may only be used as expression in return, throw, or as the source of an assignment}}
561
-
case _ whereif.random(){true}else{false}: // expected-error {{'if' may only be used as expression in return, throw, or as the source of an assignment}}
560
+
switchif.random(){true}else{false}{
561
+
// expected-error@-1 {{'if' may only be used as expression in return, throw, or as the source of an assignment}}
562
+
case _ whereif.random(){true}else{false}:
563
+
// expected-error@-1 {{'if' may only be used as expression in return, throw, or as the source of an assignment}}
564
+
break
565
+
caseif.random(){true}else{false}:
566
+
// expected-error@-1 {{'if' may only be used as expression in return, throw, or as the source of an assignment}}
567
+
break
568
+
caseif.random(){true}else{false} && false:
569
+
// expected-error@-1 {{'if' may only be used as expression in return, throw, or as the source of an assignment}}
562
570
break
563
571
default:
564
572
break
565
573
}
566
574
567
-
forbin[true]whereif b {true}else{false}{} // expected-error {{'if' may only be used as expression in return, throw, or as the source of an assignment}}
575
+
forbin[true]whereif b {true}else{false}{}
576
+
// expected-error@-1 {{'if' may only be used as expression in return, throw, or as the source of an assignment}}
577
+
578
+
for_inif.random(){[true]}else{[false]}{}
579
+
// expected-error@-1 {{'if' may only be used as expression in return, throw, or as the source of an assignment}}
568
580
569
581
// Make sure this doesn't parse as an if expr pattern with a label.
0 commit comments