Merge pull request #66513 from xedin/init-accessor-diagnostics

[Sema/SIL] Improve diagnostics related to init accessors
This commit is contained in:
Pavel Yaskevich
2023-06-14 09:57:08 -07:00
committed by GitHub
17 changed files with 738 additions and 49 deletions

View File

@@ -7168,6 +7168,12 @@ bool VarDecl::isMemberwiseInitialized(bool preferDeclaredProperties) const {
isBackingStorageForDeclaredProperty(this))
return false;
// If this is a computed property with `init` accessor, it's
// memberwise initializable when it could be used to initialize
// other stored properties.
if (auto *init = getAccessor(AccessorKind::Init))
return init->getAttrs().hasAttribute<InitializesAttr>();
// If this is a computed property, it's not memberwise initialized unless
// the caller has asked for the declared properties and it is either a
// `lazy` property or a property with an attached wrapper.