Merge pull request #18392 from slavapestov/error-type-cleanup

Error type cleanup
This commit is contained in:
Slava Pestov
2018-07-31 11:14:27 -07:00
committed by GitHub
14 changed files with 76 additions and 90 deletions

View File

@@ -1204,14 +1204,13 @@ TypeConverter::canStorageUseStoredKeyPathComponent(AbstractStorageDecl *decl) {
M.getSwiftModule());
switch (strategy.getKind()) {
case AccessStrategy::Storage: {
// If the stored value would need to be reabstracted in fully opaque
// context, then we have to treat the component as computed.
auto componentObjTy = decl->getStorageInterfaceType()
->getWithoutSpecifierType();
// Keypaths rely on accessors to handle the special behavior of weak or
// unowned properties.
if (componentObjTy->is<ReferenceStorageType>())
if (decl->getInterfaceType()->is<ReferenceStorageType>())
return false;
// If the stored value would need to be reabstracted in fully opaque
// context, then we have to treat the component as computed.
auto componentObjTy = decl->getValueInterfaceType();
if (auto genericEnv =
decl->getInnermostDeclContext()->getGenericEnvironmentOfContext())
componentObjTy = genericEnv->mapTypeIntoContext(componentObjTy);