File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -4,16 +4,38 @@ protocol P {}
4
4
5
5
struct S < T> { }
6
6
7
- class A : P { }
7
+ class C : P { }
8
8
9
9
extension S where T : P {
10
10
typealias A = Int
11
11
typealias B < U> = S < U >
12
12
}
13
13
14
- _ = S< A> . A( ) // Ok
14
+ extension S where T == Float {
15
+ typealias C = Int
16
+ }
17
+
18
+ class A < T, U> { }
19
+
20
+ extension A where T == [ U ] , U: P {
21
+ typealias S1 = Int
22
+ }
23
+
24
+ extension A where T == [ U ] , U == Int {
25
+ typealias S2 = Int
26
+ }
27
+
28
+ class B < U> : A < [ U ] , U > { }
29
+
30
+ _ = B< C> . S1( ) // Ok
31
+ _ = B< Int> . S2( ) // Ok
32
+ _ = B< Float> . S1( ) // expected-error {{type 'Float' does not conform to protocol 'P'}}
33
+ _ = B< String> . S2( ) // expected-error {{'B<String>.S2.Type' (aka 'Int.Type') requires the types '[String]' and '[Int]' be equivalent}}
34
+
35
+ _ = S< C> . A( ) // Ok
15
36
_ = S< Int> . A( ) // expected-error {{type 'Int' does not conform to protocol 'P'}}
16
37
_ = S < String > . B < Int > ( ) // expected-error {{type 'String' does not conform to protocol 'P'}}
38
+ _ = S< Int> . C( ) // expected-error {{'S<Int>.C.Type' (aka 'Int.Type') requires the types 'Int' and 'Float' be equivalent}}
17
39
18
40
func foo< T> ( _ s: S < T > . Type ) {
19
41
_ = s. A ( ) // expected-error {{type 'T' does not conform to protocol 'P'}}
You can’t perform that action at this time.
0 commit comments