File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Ensure that -switch-checking-invocation-threshold= frontend option works,
2
+ // stopping the check, producing the correct diagnostic, and not producing the
3
+ // diagnostic for a completed check.
4
+ //
5
+ // RUN: %empty-directory(%t)
6
+ //
7
+ // RUN: not %target-swift-frontend -typecheck %s -switch-checking-invocation-threshold=1 2>%t/unproven.txt
8
+ // RUN: %FileCheck %s --check-prefix UNABLE-TO-CHECK <%t/unproven.txt
9
+ // RUN: not %FileCheck %s --check-prefix MUST-BE-EXHAUSTIVE <%t/unproven.txt
10
+ //
11
+ // RUN: not %target-swift-frontend -typecheck %s 2>%t/disproved.txt
12
+ // RUN: %FileCheck %s --check-prefix MUST-BE-EXHAUSTIVE <%t/disproved.txt
13
+ // RUN: not %FileCheck %s --check-prefix UNABLE-TO-CHECK <%t/disproved.txt
14
+ //
15
+ // UNABLE-TO-CHECK: error: the compiler is unable to check that this switch is exhaustive in reasonable time
16
+ // MUST-BE-EXHAUSTIVE: error: switch must be exhaustive
17
+
18
+
19
+ enum A {
20
+ case a1, a2, a3, a4, a5
21
+ }
22
+ enum B {
23
+ case b1, b2, b3, b4
24
+ }
25
+
26
+ func f( a: A , b: B ) {
27
+ switch ( a, b) {
28
+ case
29
+ // (.a1, .b1),
30
+ ( . a2, . b1) ,
31
+ ( . a3, . b1) ,
32
+ ( . a4, . b1) ,
33
+ ( . a5, . b1) ,
34
+ ( . a1, . b2) ,
35
+ ( . a2, . b2) ,
36
+ ( . a3, . b2) ,
37
+ ( . a4, . b2) ,
38
+ ( . a5, . b2) ,
39
+ ( . a1, . b3) ,
40
+ ( . a2, . b3) ,
41
+ ( . a3, . b3) ,
42
+ ( . a4, . b3) ,
43
+ ( . a5, . b3) ,
44
+ ( . a1, . b4) ,
45
+ ( . a2, . b4) ,
46
+ ( . a3, . b4) ,
47
+ ( . a4, . b4) ,
48
+ ( . a5, . b4) :
49
+ break
50
+ }
51
+ }
You can’t perform that action at this time.
0 commit comments