Skip to content

Commit 29a0042

Browse files
committed
[NFC] Add a test case for user-defined tuple conformances.
1 parent d864ceb commit 29a0042

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// RUN: %target-typecheck-verify-swift -enable-experimental-variadic-generics -parse-stdlib
2+
3+
import Swift
4+
5+
protocol P {
6+
associatedtype A
7+
associatedtype B
8+
9+
func f()
10+
}
11+
12+
extension Builtin.TheTupleType: P where Elements: P {
13+
typealias A = (Elements.A...)
14+
typealias B = Float
15+
func f() {}
16+
}
17+
18+
extension Int: P {
19+
typealias A = Int
20+
typealias B = String
21+
func f() {}
22+
}
23+
24+
func returnsPA<T: P>(_: T) -> T.A.Type {}
25+
func returnsPB<T: P>(_: T) -> T.B.Type {}
26+
27+
func same<T>(_: T, _: T) {}
28+
29+
func useConformance() {
30+
same(returnsPA((1, 2, 3)), (Int, Int, Int).self)
31+
same(returnsPB((1, 2, 3)), Float.self)
32+
33+
(1, 2, 3).f()
34+
}

0 commit comments

Comments
 (0)