Skip to content

Commit b38f471

Browse files
committed
[MiscDiagnostics] Don't diagnose recursive property access in distributed thunks
Distributed thunks have to refer to the "local" version of the property directly with implicit `self.` base.
1 parent 7fd4064 commit b38f471

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/Sema/MiscDiagnostics.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,10 @@ static void diagRecursivePropertyAccess(const Expr *E, const DeclContext *DC) {
14241424
if (MRE->getAccessSemantics() == AccessSemantics::Ordinary) {
14251425
bool shouldDiagnose = false;
14261426
// Warn about any property access in the getter.
1427-
if (Accessor->isGetter())
1427+
//
1428+
// Distributed thunks have to refer to the "local" version
1429+
// of the property directly with implicit `self.` base.
1430+
if (Accessor->isGetter() && !Accessor->isDistributedThunk())
14281431
shouldDiagnose = !isStore;
14291432
// Warn about stores in the setter, but allow loads.
14301433
if (Accessor->isSetter())

0 commit comments

Comments
 (0)