Skip to content

Commit 9472896

Browse files
author
David Ungar
committed
Scan output twice to strengthen negative checks.
1 parent 6565e55 commit 9472896

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

test/Sema/exhaustive_switch_invocation_threshold.swift

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
// Ensure that -switch-checking-invocation-threshold= frontend option works.
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.
24
//
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
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
917

10-
import Foundation
1118

1219
enum A {
1320
case a1, a2, a3, a4, a5

0 commit comments

Comments
 (0)