Skip to content

Commit 31e0252

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 7ed59e1 commit 31e0252

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
@@ -7187,8 +7187,10 @@ bool VarDecl::isMemberwiseInitialized(bool preferDeclaredProperties) const {
71877187
// If this is a computed property with `init` accessor, it's
71887188
// memberwise initializable when it could be used to initialize
71897189
// other stored properties.
7190-
if (auto *init = getAccessor(AccessorKind::Init))
7191-
return init->getAttrs().hasAttribute<InitializesAttr>();
7190+
if (hasInitAccessor()) {
7191+
if (auto *init = getAccessor(AccessorKind::Init))
7192+
return init->getAttrs().hasAttribute<InitializesAttr>();
7193+
}
71927194

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

0 commit comments

Comments
 (0)