mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] Adjust impact of implicit Double <-> CGFloat conversions
- Prefer CGFloat -> Double over the other way around to avoid ambiguities; - Every new conversion impacts the score by factor of number of previously applied conversions to make it possible to select solutions that require the least such conversions. - Prefer concrete overloads with Double <-> CGFloat conversion over generic ones.
This commit is contained in:
@@ -790,10 +790,6 @@ enum ScoreKind {
|
||||
SK_DisfavoredOverload,
|
||||
/// A member for an \c UnresolvedMemberExpr found via unwrapped optional base.
|
||||
SK_UnresolvedMemberViaOptional,
|
||||
/// An implicit conversion from a value of one type (lhs)
|
||||
/// to another type (rhs) via implicit initialization of
|
||||
/// `rhs` type which an argument of `lhs` value.
|
||||
SK_ImplicitValueConversion,
|
||||
/// An implicit force of an implicitly unwrapped optional value.
|
||||
SK_ForceUnchecked,
|
||||
/// A user-defined conversion.
|
||||
@@ -814,8 +810,12 @@ enum ScoreKind {
|
||||
SK_ValueToPointerConversion,
|
||||
/// A closure/function conversion to an autoclosure parameter.
|
||||
SK_FunctionToAutoClosureConversion,
|
||||
/// An implicit conversion from a value of one type (lhs)
|
||||
/// to another type (rhs) via implicit initialization of
|
||||
/// `rhs` type which an argument of `lhs` value.
|
||||
SK_ImplicitValueConversion,
|
||||
|
||||
SK_LastScoreKind = SK_FunctionToAutoClosureConversion,
|
||||
SK_LastScoreKind = SK_ImplicitValueConversion,
|
||||
};
|
||||
|
||||
/// The number of score kinds.
|
||||
|
||||
Reference in New Issue
Block a user