AST: Use ProtocolDecl::getAssociatedTypeMembers() where possible

This commit is contained in:
Slava Pestov
2019-05-24 16:15:32 -04:00
parent 4551230a8b
commit c947eda18f
8 changed files with 128 additions and 147 deletions

View File

@@ -27,6 +27,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/TinyPtrVector.h"
#include <utility>
namespace swift {
@@ -174,9 +175,8 @@ public:
template<typename F>
bool forEachTypeWitness(LazyResolver *resolver, F f) const {
const ProtocolDecl *protocol = getProtocol();
for (auto req : protocol->getMembers()) {
auto assocTypeReq = dyn_cast<AssociatedTypeDecl>(req);
if (!assocTypeReq || req->isInvalid())
for (auto assocTypeReq : protocol->getAssociatedTypeMembers()) {
if (assocTypeReq->isInvalid())
continue;
// If we don't have and cannot resolve witnesses, skip it.