mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Banish OptionalTypeKind to ClangImporter.h
The only place this was used in Decl.h was the failability kind of a constructor. I decided to replace this with a boolean isFailable() bit. Now that we have isImplicitlyUnwrappedOptional(), it seems to make more sense to not have ConstructorDecl represent redundant information which might not be internally consistent. Most callers of getFailability() actually only care if the result is failable or not; the few callers that care about it being IUO can check isImplicitlyUnwrappedOptional() as well.
This commit is contained in:
@@ -254,7 +254,7 @@ static ConstructorDecl *createImplicitConstructor(NominalTypeDecl *decl,
|
||||
DeclName name(ctx, DeclBaseName::createConstructor(), paramList);
|
||||
auto *ctor =
|
||||
new (ctx) ConstructorDecl(name, Loc,
|
||||
OTK_None, /*FailabilityLoc=*/SourceLoc(),
|
||||
/*Failable=*/false, /*FailabilityLoc=*/SourceLoc(),
|
||||
/*Throws=*/false, /*ThrowsLoc=*/SourceLoc(),
|
||||
paramList, /*GenericParams=*/nullptr, decl);
|
||||
|
||||
@@ -676,7 +676,7 @@ createDesignatedInitOverride(ClassDecl *classDecl,
|
||||
auto ctor =
|
||||
new (ctx) ConstructorDecl(superclassCtor->getFullName(),
|
||||
classDecl->getBraces().Start,
|
||||
superclassCtor->getFailability(),
|
||||
superclassCtor->isFailable(),
|
||||
/*FailabilityLoc=*/SourceLoc(),
|
||||
/*Throws=*/superclassCtor->hasThrows(),
|
||||
/*ThrowsLoc=*/SourceLoc(),
|
||||
@@ -689,7 +689,7 @@ createDesignatedInitOverride(ClassDecl *classDecl,
|
||||
ctor->computeType();
|
||||
|
||||
ctor->setImplicitlyUnwrappedOptional(
|
||||
ctor->getFailability() == OTK_ImplicitlyUnwrappedOptional);
|
||||
superclassCtor->isImplicitlyUnwrappedOptional());
|
||||
|
||||
ctor->setValidationToChecked();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user