Introduce checking for ConcurrentValue conformance across actors.

When referring to an actor-isolated declaration from outside of the
actor, ensure that the types involved conform to the `ConcurrentValue`
protocol. Otherwise, produce a diagnostic stating that it is unsafe to
pass such types across actors.

Apply the same rule to local captures within concurrent code.
This commit is contained in:
Doug Gregor
2021-02-01 12:13:31 -08:00
parent a632118d6a
commit 866a8d8944
14 changed files with 654 additions and 68 deletions

View File

@@ -1168,7 +1168,8 @@ public:
DeclAttribute::canAttributeAppearOnDeclKind(DeclAttrKind::DAK_Available,
D->getDeclKind()) &&
!D->getIntroducingVersion().hasOSAvailability() &&
!D->hasDeclAttribute(DeclAttrKind::DAK_AlwaysEmitIntoClient)) {
!D->hasDeclAttribute(DeclAttrKind::DAK_AlwaysEmitIntoClient) &&
!D->hasDeclAttribute(DeclAttrKind::DAK_Marker)) {
D->emitDiag(D->getLoc(), diag::new_decl_without_intro);
}
}