Skip to content

Commit aec582b

Browse files
committed
Merge pull request #1647 from johnno1962a/master
New test for common SourceKit crash
2 parents c14d868 + b92f09f commit aec582b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Checks that SourceKit does not crash for enum patterns in generics.
2+
// RUN: %sourcekitd-test -req cursor -pos 18:15 %s -- %s | FileCheck %s
3+
// CHECK: source.lang.swift.ref.enumelement (12:10-12:17)
4+
5+
public protocol MyErrorType {
6+
}
7+
8+
enum MyErrorEnum: MyErrorType {
9+
}
10+
11+
public enum ResultTest<Value, Error: MyErrorType> {
12+
case Success(Value)
13+
case Failure(Error)
14+
15+
/// Returns `true` if the result is a success, `false` otherwise.
16+
public var isSuccess: Bool {
17+
switch self {
18+
case .Success:
19+
return true
20+
case .Failure:
21+
return false
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)