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 fab9e4b commit 4c466f2Copy full SHA for 4c466f2
lib/AST/Decl.cpp
@@ -6755,8 +6755,17 @@ bool VarDecl::isSettable(const DeclContext *UseDC,
6755
6756
// If this is a 'var' decl, then we're settable if we have storage or a
6757
// setter.
6758
- if (!isLet())
+ if (!isLet()) {
6759
+ if (hasInitAccessor()) {
6760
+ if (auto *ctor = dyn_cast_or_null<ConstructorDecl>(UseDC)) {
6761
+ if (base && ctor->getImplicitSelfDecl() != base->getDecl())
6762
+ return supportsMutation();
6763
+ return true;
6764
+ }
6765
6766
+
6767
return supportsMutation();
6768
6769
6770
// Static 'let's are always immutable.
6771
if (isStatic()) {
0 commit comments