@@ -1128,3 +1128,54 @@ class UnavailableNoArgsSubclassInit: UnavailableNoArgsSuperclassInit {
11281128 // expected-error@-1 {{'init()' is unavailable}}
11291129 // expected-note@-2 {{call to unavailable initializer 'init()' from superclass 'UnavailableNoArgsSuperclassInit' occurs implicitly at the end of this initializer}}
11301130}
1131+
1132+ struct TypeWithTrailingClosures {
1133+ func twoTrailingClosures( a: ( ) -> Void , b: ( ) -> Void ) { }
1134+ func threeTrailingClosures( a: ( ) -> Void , b: ( ) -> Void , c: ( ) -> Void ) { }
1135+ func threeUnlabeledTrailingClosures( _ a: ( ) -> Void , _ b: ( ) -> Void , _ c: ( ) -> Void ) { }
1136+ func variadicTrailingClosures( a: ( ( ) -> Void ) ... , b: Int = 0 , c: Int = 0 ) { }
1137+ }
1138+
1139+ @available ( * , deprecated, renamed: " TypeWithTrailingClosures.twoTrailingClosures(self:a:b:) " )
1140+ func twoTrailingClosures( _ x: TypeWithTrailingClosures , a: ( ) -> Void , b: ( ) -> Void ) { }
1141+
1142+ @available ( * , deprecated, renamed: " TypeWithTrailingClosures.twoTrailingClosures(self:a:b:) " )
1143+ func twoTrailingClosuresWithDefaults( x: TypeWithTrailingClosures , y: Int = 0 , z: Int = 0 , a: ( ) -> Void , b: ( ) -> Void ) { }
1144+
1145+ @available ( * , deprecated, renamed: " TypeWithTrailingClosures.threeTrailingClosures(self:a:b:c:) " )
1146+ func threeTrailingClosures( _ x: TypeWithTrailingClosures , a: ( ) -> Void , b: ( ) -> Void , c: ( ) -> Void ) { }
1147+
1148+ @available ( * , deprecated, renamed: " TypeWithTrailingClosures.threeTrailingClosures(self:a:b:c:) " )
1149+ func threeTrailingClosuresDiffLabels( _: TypeWithTrailingClosures , x: ( ) -> Void , y: ( ) -> Void , z: ( ) -> Void ) { }
1150+
1151+ @available ( * , deprecated, renamed: " TypeWithTrailingClosures.threeUnlabeledTrailingClosures(self:_:_:_:) " )
1152+ func threeTrailingClosuresRemoveLabels( _ x: TypeWithTrailingClosures , a: ( ) -> Void , b: ( ) -> Void , c: ( ) -> Void ) { }
1153+
1154+ @available ( * , deprecated, renamed: " TypeWithTrailingClosures.variadicTrailingClosures(self:a:b:c:) " )
1155+ func variadicTrailingClosures( _ x: TypeWithTrailingClosures , a: ( ( ) -> Void ) ... ) { }
1156+
1157+ func testMultipleTrailingClosures( _ x: TypeWithTrailingClosures ) {
1158+ twoTrailingClosures ( x) { } b: { } // expected-warning {{'twoTrailingClosures(_:a:b:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.twoTrailingClosures(a:b:)'}}
1159+ // expected-note@-1 {{use 'TypeWithTrailingClosures.twoTrailingClosures(a:b:)' instead}} {{3-22=x.twoTrailingClosures}} {{23-24=}} {{none}}
1160+ x. twoTrailingClosures ( ) { } b: { }
1161+
1162+ twoTrailingClosuresWithDefaults ( x: x) { } b: { } // expected-warning {{'twoTrailingClosuresWithDefaults(x:y:z:a:b:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.twoTrailingClosures(a:b:)'}}
1163+ // expected-note@-1 {{use 'TypeWithTrailingClosures.twoTrailingClosures(a:b:)' instead}} {{3-34=x.twoTrailingClosures}} {{35-39=}} {{none}}
1164+ x. twoTrailingClosures ( ) { } b: { }
1165+
1166+ threeTrailingClosures ( x, a: { } ) { } c: { } // expected-warning {{'threeTrailingClosures(_:a:b:c:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.threeTrailingClosures(a:b:c:)'}}
1167+ // expected-note@-1 {{use 'TypeWithTrailingClosures.threeTrailingClosures(a:b:c:)' instead}} {{3-24=x.threeTrailingClosures}} {{25-28=}} {{none}}
1168+ x. threeTrailingClosures ( a: { } ) { } c: { }
1169+
1170+ threeTrailingClosuresDiffLabels ( x, x: { } ) { } z: { } // expected-warning {{'threeTrailingClosuresDiffLabels(_:x:y:z:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.threeTrailingClosures(a:b:c:)'}}
1171+ // expected-note@-1 {{use 'TypeWithTrailingClosures.threeTrailingClosures(a:b:c:)' instead}} {{3-34=x.threeTrailingClosures}} {{35-38=}} {{38-39=a}} {{48-49=c}} {{none}}
1172+ x. threeTrailingClosures ( a: { } ) { } c: { }
1173+
1174+ threeTrailingClosuresRemoveLabels ( x, a: { } ) { } c: { } // expected-warning {{'threeTrailingClosuresRemoveLabels(_:a:b:c:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.threeUnlabeledTrailingClosures(_:_:_:)'}}
1175+ // expected-note@-1 {{use 'TypeWithTrailingClosures.threeUnlabeledTrailingClosures(_:_:_:)' instead}} {{3-36=x.threeUnlabeledTrailingClosures}} {{37-40=}} {{40-43=}} {{50-51=_}} {{none}}
1176+ x. threeUnlabeledTrailingClosures ( { } ) { } _: { }
1177+
1178+ variadicTrailingClosures ( x) { } _: { } _: { } // expected-warning {{'variadicTrailingClosures(_:a:)' is deprecated: replaced by instance method 'TypeWithTrailingClosures.variadicTrailingClosures(a:b:c:)'}}
1179+ // expected-note@-1 {{use 'TypeWithTrailingClosures.variadicTrailingClosures(a:b:c:)' instead}} {{3-27=x.variadicTrailingClosures}} {{28-29=}} {{none}}
1180+ x. variadicTrailingClosures ( ) { } _: { } _: { }
1181+ }
0 commit comments