[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:
Pavel Yaskevich
2020-10-31 00:22:26 -07:00
parent 7fee5971d6
commit 4b01c8fd11
7 changed files with 25 additions and 16 deletions

View File

@@ -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.