mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
DI: All enum initializers should be delegating
Again, since there's no distinction between an enum initializer that delegates to 'self.init' from one that assigns to 'self', we can remove the special handling of enum initializers in the 'root self' case. Now, 'root self' is only used for designated initializers in classes with no superclass, and struct initializers that perform memberwise initialization of stored properties. This regresses some diagnostics, because the logic for delegating init diagnostics is missing some heuristics present in the root self case. I will fix this in a subsequent patch.
This commit is contained in:
@@ -1567,13 +1567,6 @@ void LifetimeChecker::handleLoadUseFailure(const DIMemoryUse &Use,
|
||||
}
|
||||
}
|
||||
|
||||
if (TheMemory.isEnumInitSelf()) {
|
||||
if (!shouldEmitError(Inst)) return;
|
||||
diagnose(Module, returnLoc,
|
||||
diag::return_from_init_without_initing_self);
|
||||
return;
|
||||
}
|
||||
|
||||
if (TheMemory.isAnyInitSelf() && !TheMemory.isClassInitSelf() &&
|
||||
!TheMemory.isDelegatingInit()) {
|
||||
if (!shouldEmitError(Inst)) return;
|
||||
@@ -1593,13 +1586,6 @@ void LifetimeChecker::handleLoadUseFailure(const DIMemoryUse &Use,
|
||||
if (CA->isInitializationOfDest() &&
|
||||
!CA->getFunction()->getArguments().empty() &&
|
||||
SILValue(CA->getFunction()->getArgument(0)) == CA->getDest()) {
|
||||
if (TheMemory.isEnumInitSelf()) {
|
||||
if (!shouldEmitError(Inst)) return;
|
||||
diagnose(Module, Inst->getLoc(),
|
||||
diag::return_from_init_without_initing_self);
|
||||
return;
|
||||
}
|
||||
|
||||
if (TheMemory.isAnyInitSelf() && !TheMemory.isClassInitSelf() &&
|
||||
!TheMemory.isDelegatingInit()) {
|
||||
if (!shouldEmitError(Inst)) return;
|
||||
|
||||
Reference in New Issue
Block a user