Teach getSelfTypeForContainer() that it's rude to crash when the container has no type.

Fixes 68 crashes in the compiler-crashers suite.

Swift SVN r26564
This commit is contained in:
Doug Gregor
2015-03-25 23:20:59 +00:00
parent dee6156361
commit cce9081fe2
68 changed files with 71 additions and 136 deletions

View File

@@ -3005,9 +3005,10 @@ static Type getSelfTypeForContainer(AbstractFunctionDecl *theMethod,
}
}
// If the self type is the result of an upstream error, return it
if (selfTy->is<ErrorType>())
return selfTy;
// If the self type couldn't be computed, or is the result of an
// upstream error, return an error type.
if (!selfTy || selfTy->is<ErrorType>())
return ErrorType::get(dc->getASTContext());
// Capture the generic parameters, if requested.
if (outerGenericParams)