fix <rdar://problem/19259730> Using mutating methods in a struct initializer with a let property is rejected

while we're at it, improve the QoI for actually-invalid mutating method calls in struct initalizers.


Swift SVN r24030
This commit is contained in:
Chris Lattner
2014-12-19 06:52:37 +00:00
parent c11eb40008
commit 3a7d8df92b
5 changed files with 59 additions and 3 deletions

View File

@@ -673,7 +673,13 @@ void LifetimeChecker::doIt() {
diag::return_from_init_without_self_init);
break;
}
} else if (isa<ApplyInst>(Inst) && TheMemory.isStructInitSelf()) {
if (shouldEmitError(Inst)) {
diagnose(Module, Inst->getLoc(),
diag::use_of_self_before_fully_init);
noteUninitializedMembers(Use);
}
break;
} else if (isa<MarkFunctionEscapeInst>(Inst))
DiagMessage = diag::global_variable_function_use_uninit;
else if (isa<AddressToPointerInst>(Inst))