We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6a8eabf commit 62558b0Copy full SHA for 62558b0
lib/AST/Decl.cpp
@@ -7404,6 +7404,11 @@ VarDecl::mutability(const DeclContext *UseDC,
7404
if (!isLet()) {
7405
if (hasInitAccessor()) {
7406
if (auto *ctor = dyn_cast_or_null<ConstructorDecl>(UseDC)) {
7407
+ // If we're referencing 'self.', it's mutable.
7408
+ if (!base ||
7409
+ (*base && ctor->getImplicitSelfDecl() == (*base)->getDecl()))
7410
+ return StorageMutability::Mutable;
7411
+
7412
return storageIsMutable(supportsMutation());
7413
}
7414
0 commit comments