mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Allow conversions from actor-bound sync function type to unbound async function type.
For `async` function types, an actor constraint can be enforced by the callee by hopping executors, unlike with `sync` functions, so doesn't need to influence the outward type of the function. rdar://76248452
This commit is contained in:
@@ -2114,8 +2114,8 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
|
||||
auto result = matchTypes(func1->getGlobalActor(), func2->getGlobalActor(), ConstraintKind::Equal, subflags, locator);
|
||||
if (result == SolutionKind::Error)
|
||||
return getTypeMatchFailure(locator);
|
||||
} else if (func1->getGlobalActor()) {
|
||||
// Cannot remove a global actor.
|
||||
} else if (func1->getGlobalActor() && !func2->isAsync()) {
|
||||
// Cannot remove a global actor from a synchronous function.
|
||||
if (!shouldAttemptFixes())
|
||||
return getTypeMatchFailure(locator);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user