mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[TypeChecker] InitAccessors: Fix handling of defaultable init accessor properties during default init synthesis
Default initializable init properties shouldn't prevent default init synthesis and such properties without anything to initialize should be considered by it.
This commit is contained in:
committed by
Pavel Yaskevich
parent
2149a4630a
commit
416bbaec8d
@@ -877,12 +877,19 @@ bool AreAllStoredPropertiesDefaultInitableRequest::evaluate(
|
||||
if (llvm::any_of(initAccessorProperties, [&](const auto &entry) {
|
||||
auto *property =
|
||||
entry.second->getParentPatternBinding();
|
||||
return property->isInitialized(0);
|
||||
return property->isInitialized(0) ||
|
||||
property->isDefaultInitializable();
|
||||
}))
|
||||
return;
|
||||
|
||||
if (VD->hasStorageOrWrapsStorage())
|
||||
HasStorage = true;
|
||||
|
||||
// Treat an init accessor property that doesn't initialize other
|
||||
// properties as stored for initialization purposes.
|
||||
if (auto *initAccessor = VD->getAccessor(AccessorKind::Init)) {
|
||||
HasStorage |= initAccessor->getInitializedProperties().empty();
|
||||
}
|
||||
});
|
||||
|
||||
if (!HasStorage) continue;
|
||||
|
||||
Reference in New Issue
Block a user