Skip to content

Commit bc18397

Browse files
authored
[test] Add a fixed crasher test for SR-9199 (swiftlang#20386)
1 parent 945ee92 commit bc18397

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// RUN: %target-swift-frontend -emit-ir -o %t.ll %s
2+
3+
// Just make sure we don't crash.
4+
5+
protocol Publicable {
6+
associatedtype PublicModel
7+
8+
func publicized() -> PublicModel
9+
}
10+
11+
12+
protocol WithReturnType {
13+
associatedtype MainType
14+
associatedtype ReturnType
15+
16+
func returnTheThing()
17+
}
18+
19+
extension WithReturnType where MainType: Publicable {
20+
typealias ReturnType = MainType.PublicModel
21+
22+
func returnTheThing() {
23+
print("publicable")
24+
}
25+
}
26+
27+
extension WithReturnType {
28+
func returnTheThing() {
29+
print("not publicable")
30+
}
31+
}
32+
33+
extension String: Publicable {
34+
struct PublicString {
35+
let inner: String
36+
37+
init(str: String) {
38+
self.inner = "Public: \(str)"
39+
}
40+
}
41+
42+
func publicized() -> PublicString {
43+
return PublicString(str: self)
44+
}
45+
}
46+
47+
struct Controller<T> {
48+
49+
}
50+
51+
extension Controller: WithReturnType {
52+
typealias MainType = T
53+
}
54+
55+
let controller = Controller<String>()
56+
57+
controller.returnTheThing()

0 commit comments

Comments
 (0)