We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
@_implements
1 parent 355adfe commit 96fd043Copy full SHA for 96fd043
test/decl/protocol/req/associated_type_typealias_implements.swift
@@ -36,3 +36,33 @@ struct Y3: Q { // expected-error{{type 'Y3' does not conform to protocol 'Q'}}
36
typealias T = XT
37
// FIXME: More detail from diagnostic.
38
}
39
+
40
41
+protocol A1 {
42
+ associatedtype T
43
+}
44
+protocol A2 {
45
46
47
48
+struct BothA1_and_A2: A1, A2 {
49
+ @_implements(A1, T)
50
+ typealias X = Int
51
52
+ @_implements(A2, T)
53
+ typealias Y = String
54
55
56
+typealias A1_T<U: A1> = U.T
57
+typealias A2_T<U: A2> = U.T
58
59
+struct RequireSame<T, U> { }
60
61
+extension RequireSame where T == U {
62
+ init(same: Bool) { }
63
64
65
+func testImplements() {
66
+ _ = RequireSame<A1_T<BothA1_and_A2>, Int>(same: true)
67
+ _ = RequireSame<A2_T<BothA1_and_A2>, String>(same: true)
68
0 commit comments