mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix SE-0249 source compatibility break
In some situations where both the KeyPath and closure solutions for an expression with a keypath literal were valid, the type checker could not choose between them and Swift would emit an “ambiguous use” error. This change increase the typechecking score of the closure solution so that the typechecker will favor the KeyPath solution, preserving source compatibility for existing APIs. Fixes rdar://problem/56131416.
This commit is contained in:
@@ -6412,6 +6412,7 @@ done:
|
||||
|
||||
auto loc = locator.getBaseLocator();
|
||||
if (definitelyFunctionType) {
|
||||
increaseScore(SK_FunctionConversion);
|
||||
return SolutionKind::Solved;
|
||||
} else if (!anyComponentsUnresolved ||
|
||||
(definitelyKeyPathType && capability == ReadOnly)) {
|
||||
|
||||
Reference in New Issue
Block a user