@@ -144,3 +144,33 @@ func callCopyAndBind<T>(_ arg: repeat each T) {
144144 // Don't propagate errors for invalid declaration reference
145145 let result = copyIntoTuple ( repeat each arg)
146146}
147+
148+ do {
149+ struct TestArgMatching {
150+ subscript< each T > ( data arg: repeat each T ) -> Int {
151+ get { 42 }
152+ set { }
153+ }
154+ }
155+
156+ func test_that_variadic_generics_claim_unlabeled_arguments< each T > ( _ args: repeat each T , test: inout TestArgMatching ) {
157+ func testLabeled< each U > ( data: repeat each U ) { }
158+ func testUnlabeled< each U > ( _: repeat each U ) { }
159+ func testInBetween< each U > ( _: repeat each U , other: String ) { }
160+
161+ testLabeled ( data: repeat each args) // Ok
162+ testLabeled ( data: repeat each args, 1 ) // Ok
163+ testLabeled ( data: repeat each args, 1 , 2 , 3 ) // Ok
164+
165+ testUnlabeled ( repeat each args) // Ok
166+ testUnlabeled ( repeat each args, 1 ) // Ok
167+ testUnlabeled ( repeat each args, 1 , 2 , 3 ) // Ok
168+
169+ testInBetween ( repeat each args, 1 , 2.0 , other: " " ) // Ok
170+
171+ _ = test [ data: repeat each args]
172+ _ = test [ data: repeat each args, 0 , " " ]
173+
174+ test [ data: repeat each args, " " , 42 ] = 0
175+ }
176+ }
0 commit comments