mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Allow initializer requirements on protocols and check conformance to them.
Swift SVN r14320
This commit is contained in:
@@ -2789,8 +2789,7 @@ Parser::parseDeclConstructor(ParseDeclOptions Flags,
|
||||
assert(Tok.is(tok::kw_init));
|
||||
SourceLoc ConstructorLoc = consumeToken();
|
||||
|
||||
const bool ConstructorsNotAllowed =
|
||||
!(Flags & PD_HasContainerType) || (Flags & PD_InProtocol);
|
||||
const bool ConstructorsNotAllowed = !(Flags & PD_HasContainerType);
|
||||
|
||||
// Reject constructors outside of types.
|
||||
if (ConstructorsNotAllowed) {
|
||||
@@ -2836,7 +2835,7 @@ Parser::parseDeclConstructor(ParseDeclOptions Flags,
|
||||
if (SignatureStatus.hasCodeCompletion())
|
||||
CodeCompletion->setDelayedParsedDecl(CD);
|
||||
|
||||
if (ConstructorsNotAllowed) {
|
||||
if (ConstructorsNotAllowed || SignatureStatus.isError()) {
|
||||
// Tell the type checker not to touch this constructor.
|
||||
CD->setInvalid();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user