diff --git a/include/swift/AST/Decl.h b/include/swift/AST/Decl.h index 48673533dffc3..1870f10f402da 100644 --- a/include/swift/AST/Decl.h +++ b/include/swift/AST/Decl.h @@ -8369,8 +8369,6 @@ class FuncDecl : public AbstractFunctionDecl { TypeRepr *getResultTypeRepr() const { return FnRetType.getTypeRepr(); } - void setDeserializedResultTypeLoc(TypeLoc ResultTyR); - SourceRange getResultTypeSourceRange() const { return FnRetType.getSourceRange(); } @@ -8897,9 +8895,6 @@ class ConstructorDecl : public AbstractFunctionDecl { /// inserted at the end of the initializer by SILGen. Expr *CallToSuperInit = nullptr; - /// Valid when lifetime dependence specifiers are present. - TypeLoc InitRetType; - public: ConstructorDecl(DeclName Name, SourceLoc ConstructorLoc, bool Failable, SourceLoc FailabilityLoc, @@ -8908,7 +8903,7 @@ class ConstructorDecl : public AbstractFunctionDecl { TypeLoc thrownTy, ParameterList *BodyParams, GenericParamList *GenericParams, - DeclContext *Parent, TypeRepr *InitRetTy); + DeclContext *Parent); static ConstructorDecl * createImported(ASTContext &ctx, ClangNode clangNode, DeclName name, @@ -8930,10 +8925,6 @@ class ConstructorDecl : public AbstractFunctionDecl { /// Get the interface type of the initializing constructor. Type getInitializerInterfaceType(); - TypeRepr *getResultTypeRepr() const { return InitRetType.getTypeRepr(); } - - void setDeserializedResultTypeLoc(TypeLoc ResultTyR); - /// Get the typechecked call to super.init expression, which needs to be /// inserted at the end of the initializer by SILGen. Expr *getSuperInitCall() { return CallToSuperInit; } diff --git a/lib/AST/Bridging/DeclBridging.cpp b/lib/AST/Bridging/DeclBridging.cpp index c02a0222d3251..a6887d9aec4e7 100644 --- a/lib/AST/Bridging/DeclBridging.cpp +++ b/lib/AST/Bridging/DeclBridging.cpp @@ -290,13 +290,11 @@ BridgedConstructorDecl BridgedConstructorDecl_createParsed( auto throwsLoc = cThrowsLoc.unbridged(); auto failabilityMarkLoc = cFailabilityMarkLoc.unbridged(); // FIXME: rethrows - // TODO: Handle LifetimeDependentReturnTypeRepr here. auto *decl = new (context) ConstructorDecl( declName, cInitKeywordLoc.unbridged(), failabilityMarkLoc.isValid(), failabilityMarkLoc, asyncLoc.isValid(), asyncLoc, throwsLoc.isValid(), throwsLoc, thrownType.unbridged(), parameterList, - genericParams.unbridged(), cDeclContext.unbridged(), - /*InitRetTy*/ nullptr); + genericParams.unbridged(), cDeclContext.unbridged()); decl->setTrailingWhereClause(genericWhereClause.unbridged()); decl->setImplicitlyUnwrappedOptional(isIUO); diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 777bbfcc66caa..9300405d62ab1 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -3994,8 +3994,6 @@ TypeRepr *ValueDecl::getResultTypeRepr() const { returnRepr = SD->getElementTypeRepr(); } else if (auto *MD = dyn_cast(this)) { returnRepr = MD->resultType.getTypeRepr(); - } else if (auto *CD = dyn_cast(this)) { - returnRepr = CD->getResultTypeRepr(); } return returnRepr; @@ -10500,10 +10498,6 @@ void FuncDecl::setResultInterfaceType(Type type) { std::move(type)); } -void FuncDecl::setDeserializedResultTypeLoc(TypeLoc ResultTyR) { - FnRetType = ResultTyR; -} - FuncDecl *FuncDecl::createImpl(ASTContext &Context, SourceLoc StaticLoc, StaticSpellingKind StaticSpelling, @@ -10941,7 +10935,7 @@ ConstructorDecl::ConstructorDecl(DeclName Name, SourceLoc ConstructorLoc, TypeLoc ThrownType, ParameterList *BodyParams, GenericParamList *GenericParams, - DeclContext *Parent, TypeRepr *ResultTyR) + DeclContext *Parent) : AbstractFunctionDecl(DeclKind::Constructor, Parent, Name, ConstructorLoc, Async, AsyncLoc, Throws, ThrowsLoc, ThrownType, /*HasImplicitSelfDecl=*/true, @@ -10952,7 +10946,6 @@ ConstructorDecl::ConstructorDecl(DeclName Name, SourceLoc ConstructorLoc, if (BodyParams) setParameters(BodyParams); - InitRetType = TypeLoc(ResultTyR); Bits.ConstructorDecl.HasStubImplementation = 0; Bits.ConstructorDecl.Failable = Failable; @@ -10973,16 +10966,11 @@ ConstructorDecl *ConstructorDecl::createImported( failable, failabilityLoc, async, asyncLoc, throws, throwsLoc, TypeLoc::withoutLoc(thrownType), - bodyParams, genericParams, parent, - /*LifetimeDependenceTypeRepr*/ nullptr); + bodyParams, genericParams, parent); ctor->setClangNode(clangNode); return ctor; } -void ConstructorDecl::setDeserializedResultTypeLoc(TypeLoc ResultTyR) { - InitRetType = ResultTyR; -} - bool ConstructorDecl::isObjCZeroParameterWithLongSelector() const { // The initializer must have a single, non-empty argument name. if (getName().getArgumentNames().size() != 1 || diff --git a/lib/ClangImporter/ImportDecl.cpp b/lib/ClangImporter/ImportDecl.cpp index d11455c928de5..7ef89b8d3ec3e 100644 --- a/lib/ClangImporter/ImportDecl.cpp +++ b/lib/ClangImporter/ImportDecl.cpp @@ -3922,8 +3922,7 @@ namespace { /*failable=*/false, /*FailabilityLoc=*/SourceLoc(), /*Async=*/false, /*AsyncLoc=*/SourceLoc(), /*Throws=*/false, /*ThrowsLoc=*/SourceLoc(), - /*ThrownType=*/TypeLoc(), bodyParams, genericParams, dc, - /*LifetimeDependentTypeRepr*/ nullptr); + /*ThrownType=*/TypeLoc(), bodyParams, genericParams, dc); } else { auto resultTy = importedType.getType(); @@ -6734,8 +6733,7 @@ Decl *SwiftDeclConverter::importGlobalAsInitializer( /*FailabilityLoc=*/SourceLoc(), /*Async=*/false, /*AsyncLoc=*/SourceLoc(), /*Throws=*/false, /*ThrowsLoc=*/SourceLoc(), /*ThrownType=*/TypeLoc(), - parameterList, /*GenericParams=*/nullptr, dc, - /*LifetimeDependentTypeRepr*/ nullptr); + parameterList, /*GenericParams=*/nullptr, dc); result->setImplicitlyUnwrappedOptional(isIUO); result->getASTContext().evaluator.cacheOutput(InitKindRequest{result}, std::move(initKind)); @@ -7262,8 +7260,7 @@ ConstructorDecl *SwiftDeclConverter::importConstructor( /*Async=*/false, /*AsyncLoc=*/SourceLoc(), /*Throws=*/importedName.getErrorInfo().has_value(), /*ThrowsLoc=*/SourceLoc(), /*ThrownType=*/TypeLoc(), bodyParams, - /*GenericParams=*/nullptr, const_cast(dc), - /*LifetimeDependentTypeRepr*/ nullptr); + /*GenericParams=*/nullptr, const_cast(dc)); addObjCAttribute(result, selector); recordMemberInContext(dc, result); diff --git a/lib/ClangImporter/SwiftDeclSynthesizer.cpp b/lib/ClangImporter/SwiftDeclSynthesizer.cpp index 5e593be225972..5e41076342bdd 100644 --- a/lib/ClangImporter/SwiftDeclSynthesizer.cpp +++ b/lib/ClangImporter/SwiftDeclSynthesizer.cpp @@ -507,8 +507,7 @@ SwiftDeclSynthesizer::createDefaultConstructor(NominalTypeDecl *structDecl) { /*Async=*/false, /*AsyncLoc=*/SourceLoc(), /*Throws=*/false, /*ThrowsLoc=*/SourceLoc(), /*ThrownType=*/TypeLoc(), emptyPL, - /*GenericParams=*/nullptr, structDecl, - /*LifetimeDependentTypeRepr*/ nullptr); + /*GenericParams=*/nullptr, structDecl); constructor->copyFormalAccessFrom(structDecl); @@ -638,8 +637,7 @@ ConstructorDecl *SwiftDeclSynthesizer::createValueConstructor( /*Async=*/false, /*AsyncLoc=*/SourceLoc(), /*Throws=*/false, /*ThrowsLoc=*/SourceLoc(), /*ThrownType=*/TypeLoc(), paramList, - /*GenericParams=*/nullptr, structDecl, - /*LifetimeDependentTypeRepr*/ nullptr); + /*GenericParams=*/nullptr, structDecl); constructor->copyFormalAccessFrom(structDecl); @@ -1286,8 +1284,7 @@ SwiftDeclSynthesizer::makeEnumRawValueConstructor(EnumDecl *enumDecl) { /*Async=*/false, /*AsyncLoc=*/SourceLoc(), /*Throws=*/false, /*ThrowsLoc=*/SourceLoc(), /*ThrownType=*/TypeLoc(), paramPL, - /*GenericParams=*/nullptr, enumDecl, - /*LifetimeDependentTypeRepr*/ nullptr); + /*GenericParams=*/nullptr, enumDecl); ctorDecl->setImplicit(); ctorDecl->copyFormalAccessFrom(enumDecl); ctorDecl->setBodySynthesizer(synthesizeEnumRawValueConstructorBody, enumDecl); diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 630a5906e1432..e2f31c46919d5 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -9849,7 +9849,7 @@ Parser::parseDeclInit(ParseDeclOptions Flags, DeclAttributes &Attributes) { isAsync, asyncLoc, throwsLoc.isValid(), throwsLoc, thrownTy, BodyParams, GenericParams, - CurDeclContext, FuncRetTy); + CurDeclContext); CD->setImplicitlyUnwrappedOptional(IUO); CD->attachParsedAttrs(Attributes); diff --git a/lib/Sema/CodeSynthesis.cpp b/lib/Sema/CodeSynthesis.cpp index fdc7a637070c6..7256e88fa12d2 100644 --- a/lib/Sema/CodeSynthesis.cpp +++ b/lib/Sema/CodeSynthesis.cpp @@ -332,8 +332,7 @@ static ConstructorDecl *createImplicitConstructor(NominalTypeDecl *decl, /*Failable=*/false, /*FailabilityLoc=*/SourceLoc(), /*Async=*/false, /*AsyncLoc=*/SourceLoc(), /*Throws=*/false, /*ThrowsLoc=*/SourceLoc(), - /*ThrownType=*/TypeLoc(), paramList, /*GenericParams=*/nullptr, decl, - /*LifetimeDependentTypeRepr*/ nullptr); + /*ThrownType=*/TypeLoc(), paramList, /*GenericParams=*/nullptr, decl); // Mark implicit. ctor->setImplicit(); @@ -827,8 +826,7 @@ createDesignatedInitOverride(ClassDecl *classDecl, /*AsyncLoc=*/SourceLoc(), /*Throws=*/superclassCtor->hasThrows(), /*ThrowsLoc=*/SourceLoc(), TypeLoc::withoutLoc(thrownType), bodyParams, - genericParams, implCtx->getAsGenericContext(), - /*LifetimeDependentTypeRepr*/ nullptr); + genericParams, implCtx->getAsGenericContext()); ctor->setImplicit(); diff --git a/lib/Sema/DerivedConformanceCodable.cpp b/lib/Sema/DerivedConformanceCodable.cpp index d1a549e989e8c..4d1485a7b7401 100644 --- a/lib/Sema/DerivedConformanceCodable.cpp +++ b/lib/Sema/DerivedConformanceCodable.cpp @@ -1889,8 +1889,7 @@ static ValueDecl *deriveDecodable_init(DerivedConformance &derived) { /*Async=*/false, /*AsyncLoc=*/SourceLoc(), /*Throws=*/true, SourceLoc(), /*ThrownType=*/TypeLoc(), paramList, - /*GenericParams=*/nullptr, conformanceDC, - /*LifetimeDependentTypeRepr*/ nullptr); + /*GenericParams=*/nullptr, conformanceDC); initDecl->setImplicit(); initDecl->setSynthesized(); diff --git a/lib/Sema/DerivedConformanceCodingKey.cpp b/lib/Sema/DerivedConformanceCodingKey.cpp index 753bacbbd6ecb..1e03e4e6032ea 100644 --- a/lib/Sema/DerivedConformanceCodingKey.cpp +++ b/lib/Sema/DerivedConformanceCodingKey.cpp @@ -132,8 +132,7 @@ static ValueDecl *deriveInitDecl(DerivedConformance &derived, Type paramType, /*Async=*/false, /*AsyncLoc=*/SourceLoc(), /*Throws=*/false, /*ThrowsLoc=*/SourceLoc(), /*ThrownType=*/TypeLoc(), paramList, - /*GenericParams=*/nullptr, parentDC, - /*LifetimeDependentTypeRepr*/ nullptr); + /*GenericParams=*/nullptr, parentDC); initDecl->setImplicit(); diff --git a/lib/Sema/DerivedConformanceRawRepresentable.cpp b/lib/Sema/DerivedConformanceRawRepresentable.cpp index 26a02f12c5158..24683d2560d3d 100644 --- a/lib/Sema/DerivedConformanceRawRepresentable.cpp +++ b/lib/Sema/DerivedConformanceRawRepresentable.cpp @@ -430,8 +430,7 @@ deriveRawRepresentable_init(DerivedConformance &derived) { /*Async=*/false, /*AsyncLoc=*/SourceLoc(), /*Throws=*/false, /*ThrowsLoc=*/SourceLoc(), /*ThrownType=*/TypeLoc(), paramList, - /*GenericParams=*/nullptr, parentDC, - /*LifetimeDependentTypeRepr*/ nullptr); + /*GenericParams=*/nullptr, parentDC); initDecl->setImplicit(); initDecl->setBodySynthesizer(&deriveBodyRawRepresentable_init); diff --git a/lib/Serialization/Deserialization.cpp b/lib/Serialization/Deserialization.cpp index e014089121cf9..bec5c0c80e874 100644 --- a/lib/Serialization/Deserialization.cpp +++ b/lib/Serialization/Deserialization.cpp @@ -3717,8 +3717,7 @@ class DeclDeserializer { /*ThrowsLoc=*/SourceLoc(), TypeLoc::withoutLoc(thrownType), /*BodyParams=*/nullptr, - genericParams, parent, - nullptr); + genericParams, parent); declOrOffset = ctor; ctor->setGenericSignature(MF.getGenericSignature(genericSigID));