File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1004,3 +1004,15 @@ func rdar52204414() {
1004
1004
let _ = { ( ) -> Void in return 42 }
1005
1005
// expected-error@-1 {{declared closure result 'Int' is incompatible with contextual type 'Void'}}
1006
1006
}
1007
+
1008
+ // SR-12291 - trailing closure is used as an argument to the last (positionally) parameter
1009
+ func overloaded_with_default( a: ( ) -> Int , b: Int = 0 , c: Int = 0 ) { }
1010
+ func overloaded_with_default( b: Int = 0 , c: Int = 0 , a: ( ) -> Int ) { }
1011
+
1012
+ overloaded_with_default { 0 } // Ok (could be ambiguous if trailing was allowed to match `a:` in first overload)
1013
+
1014
+ func overloaded_with_default_and_autoclosure< T> ( _ a: @autoclosure ( ) -> T , b: Int = 0 ) { }
1015
+ func overloaded_with_default_and_autoclosure< T> ( b: Int = 0 , c: @escaping ( ) -> T ? ) { }
1016
+
1017
+ overloaded_with_default_and_autoclosure { 42 } // Ok
1018
+ overloaded_with_default_and_autoclosure ( 42 ) // Ok
You can’t perform that action at this time.
0 commit comments