mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SourceKit: Fix indexing crash with protocol typealiases
The root cause is that NormalProtocolConformance::forEachValueWitness() needs to skip protocol members that are not requirements. Otherwise we end up passing such a non-requirement member down to NormalProtocolConformance::getWitness() and hit an assert when we cannot find it. It looks like this code path was only ever hit from SourceKit. The fix moves TypeChecker::isRequirement() to a method on ValueDecl, and calls it in the right places. Fixes <https://bugs.swift.org/browse/SR-3815>.
This commit is contained in:
@@ -321,6 +321,8 @@ void NormalProtocolConformance::setTypeWitness(
|
||||
Witness NormalProtocolConformance::getWitness(ValueDecl *requirement,
|
||||
LazyResolver *resolver) const {
|
||||
assert(!isa<AssociatedTypeDecl>(requirement) && "Request type witness");
|
||||
assert(requirement->isProtocolRequirement() && "Not a requirement");
|
||||
|
||||
if (Resolver)
|
||||
resolveLazyInfo();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user