@@ -547,7 +547,7 @@ bool Decl::canHaveComment() const {
547547 return !this ->hasClangNode () &&
548548 (isa<ValueDecl>(this ) || isa<ExtensionDecl>(this )) &&
549549 !isa<ParamDecl>(this ) &&
550- ( !isa<AbstractTypeParamDecl >(this ) || isa<AssociatedTypeDecl>( this ) );
550+ !isa<GenericTypeParamDecl >(this );
551551}
552552
553553ModuleDecl *Decl::getModuleContext () const {
@@ -4623,36 +4623,11 @@ Type TypeAliasDecl::getStructuralType() const {
46234623 return ErrorType::get (ctx);
46244624}
46254625
4626- Type AbstractTypeParamDecl::getSuperclass () const {
4627- auto *genericEnv = getDeclContext ()->getGenericEnvironmentOfContext ();
4628- assert (genericEnv != nullptr && " Too much circularity" );
4629-
4630- auto contextTy = genericEnv->mapTypeIntoContext (getDeclaredInterfaceType ());
4631- if (auto *archetype = contextTy->getAs <ArchetypeType>())
4632- return archetype->getSuperclass ();
4633-
4634- // FIXME: Assert that this is never queried.
4635- return nullptr ;
4636- }
4637-
4638- ArrayRef<ProtocolDecl *>
4639- AbstractTypeParamDecl::getConformingProtocols () const {
4640- auto *genericEnv = getDeclContext ()->getGenericEnvironmentOfContext ();
4641- assert (genericEnv != nullptr && " Too much circularity" );
4642-
4643- auto contextTy = genericEnv->mapTypeIntoContext (getDeclaredInterfaceType ());
4644- if (auto *archetype = contextTy->getAs <ArchetypeType>())
4645- return archetype->getConformsTo ();
4646-
4647- // FIXME: Assert that this is never queried.
4648- return { };
4649- }
4650-
46514626GenericTypeParamDecl::GenericTypeParamDecl (
46524627 DeclContext *dc, Identifier name, SourceLoc nameLoc, SourceLoc ellipsisLoc,
46534628 unsigned depth, unsigned index, bool isParameterPack, bool isOpaqueType,
46544629 TypeRepr *opaqueTypeRepr)
4655- : AbstractTypeParamDecl (DeclKind::GenericTypeParam, dc, name, nameLoc) {
4630+ : TypeDecl (DeclKind::GenericTypeParam, dc, name, nameLoc, { } ) {
46564631 assert (!(ellipsisLoc && !isParameterPack) &&
46574632 " Ellipsis always means type parameter pack" );
46584633
@@ -4736,7 +4711,7 @@ AssociatedTypeDecl::AssociatedTypeDecl(DeclContext *dc, SourceLoc keywordLoc,
47364711 Identifier name, SourceLoc nameLoc,
47374712 TypeRepr *defaultDefinition,
47384713 TrailingWhereClause *trailingWhere)
4739- : AbstractTypeParamDecl (DeclKind::AssociatedType, dc, name, nameLoc),
4714+ : TypeDecl (DeclKind::AssociatedType, dc, name, nameLoc, { } ),
47404715 KeywordLoc(keywordLoc), DefaultDefinition(defaultDefinition),
47414716 TrailingWhere(trailingWhere) {}
47424717
@@ -4745,7 +4720,7 @@ AssociatedTypeDecl::AssociatedTypeDecl(DeclContext *dc, SourceLoc keywordLoc,
47454720 TrailingWhereClause *trailingWhere,
47464721 LazyMemberLoader *definitionResolver,
47474722 uint64_t resolverData)
4748- : AbstractTypeParamDecl (DeclKind::AssociatedType, dc, name, nameLoc),
4723+ : TypeDecl (DeclKind::AssociatedType, dc, name, nameLoc, { } ),
47494724 KeywordLoc(keywordLoc), DefaultDefinition(nullptr ),
47504725 TrailingWhere(trailingWhere), Resolver(definitionResolver),
47514726 ResolverContextData(resolverData) {
@@ -4781,7 +4756,7 @@ AssociatedTypeDecl::getOverriddenDecls() const {
47814756 if (auto cached = request.getCachedResult ())
47824757 overridden = std::move (*cached);
47834758 else
4784- overridden = AbstractTypeParamDecl ::getOverriddenDecls ();
4759+ overridden = TypeDecl ::getOverriddenDecls ();
47854760
47864761 llvm::TinyPtrVector<AssociatedTypeDecl *> assocTypes;
47874762 for (auto decl : overridden) {
@@ -4809,7 +4784,7 @@ static AssociatedTypeDecl *getAssociatedTypeAnchor(
48094784 auto anchor = getAssociatedTypeAnchor (assocType, searched);
48104785 if (!anchor)
48114786 continue ;
4812- if (!bestAnchor || AbstractTypeParamDecl ::compare (anchor, bestAnchor) < 0 )
4787+ if (!bestAnchor || TypeDecl ::compare (anchor, bestAnchor) < 0 )
48134788 bestAnchor = anchor;
48144789 }
48154790
0 commit comments