Skip to content

Commit 27fde3e

Browse files
xedinktoso
authored andcommitted
[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 5f0e73d commit 27fde3e

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
@@ -1428,7 +1428,10 @@ static void diagRecursivePropertyAccess(const Expr *E, const DeclContext *DC) {
14281428
if (MRE->getAccessSemantics() == AccessSemantics::Ordinary) {
14291429
bool shouldDiagnose = false;
14301430
// Warn about any property access in the getter.
1431-
if (Accessor->isGetter())
1431+
//
1432+
// Distributed thunks have to refer to the "local" version
1433+
// of the property directly with implicit `self.` base.
1434+
if (Accessor->isGetter() && !Accessor->isDistributedThunk())
14321435
shouldDiagnose = !isStore;
14331436
// Warn about stores in the setter, but allow loads.
14341437
if (Accessor->isSetter())

0 commit comments

Comments
 (0)