mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Limit conversion that adds a global actor to a function type to subtyping.
Without this, we'll end up accepting invalid conversions when there is a global actor-qualified function type in a non-top-level structural position.
This commit is contained in:
@@ -2025,11 +2025,16 @@ ConstraintSystem::matchFunctionTypes(FunctionType *func1, FunctionType *func2,
|
||||
return getTypeMatchFailure(locator);
|
||||
} else if (func1->getGlobalActor()) {
|
||||
// Cannot remove a global actor.
|
||||
if (!shouldAttemptFixes())
|
||||
return getTypeMatchFailure(locator);
|
||||
|
||||
auto *fix = MarkGlobalActorFunction::create(
|
||||
*this, func1, func2, getConstraintLocator(locator));
|
||||
|
||||
if (recordFix(fix))
|
||||
return getTypeMatchFailure(locator);
|
||||
} else if (kind < ConstraintKind::Subtype) {
|
||||
return getTypeMatchFailure(locator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user