File tree Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Expand file tree Collapse file tree 2 files changed +26
-5
lines changed Original file line number Diff line number Diff line change @@ -978,6 +978,10 @@ enum ScoreKind: unsigned int {
978978 SK_ValueToPointerConversion,
979979 // / A closure/function conversion to an autoclosure parameter.
980980 SK_FunctionToAutoClosureConversion,
981+ // / A type with a missing conformance(s) that has be synthesized
982+ // / or diagnosed later, such types are allowed to appear in
983+ // / a valid solution.
984+ SK_MissingSynthesizableConformance,
981985 // / An unapplied reference to a function. The purpose of this
982986 // / score bit is to prune overload choices that are functions
983987 // / when a solution has already been found using property.
@@ -988,12 +992,8 @@ enum ScoreKind: unsigned int {
988992 // / ambiguity tie-breakers should go after this; anything else
989993 // / should be added above.
990994 SK_UnappliedFunction,
991- // / A type with a missing conformance(s) that has be synthesized
992- // / or diagnosed later, such types are allowed to appear in
993- // / a valid solution.
994- SK_MissingSynthesizableConformance,
995995
996- SK_LastScoreKind = SK_MissingSynthesizableConformance ,
996+ SK_LastScoreKind = SK_UnappliedFunction ,
997997};
998998
999999// / The number of score kinds.
Original file line number Diff line number Diff line change 2525 _ = SendableOnly ( value: v) // Ok
2626 }
2727}
28+
29+ do {
30+ class K {
31+ func value( ) { }
32+ }
33+
34+ struct X {
35+ var fn : ( Int ) -> K
36+ func fn( _: Int ) -> Int { 42 }
37+ }
38+
39+ func sendable< T> ( _ fn: ( Int ) -> T ) -> T { fn ( 42 ) }
40+ func sendable< T: Sendable > ( _ fn: ( Int ) -> T ) -> T { fn ( 0 ) }
41+
42+ func test( x: X ) {
43+ let res = sendable ( x. fn) // Ok (non-ambiguous and non-Sendable overload)
44+ res. value ( ) // To make sure that previous expression picks a property
45+ let _: K = sendable ( x. fn) // Ok (picks `sendable<T>` with a property)
46+ let _: Int = sendable ( x. fn) // Ok (picks `sendable<T: Sendable>` with a method)
47+ }
48+ }
You can’t perform that action at this time.
0 commit comments