mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
`??` operator is overloaded on optionality of its result. When the first argument matches exactly, the ranking is going to be skewed towards selecting an overload choice that returns a non-optional type. This is not always correct i.e. when operator is involved in optional chaining. To avoid producing an incorrect favoring, let's skip the this disjunction when constraints associated with result type indicate that it should be optional. Simply adding it as a binding won't work because if the second argument is non-optional the overload that returns `T?` would still have a lower score. Resolves: rdar://164201746
74 KiB
74 KiB