mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: Fix crash with protocol erroneously nested inside generic class
The protocol Self parameter is the last generic parameter in the signature, not the first. While we don't allow protocols nested inside generic classes, we would still crash in member type lookup from this. Fixes <rdar://problem/21287703>. Swift SVN r30635
This commit is contained in:
@@ -1719,7 +1719,7 @@ Type ValueDecl::getInterfaceType() const {
|
||||
if (auto assocType = dyn_cast<AssociatedTypeDecl>(this)) {
|
||||
auto proto = cast<ProtocolDecl>(getDeclContext());
|
||||
(void)proto->getType(); // make sure we've computed the type.
|
||||
auto selfTy = proto->getGenericParamTypes()[0];
|
||||
auto selfTy = proto->getGenericParamTypes().back();
|
||||
auto &ctx = getASTContext();
|
||||
InterfaceTy = DependentMemberType::get(
|
||||
selfTy,
|
||||
|
||||
Reference in New Issue
Block a user