Skip to content

Commit b752d78

Browse files
authored
Merge pull request #61346 from slavapestov/test-case-for-protocol-extension-where-clause-typealias
Add missing test case
2 parents 599874a + 649e6a6 commit b752d78

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %target-typecheck-verify-swift %s
2+
3+
protocol P<T> {
4+
associatedtype T
5+
}
6+
7+
extension P {
8+
typealias A = Int
9+
// expected-note@-1 3{{consider moving 'A' into the definition of protocol 'P'}}
10+
}
11+
12+
protocol Q {
13+
associatedtype T: P
14+
associatedtype U: P<T.A>
15+
// expected-error@-1 {{'A' was defined in extension of protocol 'P' and cannot be referenced from a associated type inheritance clause}}
16+
}
17+
18+
struct S<T: P, U: P<T.A>> {
19+
// expected-error@-1 {{'A' was defined in extension of protocol 'P' and cannot be referenced from a generic parameter inheritance clause}}
20+
21+
func f<V>(_: V) where V == T.A {}
22+
// expected-error@-1 {{'A' was defined in extension of protocol 'P' and cannot be referenced from a 'where' clause}}
23+
}

0 commit comments

Comments
 (0)