Skip to content

Commit 012675b

Browse files
committed
[6.2] Cherry-pick "[test] Bring back accidentally deleted test case in..."
...#81280. The deleted test was `test/FixCode/fixits-if-else.swift`. Resurrect it in a better place and switch it to the diagnostic verifier, as it was intended to along with other moved tests in that PR. (cherry picked from commit 8928b53)
1 parent 1533be2 commit 012675b

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

test/Parse/if-else-invalid.swift

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// RUN: %target-swift-frontend -parse -verify %s
2+
3+
// No more diags expected during Sema.
4+
// RUN: %target-typecheck-verify-swift
5+
6+
do {
7+
func something() -> Bool {}
8+
func foo() {}
9+
10+
do {
11+
if something() {
12+
// expected-error@+1:11 {{expected '{' or 'if' after 'else'}}{{none}}
13+
} else
14+
}
15+
16+
do {
17+
if something() {
18+
// expected-error@+1:11 {{expected '{' or 'if' after 'else'}}{{none}}
19+
} else
20+
foo()
21+
}
22+
23+
do {
24+
if something() {
25+
// expected-error@+1:7 {{expected '{' or 'if' after 'else'; did you mean to write 'if'?}}{{11-11= if}}
26+
} else something() { // Fix-it because all on one line.
27+
}
28+
}
29+
30+
do {
31+
if something() {
32+
// expected-error@+1:12 {{expected '{' or 'if' after 'else'}}{{none}}
33+
} else something()
34+
{
35+
}
36+
}
37+
38+
do {
39+
if something() {
40+
// expected-error@+1:12 {{expected '{' or 'if' after 'else'}}{{none}}
41+
} else something()
42+
foo1()
43+
}
44+
}

0 commit comments

Comments
 (0)