@@ -368,6 +368,7 @@ func checkDiagnosticMinimality(x: Runcible?) {
368
368
// expected-note@-1 {{add missing case: '(.fork, _)'}}
369
369
// expected-note@-2 {{add missing case: '(.hat, .hat)'}}
370
370
// expected-note@-3 {{add missing case: '(_, .fork)'}}
371
+ // expected-note@-4 {{add missing cases}} {{+11:3-3=case (.fork, _):\n<#code#>\ncase (.hat, .hat):\n<#code#>\ncase (_, .fork):\n<#code#>\n}}
371
372
case ( . spoon, . spoon) :
372
373
break
373
374
case ( . spoon, . hat) :
@@ -381,6 +382,7 @@ func checkDiagnosticMinimality(x: Runcible?) {
381
382
// expected-note@-2 {{add missing case: '(.hat, .spoon)'}}
382
383
// expected-note@-3 {{add missing case: '(.spoon, .hat)'}}
383
384
// expected-note@-4 {{add missing case: '(_, .fork)'}}
385
+ // expected-note@-5 {{add missing cases}} {{+10:3-3=case (.fork, _):\n<#code#>\ncase (.hat, .spoon):\n<#code#>\ncase (.spoon, .hat):\n<#code#>\ncase (_, .fork):\n<#code#>\n}}
384
386
case ( . spoon, . spoon) :
385
387
break
386
388
case ( . hat, . hat) :
@@ -405,6 +407,7 @@ enum LargeSpaceEnum {
405
407
func notQuiteBigEnough( ) -> Bool {
406
408
switch ( LargeSpaceEnum . case1, LargeSpaceEnum . case2) { // expected-error {{switch must be exhaustive}}
407
409
// expected-note@-1 110 {{add missing case:}}
410
+ // expected-note@-2 {{add missing cases}}
408
411
case ( . case0, . case0) : return true
409
412
case ( . case1, . case1) : return true
410
413
case ( . case2, . case2) : return true
@@ -443,6 +446,7 @@ enum ContainsOverlyLargeEnum {
443
446
func quiteBigEnough( ) -> Bool {
444
447
switch ( OverlyLargeSpaceEnum . case1, OverlyLargeSpaceEnum . case2) { // expected-error {{switch must be exhaustive}}
445
448
// expected-note@-1 132 {{add missing case:}}
449
+ // expected-note@-2 {{add missing cases}}
446
450
case ( . case0, . case0) : return true
447
451
case ( . case1, . case1) : return true
448
452
case ( . case2, . case2) : return true
@@ -543,7 +547,7 @@ func quiteBigEnough() -> Bool {
543
547
}
544
548
545
549
// Make sure we haven't just stopped emitting diagnostics.
546
- switch OverlyLargeSpaceEnum . case1 { // expected-error {{switch must be exhaustive}} expected-note 12 {{add missing case}}
550
+ switch OverlyLargeSpaceEnum . case1 { // expected-error {{switch must be exhaustive}} expected-note 12 {{add missing case}} expected-note {{add missing cases}}
547
551
}
548
552
}
549
553
@@ -564,12 +568,14 @@ indirect enum MutuallyRecursive {
564
568
func infinitelySized( ) -> Bool {
565
569
switch ( InfinitelySized . one, InfinitelySized . one) { // expected-error {{switch must be exhaustive}}
566
570
// expected-note@-1 8 {{add missing case:}}
571
+ // expected-note@-2 {{add missing cases}}
567
572
case ( . one, . one) : return true
568
573
case ( . two, . two) : return true
569
574
}
570
575
571
576
switch ( MutuallyRecursive . one, MutuallyRecursive . one) { // expected-error {{switch must be exhaustive}}
572
577
// expected-note@-1 8 {{add missing case:}}
578
+ // expected-note@-2 {{add missing cases}}
573
579
case ( . one, . one) : return true
574
580
case ( . two, . two) : return true
575
581
}
@@ -840,7 +846,7 @@ public enum NonExhaustivePayload {
840
846
// case.
841
847
@inlinable
842
848
public func testNonExhaustive( _ value: NonExhaustive , _ payload: NonExhaustivePayload , for interval: TemporalProxy , flag: Bool ) {
843
- switch value { // expected-error {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b'}} {{none}}
849
+ switch value { // expected-error {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b'}} {{+2:3-3=case .b:\n<#code#>\n}}
844
850
case . a: break
845
851
}
846
852
@@ -861,12 +867,16 @@ public func testNonExhaustive(_ value: NonExhaustive, _ payload: NonExhaustivePa
861
867
@unknown case _: break // no-warning
862
868
}
863
869
864
- switch value { // expected-warning {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b'}} {{none}}
870
+ switch value { // expected-warning {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b'}} {{+2:3-3=case .b:\n<#code#>\n}}
865
871
case . a: break
866
872
@unknown case _: break
867
873
}
868
874
869
- switch value { // expected-warning {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.a'}} {{none}} expected-note {{add missing case: '.b'}} {{none}}
875
+ switch value {
876
+ // expected-warning@-1 {{switch must be exhaustive}} {{none}}
877
+ // expected-note@-2 {{add missing case: '.a'}} {{+5:3-3=case .a:\n<#code#>\n}}
878
+ // expected-note@-3 {{add missing case: '.b'}} {{+5:3-3=case .b:\n<#code#>\n}}
879
+ // expected-note@-4 {{add missing cases}} {{+5:3-3=case .a:\n<#code#>\ncase .b:\n<#code#>\n}}
870
880
@unknown case _: break
871
881
}
872
882
@@ -932,7 +942,7 @@ public func testNonExhaustive(_ value: NonExhaustive, _ payload: NonExhaustivePa
932
942
} // no-warning
933
943
934
944
// Test payloaded enums.
935
- switch payload { // expected-error {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(_)'}} {{none}}
945
+ switch payload { // expected-error {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(_)'}} {{+2:3-3=case .b(_):\n<#code#>\n}}
936
946
case . a: break
937
947
}
938
948
@@ -953,17 +963,17 @@ public func testNonExhaustive(_ value: NonExhaustive, _ payload: NonExhaustivePa
953
963
@unknown case _: break // no-warning
954
964
}
955
965
956
- switch payload { // expected-warning {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(_)'}} {{none}}
966
+ switch payload { // expected-warning {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(_)'}} {{+2:3-3=case .b(_):\n<#code#>\n}}
957
967
case . a: break
958
968
@unknown case _: break
959
969
}
960
970
961
- switch payload { // expected-error {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(true)'}} {{none}}
971
+ switch payload { // expected-error {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(true)'}} {{+3:3-3=case .b(true):\n<#code#>\n}}
962
972
case . a: break
963
973
case . b( false ) : break
964
974
}
965
975
966
- switch payload { // expected-warning {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(true)'}} {{none}}
976
+ switch payload { // expected-warning {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(true)'}} {{+3:3-3=case .b(true):\n<#code#>\n}}
967
977
case . a: break
968
978
case . b( false ) : break
969
979
@unknown case _: break
@@ -1017,12 +1027,15 @@ public func testNonExhaustiveWithinModule(_ value: NonExhaustive, _ payload: Non
1017
1027
@unknown case _: break // no-warning
1018
1028
}
1019
1029
1020
- switch value { // expected-warning {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b'}} {{none}}
1030
+ switch value { // expected-warning {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b'}} {{+2:3-3=case .b:\n<#code#>\n}}
1021
1031
case . a: break
1022
1032
@unknown case _: break
1023
1033
}
1024
1034
1025
- switch value { // expected-warning {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.a'}} {{none}} expected-note {{add missing case: '.b'}} {{none}}
1035
+ switch value { // expected-warning {{switch must be exhaustive}} {{none}}
1036
+ // expected-note@-1 {{add missing case: '.a'}} {{+4:3-3=case .a:\n<#code#>\n}}
1037
+ // expected-note@-2 {{add missing case: '.b'}} {{+4:3-3=case .b:\n<#code#>\n}}
1038
+ // expected-note@-3 {{add missing cases}} {{+4:3-3=case .a:\n<#code#>\ncase .b:\n<#code#>\n}}
1026
1039
@unknown case _: break
1027
1040
}
1028
1041
@@ -1071,7 +1084,7 @@ public func testNonExhaustiveWithinModule(_ value: NonExhaustive, _ payload: Non
1071
1084
}
1072
1085
1073
1086
// Test payloaded enums.
1074
- switch payload { // expected-error {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(_)'}} {{none }}
1087
+ switch payload { // expected-error {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(_)'}} {{+2:3-3=case .b(_):\n<#code#>\n }}
1075
1088
case . a: break
1076
1089
}
1077
1090
@@ -1092,17 +1105,17 @@ public func testNonExhaustiveWithinModule(_ value: NonExhaustive, _ payload: Non
1092
1105
@unknown case _: break // no-warning
1093
1106
}
1094
1107
1095
- switch payload { // expected-warning {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(_)'}} {{none }}
1108
+ switch payload { // expected-warning {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(_)'}} {{+2:3-3=case .b(_):\n<#code#>\n }}
1096
1109
case . a: break
1097
1110
@unknown case _: break
1098
1111
}
1099
1112
1100
- switch payload { // expected-error {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(true)'}} {{none }}
1113
+ switch payload { // expected-error {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(true)'}} {{+3:3-3=case .b(true):\n<#code#>\n }}
1101
1114
case . a: break
1102
1115
case . b( false ) : break
1103
1116
}
1104
1117
1105
- switch payload { // expected-warning {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(true)'}} {{none }}
1118
+ switch payload { // expected-warning {{switch must be exhaustive}} {{none}} expected-note {{add missing case: '.b(true)'}} {{+3:3-3=case .b(true):\n<#code#>\n }}
1106
1119
case . a: break
1107
1120
case . b( false ) : break
1108
1121
@unknown case _: break
0 commit comments