[codecomplete] Handle null type in AbstractClosureExpr context

rdar://problem/27643235
This commit is contained in:
Ben Langmuir
2016-08-23 14:57:15 -07:00
parent f4ffdb597e
commit d8fa0b00ba
2 changed files with 28 additions and 3 deletions

View File

@@ -1578,11 +1578,15 @@ static bool isTopLevelContext(const DeclContext *DC) {
static Type getReturnTypeFromContext(const DeclContext *DC) {
if (auto FD = dyn_cast<AbstractFunctionDecl>(DC)) {
if (auto FT = FD->getType()->getAs<FunctionType>()) {
return FT->getResult();
if (FD->hasType()) {
if (auto FT = FD->getType()->getAs<FunctionType>()) {
return FT->getResult();
}
}
} else if (auto CE = dyn_cast<AbstractClosureExpr>(DC)) {
return CE->getResultType();
if (CE->getType()) {
return CE->getResultType();
}
}
return Type();
}