SILGen: Fix a couple of problems with materializeForSet in constrained extensions

- Property defined in constrained extension of a class

- Subscript defined in a constrained extension with non-canonical index type

Fixes <rdar://problem/31222187>.
This commit is contained in:
Slava Pestov
2017-03-26 23:57:27 -07:00
parent 70f3d93111
commit efff6a6922
3 changed files with 59 additions and 7 deletions

View File

@@ -52,9 +52,13 @@ TypeConverter::getIndicesAbstractionPattern(SubscriptDecl *decl) {
CanGenericSignature genericSig;
if (auto sig = decl->getGenericSignatureOfContext())
genericSig = sig->getCanonicalSignature();
return AbstractionPattern(genericSig,
decl->getIndicesInterfaceType()
->getCanonicalType());
auto indicesTy = decl->getIndicesInterfaceType();
auto indicesCanTy =
(genericSig
? genericSig->getCanonicalTypeInContext(indicesTy,
*decl->getParentModule())
: indicesTy->getCanonicalType());
return AbstractionPattern(genericSig, indicesCanTy);
}
static const clang::Type *getClangType(const clang::Decl *decl) {