Skip to content

Commit c3be957

Browse files
authored
Merge pull request swiftlang#29844 from eeckstein/test-for-irgen-crash
add a test for an IRGen crash
2 parents e18d1c8 + 42971d9 commit c3be957

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/IRGen/partial_apply_crash.swift

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// RUN: %target-swift-frontend -emit-ir -O %s | %FileCheck %s
2+
3+
// This is a compile-only test. It checks that the compiler does not crash for
4+
// a partial_apply with "unusual" conformances: rdar://problem/59456064
5+
6+
public struct Inner<Element> { }
7+
8+
extension Inner: Equatable where Element: Equatable {
9+
public static func == (lhs: Inner<Element>, rhs: Inner<Element>) -> Bool {
10+
return false
11+
}
12+
}
13+
14+
public struct Outer<Value> { }
15+
16+
extension Outer: Equatable where Value: Equatable {
17+
public static func == (lhs: Outer<Value>, rhs: Outer<Value>) -> Bool {
18+
return false
19+
}
20+
}
21+
22+
@inline(never)
23+
func foo<Element>(_ x: Element, _ equal: (Element, Element) -> Bool) {
24+
_ = equal(x, x)
25+
}
26+
27+
// CHECK: define {{.*}}testit
28+
public func testit<Element: Equatable>(_ x: Outer<Inner<Element>>) {
29+
foo(x, ==)
30+
}
31+

0 commit comments

Comments
 (0)