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
|
// side isn't, let's check it would be possible to fix
|
||||||
// this by forming an explicit call.
|
// this by forming an explicit call.
|
||||||
auto convertTo = dstType->lookThroughAllOptionalTypes();
|
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
|
// If the RHS is a function type, the source must be a function-returning
|
||||||
// is something else going on e.g. problem with escapiness).
|
// function.
|
||||||
if (convertTo->is<FunctionType>() || convertTo->isTypeVariableOrMember() ||
|
if (convertTo->is<FunctionType>() && !resultType->is<FunctionType>())
|
||||||
convertTo->isAny())
|
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;
|
return false;
|
||||||
|
|
||||||
ConstraintKind matchKind;
|
ConstraintKind matchKind;
|
||||||
|
|||||||
Reference in New Issue
Block a user