Skip to content

Commit e35a068

Browse files
committed
1 parent 0ebe9a1 commit e35a068

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// RUN: %target-swift-frontend -verify -emit-ir %s
2+
3+
// Ideally this would type check successfully; we should be able to
4+
// infer that X == Int using the same-type constraint 'A.X == X'.
5+
6+
protocol P1 {
7+
associatedtype X
8+
// expected-note@-1 {{protocol requires nested type 'X'; do you want to add it?}}
9+
associatedtype A: P2 where A.X == X
10+
}
11+
12+
protocol P2 {
13+
associatedtype X
14+
}
15+
16+
struct S {}
17+
18+
extension S {
19+
struct A: P2 {
20+
typealias X = Int
21+
}
22+
}
23+
24+
25+
extension S: P1 {}
26+
// expected-error@-1 {{type 'S' does not conform to protocol 'P1'}}
27+
28+
print(S.X.self)

0 commit comments

Comments
 (0)