File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -106,3 +106,34 @@ func nested(_: OuterStruct.InnerStruct<Int>) {}
106
106
107
107
func nested( _: OuterStruct < Int > . InnerStruct ) { }
108
108
// expected-error@-1 {{reference to generic type 'OuterStruct<Int>.InnerStruct' requires arguments in <...>}}
109
+
110
+
111
+ func assertExactType< T> ( of _: T , is _: T . Type ) { }
112
+
113
+ // https://github.com/apple/swift/issues/51217
114
+ protocol P {
115
+ associatedtype A
116
+ associatedtype B
117
+ }
118
+ do {
119
+ struct Concrete : P {
120
+ typealias A = Int
121
+ typealias B = Bool
122
+ }
123
+ struct Generic < A, B> : P { }
124
+
125
+ struct BinderGenericParams1 < T1: P , T2: P >
126
+ where T1. A == T2 . A , T1. B == T2 . B {
127
+ static func bind( _: T1 , _: T2 ) -> T2 { }
128
+ }
129
+ struct BinderGenericParams2 {
130
+ static func bind< T1: P , T2: P > ( _: T1 , _: T2 ) -> T2
131
+ where T1. A == T2 . A , T1. B == T2 . B { }
132
+ }
133
+
134
+ let x1 = BinderGenericParams1 . bind ( Concrete ( ) , Generic ( ) )
135
+ let x2 = BinderGenericParams2 . bind ( Concrete ( ) , Generic ( ) )
136
+
137
+ assertExactType ( of: x1, is: Generic< Int, Bool> . self )
138
+ assertExactType ( of: x2, is: Generic< Int, Bool> . self )
139
+ }
You can’t perform that action at this time.
0 commit comments