mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CS] Allow InsertExplicitCall for higher-order functions
Allow `InsertExplicitCall` for e.g converting `() -> () -> Void` to `() -> Void`. No test since it's already covered in the test suite when the next commit is applied.
This commit is contained in:
@@ -5186,11 +5186,16 @@ bool ConstraintSystem::repairFailures(
|
||||
// side isn't, let's check it would be possible to fix
|
||||
// this by forming an explicit call.
|
||||
auto convertTo = dstType->lookThroughAllOptionalTypes();
|
||||
// Right-hand side can't be - a function, a type variable or dependent
|
||||
// member, or `Any` (if function conversion to `Any` didn't succeed there
|
||||
// is something else going on e.g. problem with escapiness).
|
||||
if (convertTo->is<FunctionType>() || convertTo->isTypeVariableOrMember() ||
|
||||
convertTo->isAny())
|
||||
|
||||
// If the RHS is a function type, the source must be a function-returning
|
||||
// function.
|
||||
if (convertTo->is<FunctionType>() && !resultType->is<FunctionType>())
|
||||
return false;
|
||||
|
||||
// Right-hand side can't be a type variable or dependent member, or `Any`
|
||||
// (if function conversion to `Any` didn't succeed there is something else
|
||||
// going on e.g. problem with escapiness).
|
||||
if (convertTo->isTypeVariableOrMember() || convertTo->isAny())
|
||||
return false;
|
||||
|
||||
ConstraintKind matchKind;
|
||||
|
||||
Reference in New Issue
Block a user