Skip to content

Commit d50e3b0

Browse files
committed
Add regression test for rdar://problem/62268062
1 parent c98d04b commit d50e3b0

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// RUN: %target-swift-frontend -emit-ir %s
2+
3+
public protocol HorseSaddle {}
4+
public enum EnglishSaddle : HorseSaddle {}
5+
6+
public enum WesternSaddle<A, B> : HorseSaddle {}
7+
8+
public protocol Horse {
9+
associatedtype Body : Horse
10+
11+
associatedtype Saddle: HorseSaddle
12+
13+
var body: Body { get }
14+
}
15+
16+
extension Horse {
17+
typealias Saddle = Body.Saddle
18+
}
19+
20+
public struct DraftHorse<T> : Pony {
21+
public typealias Saddle = EnglishSaddle
22+
public typealias Body = Never
23+
var contents: T
24+
}
25+
26+
// MARK: - Implementation detail
27+
28+
extension Never : Horse {
29+
public typealias Saddle = EnglishSaddle
30+
public typealias Body = Never
31+
32+
public var body: Never {
33+
switch self {}
34+
}
35+
}
36+
37+
protocol Pony : Horse where Body == Never {}
38+
extension Pony {
39+
public var body: Never { fatalError() }
40+
}
41+

0 commit comments

Comments
 (0)