File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Ensure that -switch-checking-invocation-threshold= frontend option works.
2
+ //
3
+ // RUN: not %target-swift-frontend -typecheck %s -switch-checking-invocation-threshold=1 2>&1 | %FileCheck %s --check-prefix LIMIT
4
+ // RUN: not %target-swift-frontend -typecheck %s 2>&1 | %FileCheck %s --check-prefix NO_LIMIT
5
+ // LIMIT: error: the compiler is unable to check that this switch is exhaustive in reasonable time
6
+ // LIMIT-NOT: error: switch must be exhaustive
7
+ // NO_LIMIT: error: switch must be exhaustive
8
+ // NO_LIMIT-NOT: error: the compiler is unable to check that this switch is exhaustive in reasonable time
9
+
10
+ import Foundation
11
+
12
+ enum A {
13
+ case a1, a2, a3, a4, a5
14
+ }
15
+ enum B {
16
+ case b1, b2, b3, b4
17
+ }
18
+
19
+ func f( a: A , b: B ) {
20
+ switch ( a, b) {
21
+ case
22
+ // (.a1, .b1),
23
+ ( . a2, . b1) ,
24
+ ( . a3, . b1) ,
25
+ ( . a4, . b1) ,
26
+ ( . a5, . b1) ,
27
+ ( . a1, . b2) ,
28
+ ( . a2, . b2) ,
29
+ ( . a3, . b2) ,
30
+ ( . a4, . b2) ,
31
+ ( . a5, . b2) ,
32
+ ( . a1, . b3) ,
33
+ ( . a2, . b3) ,
34
+ ( . a3, . b3) ,
35
+ ( . a4, . b3) ,
36
+ ( . a5, . b3) ,
37
+ ( . a1, . b4) ,
38
+ ( . a2, . b4) ,
39
+ ( . a3, . b4) ,
40
+ ( . a4, . b4) ,
41
+ ( . a5, . b4) :
42
+ break
43
+ }
44
+ }
You can’t perform that action at this time.
0 commit comments