Skip to content

Commit 0ce9f75

Browse files
committed
update test
1 parent d95fbf9 commit 0ce9f75

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

lib/Sema/TypeCheckSwitchStmt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ namespace {
940940
}
941941

942942
Ctx.Diags.diagnose(StartLoc, diag::non_exhaustive_switch);
943-
Ctx.Diags.diagnose(EndLoc, diag::missing_several_cases, false)
943+
Ctx.Diags.diagnose(StartLoc, diag::missing_several_cases, false)
944944
.fixItInsert(EndLoc, Buffer.str());
945945
} else {
946946
Ctx.Diags.diagnose(StartLoc, diag::non_exhaustive_switch);

test/stmt/switch_stmt_editor1.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ enum E {
66
}
77

88
func foo1(e : E, i : Int) {
9-
switch e {} // expected-error{{do you want to add missing cases?}}{{13-13=case .e1: <#code#>\ncase .e2: <#code#>\n}}
10-
switch i {} // expected-error{{do you want to add a default case?}}{{13-13=default: <#code#>\n}}
9+
switch e {} // expected-error{{switch must be exhaustive}}
10+
// expected-note@-1{{do you want to add missing cases?}}{{13-13=case .e1: <#code#>\ncase .e2: <#code#>\n}}
11+
switch i {} // expected-error{{'switch' statement body must have at least one 'case' or 'default' block; do you want to add a default case?}}{{13-13=default: <#code#>\n}}
1112
}

test/stmt/switch_stmt_editor2.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ enum E {
66
}
77

88
func foo1(e : E) {
9-
switch e { // expected-error{{do you want to add missing cases?}}{{3-3=case .e2: <#code#>\n}}
9+
switch e { // expected-error{{switch must be exhaustive}}
10+
// expected-note@-1{{do you want to add missing cases?}}{{3-3=case .e2: <#code#>\n}}
1011
case .e1: return
1112
}
1213
}
1314

1415
func foo2(i : Int) {
15-
switch i { // expected-error{{do you want to add a default clause?}}{{3-3=default: <#code#>\n}}
16+
switch i { // expected-error{{switch must be exhaustive}}
17+
// expected-note@-1{{do you want to add a default clause?}}{{3-3=default: <#code#>\n}}
1618
case 1: return
1719
}
1820
}

0 commit comments

Comments
 (0)