mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #72196 from gottesmm/rest-of-rdar123488540
[region-isolation] Make fields of global actor guarded types that are non-Sendable be considered as actor isolated.
This commit is contained in:
@@ -1254,12 +1254,15 @@ class DestructureResults {
|
||||
const Conventions &Convs;
|
||||
SmallVectorImpl<SILResultInfo> &Results;
|
||||
TypeExpansionContext context;
|
||||
bool hasTransferringResult;
|
||||
|
||||
public:
|
||||
DestructureResults(TypeExpansionContext context, TypeConverter &TC,
|
||||
const Conventions &conventions,
|
||||
SmallVectorImpl<SILResultInfo> &results)
|
||||
: TC(TC), Convs(conventions), Results(results), context(context) {}
|
||||
SmallVectorImpl<SILResultInfo> &results,
|
||||
bool hasTransferringResult)
|
||||
: TC(TC), Convs(conventions), Results(results), context(context),
|
||||
hasTransferringResult(hasTransferringResult) {}
|
||||
|
||||
void destructure(AbstractionPattern origType, CanType substType) {
|
||||
// Recur into tuples.
|
||||
@@ -1290,6 +1293,8 @@ public:
|
||||
SILPackType::ExtInfo extInfo(indirect);
|
||||
auto packType = SILPackType::get(TC.Context, extInfo, packElts);
|
||||
SILResultInfo result(packType, ResultConvention::Pack);
|
||||
if (hasTransferringResult)
|
||||
result = result.addingOption(SILResultInfo::IsTransferring);
|
||||
Results.push_back(result);
|
||||
});
|
||||
return;
|
||||
@@ -1331,6 +1336,8 @@ public:
|
||||
|
||||
SILResultInfo result(substResultTL.getLoweredType().getASTType(),
|
||||
convention);
|
||||
if (hasTransferringResult)
|
||||
result = result.addingOption(SILResultInfo::IsTransferring);
|
||||
Results.push_back(result);
|
||||
}
|
||||
|
||||
@@ -2359,8 +2366,8 @@ static CanSILFunctionType getSILFunctionType(
|
||||
// Destructure the result tuple type.
|
||||
SmallVector<SILResultInfo, 8> results;
|
||||
{
|
||||
DestructureResults destructurer(expansionContext, TC, conventions,
|
||||
results);
|
||||
DestructureResults destructurer(expansionContext, TC, conventions, results,
|
||||
hasTransferringResult);
|
||||
destructurer.destructure(origResultType, substFormalResultType);
|
||||
}
|
||||
|
||||
@@ -2405,7 +2412,6 @@ static CanSILFunctionType getSILFunctionType(
|
||||
.withUnimplementable(unimplementable)
|
||||
.withLifetimeDependenceInfo(
|
||||
extInfoBuilder.getLifetimeDependenceInfo())
|
||||
.withTransferringResult(hasTransferringResult)
|
||||
.build();
|
||||
|
||||
return SILFunctionType::get(genericSig, silExtInfo, coroutineKind,
|
||||
|
||||
@@ -6518,6 +6518,17 @@ public:
|
||||
require(!FTy->hasErasedIsolation() ||
|
||||
FTy->getRepresentation() == SILFunctionType::Representation::Thick,
|
||||
"only thick function types can have erased isolation");
|
||||
|
||||
// If our function hasTransferringResult, then /all/ results must be
|
||||
// transferring.
|
||||
require(FTy->hasTransferringResult() ==
|
||||
(FTy->getResults().size() &&
|
||||
llvm::all_of(FTy->getResults(),
|
||||
[](SILResultInfo result) {
|
||||
return result.hasOption(
|
||||
SILResultInfo::IsTransferring);
|
||||
})),
|
||||
"transferring result means all results are transferring");
|
||||
}
|
||||
|
||||
struct VerifyFlowSensitiveRulesDetails {
|
||||
|
||||
Reference in New Issue
Block a user