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 @@ -979,6 +979,10 @@ enum ScoreKind: unsigned int {
979
979
SK_ValueToPointerConversion,
980
980
// / A closure/function conversion to an autoclosure parameter.
981
981
SK_FunctionToAutoClosureConversion,
982
+ // / A type with a missing conformance(s) that has be synthesized
983
+ // / or diagnosed later, such types are allowed to appear in
984
+ // / a valid solution.
985
+ SK_MissingSynthesizableConformance,
982
986
// / An unapplied reference to a function. The purpose of this
983
987
// / score bit is to prune overload choices that are functions
984
988
// / when a solution has already been found using property.
@@ -989,12 +993,8 @@ enum ScoreKind: unsigned int {
989
993
// / ambiguity tie-breakers should go after this; anything else
990
994
// / should be added above.
991
995
SK_UnappliedFunction,
992
- // / A type with a missing conformance(s) that has be synthesized
993
- // / or diagnosed later, such types are allowed to appear in
994
- // / a valid solution.
995
- SK_MissingSynthesizableConformance,
996
996
997
- SK_LastScoreKind = SK_MissingSynthesizableConformance ,
997
+ SK_LastScoreKind = SK_UnappliedFunction ,
998
998
};
999
999
1000
1000
// / 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