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 599e169 commit 381e655Copy full SHA for 381e655
lib/AST/Decl.cpp
@@ -6818,8 +6818,17 @@ bool VarDecl::isSettable(const DeclContext *UseDC,
6818
6819
// If this is a 'var' decl, then we're settable if we have storage or a
6820
// setter.
6821
- if (!isLet())
+ if (!isLet()) {
6822
+ if (hasInitAccessor()) {
6823
+ if (auto *ctor = dyn_cast_or_null<ConstructorDecl>(UseDC)) {
6824
+ if (base && ctor->getImplicitSelfDecl() != base->getDecl())
6825
+ return supportsMutation();
6826
+ return true;
6827
+ }
6828
6829
+
6830
return supportsMutation();
6831
6832
6833
// Static 'let's are always immutable.
6834
if (isStatic()) {
0 commit comments