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 {
978
978
SK_ValueToPointerConversion,
979
979
// / A closure/function conversion to an autoclosure parameter.
980
980
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,
981
985
// / An unapplied reference to a function. The purpose of this
982
986
// / score bit is to prune overload choices that are functions
983
987
// / when a solution has already been found using property.
@@ -988,12 +992,8 @@ enum ScoreKind: unsigned int {
988
992
// / ambiguity tie-breakers should go after this; anything else
989
993
// / should be added above.
990
994
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,
995
995
996
- SK_LastScoreKind = SK_MissingSynthesizableConformance ,
996
+ SK_LastScoreKind = SK_UnappliedFunction ,
997
997
};
998
998
999
999
// / The number of score kinds.
Original file line number Diff line number Diff line change 25
25
_ = SendableOnly ( value: v) // Ok
26
26
}
27
27
}
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