@@ -3405,4 +3405,66 @@ class RedundantSelfTests: XCTestCase {
3405
3405
"""
3406
3406
XCTAssertNoThrow ( try format ( input, rules: [ . redundantSelf] ) )
3407
3407
}
3408
+
3409
+ func testUnderstandsParameterPacks_issue_1992( ) {
3410
+ let input = """
3411
+ @resultBuilder
3412
+ public enum DirectoryContentBuilder {
3413
+ public static func buildPartialBlock<each Accumulated>(
3414
+ accumulated: repeat each Accumulated,
3415
+ next: some DirectoryContent
3416
+ ) -> some DirectoryContent where repeat each Accumulated: DirectoryContent {
3417
+ Accumulate(
3418
+ accumulated: repeat each accumulated,
3419
+ next: next
3420
+ )
3421
+ }
3422
+
3423
+ public static func buildEither<First, Second>(
3424
+ first component: First
3425
+ ) -> _Either<First, Second> where First: DirectoryContent, Second: DirectoryContent {
3426
+ .first(component)
3427
+ }
3428
+
3429
+ struct List<Element>: DirectoryContent where Element: DirectoryContent {
3430
+ init(_ list: [Element]) {
3431
+ self._list = list
3432
+ }
3433
+
3434
+ private let _list: [Element]
3435
+ }
3436
+ }
3437
+ """
3438
+
3439
+ let output = """
3440
+ @resultBuilder
3441
+ public enum DirectoryContentBuilder {
3442
+ public static func buildPartialBlock<each Accumulated>(
3443
+ accumulated: repeat each Accumulated,
3444
+ next: some DirectoryContent
3445
+ ) -> some DirectoryContent where repeat each Accumulated: DirectoryContent {
3446
+ Accumulate(
3447
+ accumulated: repeat each accumulated,
3448
+ next: next
3449
+ )
3450
+ }
3451
+
3452
+ public static func buildEither<First, Second>(
3453
+ first component: First
3454
+ ) -> _Either<First, Second> where First: DirectoryContent, Second: DirectoryContent {
3455
+ .first(component)
3456
+ }
3457
+
3458
+ struct List<Element>: DirectoryContent where Element: DirectoryContent {
3459
+ init(_ list: [Element]) {
3460
+ _list = list
3461
+ }
3462
+
3463
+ private let _list: [Element]
3464
+ }
3465
+ }
3466
+ """
3467
+
3468
+ testFormatting ( for: input, output, rule: . redundantSelf)
3469
+ }
3408
3470
}
0 commit comments