Skip to content

Commit 11e4433

Browse files
committed
Make sure we query hasInitAccessor before looking for the init accessor.
This is a workaround for the lack of a request for getting accessors.
1 parent b24b65a commit 11e4433

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/AST/Decl.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7178,8 +7178,10 @@ bool VarDecl::isMemberwiseInitialized(bool preferDeclaredProperties) const {
71787178
// If this is a computed property with `init` accessor, it's
71797179
// memberwise initializable when it could be used to initialize
71807180
// other stored properties.
7181-
if (auto *init = getAccessor(AccessorKind::Init))
7182-
return init->getAttrs().hasAttribute<InitializesAttr>();
7181+
if (hasInitAccessor()) {
7182+
if (auto *init = getAccessor(AccessorKind::Init))
7183+
return init->getAttrs().hasAttribute<InitializesAttr>();
7184+
}
71837185

71847186
// If this is a computed property, it's not memberwise initialized unless
71857187
// the caller has asked for the declared properties and it is either a

0 commit comments

Comments
 (0)