File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -269,6 +269,39 @@ func test12(_ p: any Any) {
269269 }
270270}
271271
272+ protocol Q {
273+ func printit( )
274+ }
275+
276+ protocol P4 < T> {
277+ associatedtype T : Q
278+
279+ var t : T { get }
280+ }
281+
282+ struct QConformer : Q {
283+ var x = ( 0 , 1 , 2 , 3 )
284+
285+ func printit( ) {
286+ print ( " QConformer \( x. 3 ) " )
287+ }
288+ }
289+
290+ struct P4Conformer : P4 {
291+ var q = QConformer ( )
292+
293+ var t : QConformer {
294+ get {
295+ return q
296+ }
297+ }
298+ }
299+
300+ func test13( _ p: any P4 ) {
301+ print ( " test13 " )
302+ p. t. printit ( )
303+ }
304+
272305@main
273306struct Main {
274307 static func main( ) {
@@ -387,5 +420,8 @@ struct Main {
387420// OUTPUT: test any as! (Int, Int, Int, Int)
388421// OUTPUT: success
389422// OUTPUT: tuple: 0
423+ test13 ( P4Conformer ( ) )
424+ // OUTPUT: test13
425+ // OUTPUT: QConformer 3
390426 }
391427}
You can’t perform that action at this time.
0 commit comments